Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 17, 2023
1 parent d64a3e7 commit 305ab29
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
}}
"""
)(citizen=OntologyIndividual, age=int)
for (citizen, age) in result:
for citizen, age in result:
print(citizen.name, age)

# Session contents can be exported to RDF,
Expand Down
1 change: 0 additions & 1 deletion simphony_osp/interfaces/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@ def cache_clear(self):
def _compute_entity_modifications(
self,
) -> Tuple[Set[OntologyEntity], Set[OntologyEntity], Set[OntologyEntity]]:

# Find out from the triples which entities were added, updated and
# deleted.
class Tracker:
Expand Down
16 changes: 8 additions & 8 deletions simphony_osp/ontology/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ def get(
)
else:
result = []
for (i, r, t) in relationship_set.iter_low_level():
for i, r, t in relationship_set.iter_low_level():
if not t:
continue
session = self.session
Expand Down Expand Up @@ -1650,16 +1650,16 @@ def iter(
iterator = iter(relationship_set)
else:

def iterator() -> Iterator[
Tuple[OntologyIndividual, OntologyRelationship]
]:
def iterator() -> (
Iterator[Tuple[OntologyIndividual, OntologyRelationship]]
):
"""Helper iterator.
The purpose of defining this iterator is to be able to
return it, instead of using the `yield` keyword on the main
function, as described on the comment above.
"""
for (i, r, t) in relationship_set.iter_low_level():
for i, r, t in relationship_set.iter_low_level():
if not t:
continue
session = self.session
Expand Down Expand Up @@ -2242,9 +2242,9 @@ def relationships_iter(
Iterator with the queried ontology individuals.
"""

def individuals_and_relationships() -> Iterator[
OntologyIndividual, OntologyEntity
]:
def individuals_and_relationships() -> (
Iterator[OntologyIndividual, OntologyEntity]
):
for s, p, o in self.session.graph.triples(
(
self.identifier,
Expand Down
1 change: 0 additions & 1 deletion simphony_osp/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ def iter(
)

if identifiers:

# The yield statement is encapsulated inside a function so that the
# main function uses the return statement instead of yield. In this
# way, exceptions are checked when the `iter` method is called
Expand Down
1 change: 0 additions & 1 deletion simphony_osp/tools/semantic2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ def terminal():

namespaces = set()
for x in args.plot:

try:
namespaces.add(Session.default_ontology.get_namespace(x))
logger.warning("Using installed version of namespace %s" % x)
Expand Down
2 changes: 0 additions & 2 deletions simphony_osp/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ def lru_cache_timestamp(
"""

def decorator(func: Callable):

holder: Dict[Any, Tuple[datetime, Callable]] = dict()
"""For each instance, holds its timestamp and the cached function."""

@wraps(func)
def wrapper(self, *args, **kwargs):

internal_timestamp, cached_function = holder.get(
self, (None, None)
)
Expand Down

0 comments on commit 305ab29

Please sign in to comment.