]> Nutra Git (v1) - gamesguru/getmyancestors.git/commitdiff
lint fixes
authorShane Jaroch <chown_tee@proton.me>
Thu, 22 Jan 2026 22:55:29 +0000 (17:55 -0500)
committerShane Jaroch <chown_tee@proton.me>
Thu, 22 Jan 2026 22:55:29 +0000 (17:55 -0500)
getmyancestors/classes/session.py
getmyancestors/classes/tree/core.py
getmyancestors/mergemyanc.py

index 630aea2e4111932f5329884b697758384d75b3ed..67c59546215d7b7ac8b4e5afbe785a9d48185baf 100644 (file)
@@ -197,9 +197,8 @@ class GMASession(requests.Session):
         # 1. Check external license file
         # We store license acceptance in a separate JSON file so it survives cache clearing
         license_file = os.path.join(
-            os.path.dirname(self.db_path), "..", "license-agreement.json"
+            os.path.dirname(self.db_path), "license-agreement.json"
         )
-        license_file = os.path.abspath(license_file)
 
         if os.path.exists(license_file):
             try:
@@ -267,10 +266,7 @@ class GMASession(requests.Session):
                 "auth": auth_header,
             }
             # Save to separate JSON file
-            cookie_file = os.path.join(
-                os.path.dirname(self.db_path), "..", "cookies.json"
-            )
-            cookie_file = os.path.abspath(cookie_file)
+            cookie_file = os.path.join(os.path.dirname(self.db_path), "cookies.json")
 
             with open(cookie_file, "w", encoding="utf-8") as f:
                 json.dump(data, f)
@@ -282,8 +278,7 @@ class GMASession(requests.Session):
 
     def load_cookies(self):
         """load cookies and authorization header from JSON"""
-        cookie_file = os.path.join(os.path.dirname(self.db_path), "..", "cookies.json")
-        cookie_file = os.path.abspath(cookie_file)
+        cookie_file = os.path.join(os.path.dirname(self.db_path), "cookies.json")
 
         if os.path.exists(cookie_file):
             try:
index 046e8a053dabd8595487ab65aaff13f47a37e3d8..f1228daf6f6880f39e34f4012c466facfcf9bd93 100644 (file)
@@ -983,14 +983,16 @@ class Tree:
         """add parents relationships
         :param fids: a set of fids
         """
+        # Materialize once to avoid exhausting iterator
+        fids_list = [f for f in fids if f in self.indi]
         parents = set()
-        for fid in [f for f in fids if f in self.indi]:
+        for fid in fids_list:
             for couple in self.indi[fid].parents:
                 parents |= set(couple)
         if parents:
             parents -= set(self.exclude)
             self.add_indis(set(filter(None, parents)))
-        for fid in [f for f in fids if f in self.indi]:
+        for fid in fids_list:
             for father, mother in self.indi[fid].parents:
                 self.add_trio(
                     self.indi.get(father) if father else None,
@@ -1178,11 +1180,11 @@ class Tree:
         resname.text = self.display_name
 
         people = ET.SubElement(root, "people")
-        for indi in sorted(self.indi.values(), key=lambda x: x.id):
+        for indi in sorted(self.indi.values(), key=lambda x: str(x.id or "")):
             indi.printxml(people)
 
         families = ET.SubElement(root, "families")
-        for fam in sorted(self.fam.values(), key=lambda x: x.id):
+        for fam in sorted(self.fam.values(), key=lambda x: str(x.id or "")):
             fam.printxml(families)
 
         events = ET.SubElement(root, "events")
index f1426efb17244300a42696431d6ca784a9e3acc7..0d5b7c25d4f21d8a565cb51457169d01f68ab62d 100755 (executable)
@@ -111,7 +111,11 @@ def main(
 
             # Deduplicate names by string representation
             def merge_names(target_set, source_set):
-                target_set.update(source_set)
+                existing_names = {str(n) for n in target_set}
+                for n in source_set:
+                    if str(n) not in existing_names:
+                        target_set.add(n)
+                        existing_names.add(str(n))
 
             # Helper for whitespace normalization in quotes
             def norm_space(s):