Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: organize - show files with conflicts requiring adding _obj- #1490

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions dandi/organize.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,26 @@
# Avoid heavy import by importing within function:
from .pynwb_utils import get_object_id

msg = "%d out of %d paths are not unique" % (len(non_unique), len(metadata))
msg = f"{len(non_unique)} out of {len(metadata)} paths are not unique."
non_unique_paths = sorted(non_unique)

# provide more information to the user
def get_msg(path):
in_paths = non_unique[path]
return f"{len(in_paths)} paths 'compete' for the path {path!r}:" + "\n ".join(
[""] + in_paths
)

lgr.info(msg + ". We will try adding _obj- based on crc32 of object_id")
msg += "\n " + get_msg(non_unique_paths[0])
if len(non_unique) > 1:
msg += f"\n {len(non_unique) - 1} more case(s) are listed at DEBUG level."

Check warning on line 322 in dandi/organize.py

View check run for this annotation

Codecov / codecov/patch

dandi/organize.py#L322

Added line #L322 was not covered by tests
lgr.info("%s", msg)
if len(non_unique) > 1:
msg = "Additional non-unique paths:"
for ex_path in non_unique_paths[1:]:
msg += "\n " + get_msg(ex_path)
lgr.debug("%s", msg)

Check warning on line 328 in dandi/organize.py

View check run for this annotation

Codecov / codecov/patch

dandi/organize.py#L325-L328

Added lines #L325 - L328 were not covered by tests
lgr.info("We will try adding _obj- based on crc32 of object_id")
seen_obj_ids = {} # obj_id: object_id
seen_object_ids = {} # object_id: path
recent_nwb_msg = "NWB>=2.1.0 standard (supported by pynwb>=1.1.0)."
Expand Down
Loading