From a59c19f54d0bf4cb93436a0a122939a2a028f6ae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:46:01 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/sessions.py | 2 +- simphony_osp/interfaces/interface.py | 1 - simphony_osp/ontology/individual.py | 16 ++++++++-------- simphony_osp/session/session.py | 1 - simphony_osp/tools/semantic2dot.py | 1 - simphony_osp/utils/cache.py | 2 -- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/sessions.py b/examples/sessions.py index 51808e24..65b7de13 100644 --- a/examples/sessions.py +++ b/examples/sessions.py @@ -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, diff --git a/simphony_osp/interfaces/interface.py b/simphony_osp/interfaces/interface.py index 9d737630..19e57f3d 100644 --- a/simphony_osp/interfaces/interface.py +++ b/simphony_osp/interfaces/interface.py @@ -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: diff --git a/simphony_osp/ontology/individual.py b/simphony_osp/ontology/individual.py index 0afba601..928838c3 100644 --- a/simphony_osp/ontology/individual.py +++ b/simphony_osp/ontology/individual.py @@ -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 @@ -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 @@ -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, diff --git a/simphony_osp/session/session.py b/simphony_osp/session/session.py index f8b9d019..2fb3ffe7 100644 --- a/simphony_osp/session/session.py +++ b/simphony_osp/session/session.py @@ -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 diff --git a/simphony_osp/tools/semantic2dot.py b/simphony_osp/tools/semantic2dot.py index 3066e701..c24dd889 100644 --- a/simphony_osp/tools/semantic2dot.py +++ b/simphony_osp/tools/semantic2dot.py @@ -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) diff --git a/simphony_osp/utils/cache.py b/simphony_osp/utils/cache.py index e938a42e..e2c9fd70 100644 --- a/simphony_osp/utils/cache.py +++ b/simphony_osp/utils/cache.py @@ -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) )