Skip to content

Commit

Permalink
Don't generate an id if the object already has one
Browse files Browse the repository at this point in the history
  • Loading branch information
ehclark committed Dec 26, 2023
1 parent 8581e03 commit 9e5db1c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ga4gh/core/_internal/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ def ga4gh_identify(vro):
"""
if is_identifiable(vro):
digest = ga4gh_digest(vro)
pfx = vro.ga4gh.prefix
ir = f"{namespace}{curie_sep}{pfx}{ref_sep}{digest}"
return ir
id = getattr(vro, "id", None)
if id:
return id
else:
digest = ga4gh_digest(vro)
pfx = vro.ga4gh.prefix
ir = f"{namespace}{curie_sep}{pfx}{ref_sep}{digest}"
return ir
return None


Expand Down

0 comments on commit 9e5db1c

Please sign in to comment.