Skip to content

Commit

Permalink
Lazy load converter from Bioregistry
Browse files Browse the repository at this point in the history
Depends on biopragmatics/bioregistry#652, helps solve #7
  • Loading branch information
cthoyt committed Nov 14, 2022
1 parent ee28000 commit b2507c4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/bioontologies/obograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from operator import attrgetter
from typing import Any, Iterable, List, Mapping, Optional, Set, Tuple, Union

from bioregistry import curie_to_str, manager
from curies import Converter
from bioregistry import curie_to_str, manager, get_default_converter
from pydantic import BaseModel, Field
from tqdm.auto import tqdm
from typing_extensions import Literal
Expand Down Expand Up @@ -40,7 +39,6 @@

MaybeCURIE = Union[Tuple[str, str], Tuple[None, None]]

converter = Converter.from_reverse_prefix_map(manager.get_reverse_prefix_map(include_prefixes=True))


class StandardizeMixin:
Expand Down Expand Up @@ -571,7 +569,7 @@ def _compress_uri_or_curie_or_str(
if cv:
return cv

prefix, identifier = converter.parse_uri(s)
prefix, identifier = get_default_converter().parse_uri(s)
if prefix and identifier:
if prefix == "obo" and "#" in identifier:
return _parse_obo_rel(s, identifier)
Expand Down

0 comments on commit b2507c4

Please sign in to comment.