From c9d6b2700a310c8e01fa7de8054c480feb447055 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Mon, 13 Jan 2025 15:28:50 +0100 Subject: [PATCH] STY: autopep8'd --- src/linkahead/common/models.py | 32 ++++++++++++++++---------------- unittests/test_container.py | 2 +- unittests/test_entity.py | 1 - 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 7bd08a6..75b03b7 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -2577,9 +2577,9 @@ class PropertyList(list): return self.filter_by_identity(*args, **kwargs) def filter_by_identity(self, prop: Optional[Property] = None, - pid: Union[None, str, int] = None, - name: Optional[str] = None, - conjunction: bool = False) -> list: + pid: Union[None, str, int] = None, + name: Optional[str] = None, + conjunction: bool = False) -> list: """ Return all Properties from the given PropertyList that match the selection criteria. @@ -2606,7 +2606,7 @@ class PropertyList(list): List containing all matching Properties """ return _filter_entity_list_by_identity(self, pid=pid, name=name, entity=prop, - conjunction=conjunction) + conjunction=conjunction) def _get_entity_by_cuid(self, cuid: str): ''' @@ -2748,9 +2748,9 @@ class ParentList(list): return self.filter_by_identity(*args, **kwargs) def filter_by_identity(self, parent: Optional[Parent] = None, - pid: Union[None, str, int] = None, - name: Optional[str] = None, - conjunction: bool = False) -> list: + pid: Union[None, str, int] = None, + name: Optional[str] = None, + conjunction: bool = False) -> list: """ Return all Parents from the given ParentList that match the selection criteria. @@ -2779,7 +2779,7 @@ class ParentList(list): List containing all matching Parents """ return _filter_entity_list_by_identity(self, pid=pid, name=name, entity=parent, - conjunction=conjunction) + conjunction=conjunction) def remove(self, parent: Union[Entity, int, str]): """ @@ -3747,9 +3747,9 @@ class Container(list): return sync_dict def filter_by_identity(self, entity: Optional[Entity] = None, - entity_id: Union[None, str, int] = None, - name: Optional[str] = None, - conjunction: bool = False) -> list: + entity_id: Union[None, str, int] = None, + name: Optional[str] = None, + conjunction: bool = False) -> list: """ Return all Entities from this Container that match the selection criteria. @@ -3775,7 +3775,7 @@ class Container(list): List containing all matching Entities """ return _filter_entity_list_by_identity(self, pid=entity_id, name=name, entity=entity, - conjunction=conjunction) + conjunction=conjunction) @staticmethod def _find_dependencies_in_container(container: Container): @@ -5585,10 +5585,10 @@ def delete(ids: Union[list[int], range], raise_exception_on_error: bool = True): def _filter_entity_list_by_identity(listobject: list[Entity], - entity: Optional[Entity] = None, - pid: Union[None, str, int] = None, - name: Optional[str] = None, - conjunction: bool = False) -> list: + entity: Optional[Entity] = None, + pid: Union[None, str, int] = None, + name: Optional[str] = None, + conjunction: bool = False) -> list: """ Returns a subset of entities from the list based on whether their id and name matches the selection criterion. diff --git a/unittests/test_container.py b/unittests/test_container.py index 54e8767..9df40ff 100644 --- a/unittests/test_container.py +++ b/unittests/test_container.py @@ -210,5 +210,5 @@ def test_container_filter(): cont.extend([db.Record(name=f"TestRec{ii+1}") for ii in range(5)]) recs = cont.filter_by_identity(name="TestRec2") - assert len(recs)== 1 + assert len(recs) == 1 recs[0].name == "TestRec2" diff --git a/unittests/test_entity.py b/unittests/test_entity.py index da05778..855e5a3 100644 --- a/unittests/test_entity.py +++ b/unittests/test_entity.py @@ -284,7 +284,6 @@ def test_filter_by_identity(): assert len(r8.properties.filter_by_identity(name="C")) == 1 assert len(r8.properties.filter_by_identity(pid=12)) == 1 - with warnings.catch_warnings(record=True) as w: # Cause all warnings to always be triggered. warnings.simplefilter("always") -- GitLab