Skip to content

Commit

Permalink
Remove unnecessary definition provenance list (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Jan 19, 2025
1 parent 4509aab commit e275ab2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/pyobo/struct/struct_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,11 @@ def _get_mapping_context(self, p: Reference, o: Reference) -> MappingContext:

def _definition_fp(self) -> str:
definition = obo_escape_slim(self.definition) if self.definition else ""
return f'"{definition}" [{comma_separate_references(self._get_definition_provenance())}]'
dp = self._get_definition_provenance()
if dp:
return f'"{definition}" [{comma_separate_references(dp)}]'
else:
return f'"{definition}"'

def _get_definition_provenance(self) -> Sequence[Reference | OBOLiteral]:
if self.definition is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_struct/test_obo/test_struct_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def test_6_definition(self):
[Term]
id: GO:0050069
name: lysine dehydrogenase activity
def: "Something" []
def: "Something"
""",
ofn="""\
Declaration(Class(GO:0050069))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_struct/test_obo/test_typedef.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def test_6_description(self) -> None:
f"""\
[Typedef]
id: RO:0000087
def: "{obo_escape_slim(has_role.definition)}" []
def: "{obo_escape_slim(has_role.definition)}"
""",
typedef,
)
Expand Down

0 comments on commit e275ab2

Please sign in to comment.