From 4e061b4f1375cecbcebd3b592abad940fffd3f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Tue, 5 Nov 2024 09:13:10 +0100 Subject: [PATCH] FIX: style and lint errors --- src/linkahead/apiutils.py | 2 +- src/linkahead/cached.py | 2 +- unittests/test_apiutils.py | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/linkahead/apiutils.py b/src/linkahead/apiutils.py index fe79d5fc..0093233e 100644 --- a/src/linkahead/apiutils.py +++ b/src/linkahead/apiutils.py @@ -327,7 +327,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity, try: same = empty_diff(val0, val1, False, entity_name_id_equivalency) - except: + except (ValueError, NotImplementedError): same = False if same: continue diff --git a/src/linkahead/cached.py b/src/linkahead/cached.py index cf1d1d34..6715c166 100644 --- a/src/linkahead/cached.py +++ b/src/linkahead/cached.py @@ -116,7 +116,7 @@ All additional arguments are at their default values. return result -@ lru_cache(maxsize=DEFAULT_SIZE) +@lru_cache(maxsize=DEFAULT_SIZE) def _cached_access(kind: AccessType, value: Union[str, int], unique: bool = True): # This is the function that is actually cached. # Due to the arguments, the cache has kind of separate sections for cached_query and diff --git a/unittests/test_apiutils.py b/unittests/test_apiutils.py index 2688caed..4c529e36 100644 --- a/unittests/test_apiutils.py +++ b/unittests/test_apiutils.py @@ -343,14 +343,8 @@ def test_compare_entities_battery(): # Order invariance t7 = db.Property(**prop_settings).add_parent(par1).add_property(prop1) t8 = db.Property(**alt_settings).add_parent(par3).add_property(prop3) - try: - diffs_0 = compare_entities(t7, t8), compare_entities(t7, t8, True) - except: - diffs_0 = None - try: - diffs_1 = compare_entities(t8, t7)[::-1], compare_entities(t8, t7, True)[::-1] - except: - diffs_1 = None + diffs_0 = compare_entities(t7, t8), compare_entities(t7, t8, True) + diffs_1 = compare_entities(t8, t7)[::-1], compare_entities(t8, t7, True)[::-1] assert diffs_0 == diffs_1 prop_settings = {"datatype": db.REFERENCE, "description": "desc of prop", "value": db.Record().add_parent(par3), "unit": '°'} -- GitLab