Skip to content

Commit

Permalink
Run pre-commit and update code base accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Nov 2, 2021
1 parent d37af38 commit 384d844
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __objclass__(self):
pass

def __hash__(self):
""" Returns hash based on base_iri
"""Returns hash based on base_iri
This is done to keep Ontology hashable when defining __eq__.
"""
return hash(self.base_iri)
Expand All @@ -214,8 +214,8 @@ def __eq__(self, other):
)

def get_unabbreviated_triples(self):
""" Returns all triples unabbreviated
"""
"""Returns all triples unabbreviated"""

def _unabbreviate(i):
if isinstance(i, int):
if i >= 0:
Expand All @@ -224,9 +224,11 @@ def _unabbreviate(i):
return i

for subject, predicate, obj in self.get_triples():
yield (_unabbreviate(subject),
_unabbreviate(predicate),
_unabbreviate(obj))
yield (
_unabbreviate(subject),
_unabbreviate(predicate),
_unabbreviate(obj),
)

def get_by_label(self, label, label_annotations=None, namespace=None):
"""Returns entity with label annotation `label`.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_load_emmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def test_load_emmo() -> None:
assert EMMO_inferred == EMMO_inferred_again
assert EMMO != EMMO_inferred

EMMO_inferred.new_entity('HydrogenAtom', EMMO_inferred.Atom)
EMMO_inferred.new_entity("HydrogenAtom", EMMO_inferred.Atom)
EMMO_inferred.sync_attributes()
assert EMMO_inferred != EMMO_inferred_again

EMMO_inferred2 = get_emmo()
EMMO_inferred2.Atom.comment.append('New triple')
EMMO_inferred2.Atom.comment.append("New triple")
assert EMMO_inferred2 != EMMO_inferred_again

0 comments on commit 384d844

Please sign in to comment.