Skip to content

Commit

Permalink
Enable passing version to name getter (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Apr 17, 2024
1 parent 3ca8469 commit 76d9b38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pyobo/api/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
logger = logging.getLogger(__name__)


def get_name_by_curie(curie: str) -> Optional[str]:
def get_name_by_curie(curie: str, *, version: Optional[str] = None) -> Optional[str]:
"""Get the name for a CURIE, if possible."""
prefix, identifier = normalize_curie(curie)
if prefix and identifier:
return get_name(prefix, identifier)
return get_name(prefix, identifier, version=version)
return None


Expand Down Expand Up @@ -74,9 +74,9 @@ def _help_get(


@wrap_norm_prefix
def get_name(prefix: str, identifier: str) -> Optional[str]:
def get_name(prefix: str, identifier: str, *, version: Optional[str] = None) -> Optional[str]:
"""Get the name for an entity."""
return _help_get(get_id_name_mapping, prefix, identifier)
return _help_get(get_id_name_mapping, prefix, identifier, version=version)


@lru_cache()
Expand Down

0 comments on commit 76d9b38

Please sign in to comment.