Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary definition provenance list #327

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading