From 6facb46eb5edd0011916403c95559a4379941e19 Mon Sep 17 00:00:00 2001
From: "i.nueske" <i.nueske@indiscale.com>
Date: Wed, 30 Oct 2024 09:12:18 +0100
Subject: [PATCH] MNT: Style fixes, comments

---
 src/linkahead/common/models.py | 15 ++++++++-------
 unittests/test_apiutils.py     | 11 ++++++-----
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py
index 781955cb..b4c28ad8 100644
--- a/src/linkahead/common/models.py
+++ b/src/linkahead/common/models.py
@@ -5550,7 +5550,7 @@ def _filter_entity_list(listobject, entity:Entity = None, pid:Union[str, int] =
     Returns
     -------
     matches          : list
-                       List containing all matching Entities
+                       A List containing all matching Entities
     """
     # Check correct input params and setup
     match_entity = False
@@ -5569,10 +5569,11 @@ def _filter_entity_list(listobject, entity:Entity = None, pid:Union[str, int] =
     for candidate, wrapped_is_checked in potentials:
         name_match, pid_match, original_candidate = False, False, None
 
-        # Parents/Properties may be wrapped - if indicated, try to match original
-        # Note: if we want to check all wrapped Entities, this should be switched.
-        #       First check the wrap, then append wrapped. In this case we also
-        #       don't need wrapped_checked, but preferentially append the wrapper.
+        # Parents/Properties may be wrapped - if wanted, try to match original
+        # Note: if we want to check all wrapped Entities, this should be
+        #       switched. First check the wrap, then append wrapped. In this
+        #       case we also don't need wrapped_checked, but preferentially
+        #       append the wrapper.
         if check_wrapped and not wrapped_is_checked:
             try:
                 if candidate._wrapped_entity is not None:
@@ -5593,13 +5594,13 @@ def _filter_entity_list(listobject, entity:Entity = None, pid:Union[str, int] =
         if pid is not None and str(candidate.id) == str(pid):
             pid_match = True
         elif match_entity and str(candidate.id) == str(pid):
-            # If we are matching the entity, both being Null is also satisfactory
+            # If we are matching the entity, both being Null is also ok
             pid_match = True
         if (name is not None and candidate.name is not None
                 and candidate.name.lower() == name.lower()):
             name_match = True
         elif match_entity and candidate.name == name:
-            # If we are matching the entity, both being Null is also satisfactory
+            # If we are matching the entity, both being Null is also ok
             name_match = True
 
         # If the criteria are satisfied, append the match. Otherwise, check
diff --git a/unittests/test_apiutils.py b/unittests/test_apiutils.py
index 76c2a1d9..6f80f1df 100644
--- a/unittests/test_apiutils.py
+++ b/unittests/test_apiutils.py
@@ -461,10 +461,10 @@ def test_empty_diff():
     rec_a.remove_property("RefType")
     rec_b.remove_property("RefType")
     assert empty_diff(rec_a, rec_b)
-    rec_a.add_property(name="RefType", datatype=db.LIST(
-        "RefType"), value=[ref_rec_a, ref_rec_a])
-    rec_b.add_property(name="RefType", datatype=db.LIST(
-        "RefType"), value=[ref_rec_b, ref_rec_b])
+    rec_a.add_property(name="RefType", datatype=db.LIST("RefType"),
+                       value=[ref_rec_a, ref_rec_a])
+    rec_b.add_property(name="RefType", datatype=db.LIST("RefType"),
+                       value=[ref_rec_b, ref_rec_b])
     assert not empty_diff(rec_a, rec_b)
     assert empty_diff(rec_a, rec_b, compare_referenced_records=True)
 
@@ -617,7 +617,8 @@ def test_merge_id_with_resolved_entity():
     # also works in lists:
     recA = db.Record().add_property(
         name=rtname, datatype=db.LIST(rtname), value=[ref_rec, ref_id*2])
-    recB = db.Record().add_property(name=rtname, datatype=db.LIST(rtname), value=[ref_id, ref_id*2])
+    recB = db.Record().add_property(
+        name=rtname, datatype=db.LIST(rtname), value=[ref_id, ref_id*2])
     merge_entities(recA, recB, merge_id_with_resolved_entity=True)
     assert recA.get_property(rtname).value == [ref_id, ref_id*2]
     assert recA.get_property(rtname).value == recB.get_property(rtname).value
-- 
GitLab