Skip to content

Commit

Permalink
more docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwagner committed Jul 15, 2024
1 parent 06bc1b5 commit 2e55240
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ga4gh/core/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ def ga4gh_identify(vro, in_place='default', as_version=None):
- 'never': the vro.id field will not be edited in-place,
even when empty
If 'as_version' is set to a version string, other parameters are
ignored and an identifier returned following the conventions of
the VRS version indicated by 'as_version'.
TODO update example for VRS 2.0
>>> import ga4gh.vrs
>>> ival = ga4gh.vrs.models.SimpleInterval(start=44908821, end=44908822)
Expand Down Expand Up @@ -169,7 +173,9 @@ def ga4gh_digest(vro: BaseModel, overwrite=False, as_version=None):
"""
Return the GA4GH digest for the object.
do_compact: bool - true if object compaction should be performed during serialization
If 'as_version' is set to a version string, other parameters
are ignored and a digest returned following the conventions of
the VRS version indicated by 'as_version'.
TODO update example
Expand Down Expand Up @@ -215,8 +221,11 @@ def collapse_identifiable_values(obj: dict) -> dict:

def ga4gh_serialize(obj: BaseModel, as_version=None) -> Optional[bytes]:
"""
TODO find a way to output identify_all without the 'digest' fields on subobjects,
without traversing the whole tree again in collapse_identifiable_values.
Serializes an object for use in computed digest computation.
If a VRS version string is specified for the 'as_version' parameter,
the returned serialization follows the convention of the specified
VRS version.
"""
if as_version is None:
return obj.model_dump_json().encode("utf-8")
Expand Down

0 comments on commit 2e55240

Please sign in to comment.