Skip to content

Commit

Permalink
Fix bug in appending properties
Browse files Browse the repository at this point in the history
If you passed a Term object, this didn't work
  • Loading branch information
cthoyt committed Nov 3, 2023
1 parent caffc60 commit d67252f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pyobo/struct/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_relationships(self, typedef: TypeDef) -> List[Reference]:
"""Get relationships from the given type."""
return self.relationships[typedef]

def append_exact_match(self, reference):
def append_exact_match(self, reference: ReferenceHint):
"""Append an exact match, also adding an xref."""
reference = _ensure_ref(reference)
self.append_relationship(exact_match, reference)
Expand Down Expand Up @@ -363,11 +363,11 @@ def extend_relationship(self, typedef: TypeDef, references: Iterable[Reference])
raise ValueError("can not extend a collection that includes a null reference")
self.relationships[typedef].extend(references)

def append_property(self, prop: Union[str, TypeDef], value: Union[str, Reference]) -> None:
def append_property(
self, prop: Union[str, TypeDef], value: Union[str, Reference, Referenced]
) -> None:
"""Append a property."""
if isinstance(prop, TypeDef):
prop = prop.curie
if isinstance(value, Reference):
if isinstance(value, (Reference, Referenced)):
value = value.curie
self.properties[prop].append(value)

Expand Down

0 comments on commit d67252f

Please sign in to comment.