Skip to content

Commit

Permalink
explicitaly show unchanged IDs as such (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
axelvonkamp authored Mar 1, 2024
1 parent 17da7d4 commit b08dc82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cnapy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,14 @@ def replace_ids(dict_list: DictList, annotation_key: str, unambiguous_only: bool
continue
old_id = entry.id
for new_id in candidates:
if new_id == old_id:
print(old_id, "remains unchanged")
break
try:
entry.id = new_id
entry.annotation['original ID'] = old_id
break
except ValueError: # new_id already in use
pass
if len(candidates) > 0 and old_id == entry.id:
if len(candidates) > 0 and new_id != old_id and old_id == entry.id:
print("Could not find a new ID for", entry.id, "in", candidates)

0 comments on commit b08dc82

Please sign in to comment.