Skip to content

Commit

Permalink
Update struct.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jan 5, 2025
1 parent 5264f10 commit badf9b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pyobo/struct/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,11 @@ def _reference(


#: A set of warnings, used to make sure we don't show the same one over and over
_TYPEDEF_WARNINGS: set[tuple[str, Reference]] = set()
_TYPEDEF_WARNINGS: set[tuple[str, curies.Reference]] = set()


def _typedef_warn(
prefix: str, predicate: Reference, typedefs: Mapping[ReferenceTuple, TypeDef]
prefix: str, predicate: curies.Reference, typedefs: Mapping[ReferenceTuple, TypeDef]
) -> None:
if predicate.pair in default_typedefs or predicate.pair in typedefs:
return None
Expand Down Expand Up @@ -839,16 +839,17 @@ def _synonym_typedef_warn(
key = prefix, predicate
if key not in _SYNONYM_TYPEDEF_WARNINGS:
_SYNONYM_TYPEDEF_WARNINGS.add(key)
predicate_curie = getattr(predicate, "preferred_curie", predicate.curie)
if predicate.prefix == "obo":
# Throw our hands up in the air. By using `obo` as the prefix,
# we already threw using "real" definitions out the window
logger.warning(
f"[{prefix}] synonym typedef with OBO prefix not defined: {predicate.curie}."
f"[{prefix}] synonym typedef with OBO prefix not defined: {predicate_curie}."
f"\n\tThis might be because you used an unqualified prefix in an OBO file, "
f"which automatically gets an OBO prefix."
)
else:
logger.warning(f"[{prefix}] synonym typedef not defined: {predicate.curie}")
logger.warning(f"[{prefix}] synonym typedef not defined: {predicate_curie}")
return None


Expand Down

0 comments on commit badf9b5

Please sign in to comment.