Skip to content

Commit

Permalink
Allow enref() caller to get back id and object as tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
ehclark committed Dec 26, 2023
1 parent 39eae07 commit 8581e03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ga4gh/core/_internal/enderef.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
_logger = logging.getLogger(__name__)


def ga4gh_enref(o, cra_map, object_store=None):
def ga4gh_enref(o, cra_map, object_store=None, return_id_obj_tuple=False):
"""Recursively convert "referable attributes" from inlined to
referenced form. Returns a new object.
Expand Down Expand Up @@ -65,8 +65,8 @@ def _enref(o):

# in-place replacement on object copy
o = pydantic_copy(o)
_enref(o)
return o
_id = _enref(o)
return (_id, o) if return_id_obj_tuple else o


def ga4gh_deref(o, cra_map, object_store):
Expand Down
4 changes: 2 additions & 2 deletions src/ga4gh/vrs/_internal/enderef.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .models import class_refatt_map


def vrs_enref(o, object_store=None):
return ga4gh_enref(o, cra_map=class_refatt_map, object_store=object_store)
def vrs_enref(o, object_store=None, return_id_obj_tuple=False):
return ga4gh_enref(o, cra_map=class_refatt_map, object_store=object_store, return_id_obj_tuple=return_id_obj_tuple)


def vrs_deref(o, object_store):
Expand Down

0 comments on commit 8581e03

Please sign in to comment.