From 9b75417a5359f494a9f1464932f63baa90f09f5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Wed, 17 Apr 2024 13:11:27 +0200
Subject: [PATCH] fix

---
 src/caoscrawler/semantic_target.py | 34 +++++++++++++++---------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/caoscrawler/semantic_target.py b/src/caoscrawler/semantic_target.py
index 818e686a..dfd817b9 100644
--- a/src/caoscrawler/semantic_target.py
+++ b/src/caoscrawler/semantic_target.py
@@ -23,7 +23,7 @@
 A data model class for the semantic data that shall be created by synchronization of the crawler.
 """
 
-from typing import Any, List, Optional, Union
+from typing import Any, Dict, List, Optional, Union
 from uuid import uuid4 as uuid
 
 import linkahead as db
@@ -100,17 +100,17 @@ class SemanticTarget():
 
     def __init__(self, entities: List[db.Entity], identifiableAdapter):
         self.identifiableAdapter = identifiableAdapter
-        self._id_look_up: dict[int, SemanticEntity] = {}
-        self._path_look_up: dict[str, SemanticEntity] = {}
-        self._identifiable_look_up: dict[str, SemanticEntity] = {}
-        self._missing: dict[int, SemanticEntity] = {}
-        self._existing: dict[int, SemanticEntity] = {}
+        self._id_look_up: Dict[int, SemanticEntity] = {}
+        self._path_look_up: Dict[str, SemanticEntity] = {}
+        self._identifiable_look_up: Dict[str, SemanticEntity] = {}
+        self._missing: Dict[int, SemanticEntity] = {}
+        self._existing: Dict[int, SemanticEntity] = {}
         self._remote_missing_counter = -1  # TODO: I guess we can now get rid of this...
 
         # create initial set of SemanticEntities from provided Entity list
-        self.se: list[SemanticEntity] = []  # list of all SemanticEntities
+        self.se: List[SemanticEntity] = []  # list of all SemanticEntities
         # TODO do we only need this for creating the initial reference map? Remove it?
-        self.se_lookup: dict[str, SemanticEntity] = {}  # lookup: UUID -> SemanticEntity
+        self.se_lookup: Dict[str, SemanticEntity] = {}  # lookup: UUID -> SemanticEntity
         entities = self._create_flat_list(entities)
         self._sanity_check(entities)
         for el in entities:
@@ -257,7 +257,7 @@ class SemanticTarget():
                    + [id(ent) in self._missing for ent in self.backward_id_referenced_by[se.uuid]])
 
     @ staticmethod
-    def _sanity_check(entities: list[db.Entity]):
+    def _sanity_check(entities: List[db.Entity]):
         for ent in entities:
             if ent.role == "Record" and len(ent.parents) == 0:
                 raise RuntimeError(f"Records must have a parent.\n{ent}")
@@ -271,7 +271,7 @@ class SemanticTarget():
             se.fragments = [se.fragments[0]]
 
     @ staticmethod
-    def _create_flat_list(ent_list: list[db.Entity], flat: Optional[list[db.Entity]] = None):
+    def _create_flat_list(ent_list: List[db.Entity], flat: Optional[List[db.Entity]] = None):
         """
         Recursively adds entities and all their properties contained in ent_list to
         the output list flat.
@@ -348,7 +348,7 @@ class SemanticTarget():
                     raise RuntimeError("Cannot merge Entities")
 
     @ staticmethod
-    def _create_reference_mapping(flat: list[SemanticEntity], se_lookup):
+    def _create_reference_mapping(flat: List[SemanticEntity], se_lookup):
         """
         TODO update docstring
         Create a dictionary of dictionaries of the form:
@@ -363,12 +363,12 @@ class SemanticTarget():
         to them.
         """
         # TODO we need to treat children of RecordTypes somehow.
-        forward_references: dict[str, set[SemanticEntity]] = {}
-        backward_references: dict[str, set[SemanticEntity]] = {}
-        forward_id_references: dict[str, set[SemanticEntity]] = {}
-        backward_id_references: dict[str, set[SemanticEntity]] = {}
-        forward_id_referenced_by: dict[str, set[SemanticEntity]] = {}
-        backward_id_referenced_by: dict[str, set[SemanticEntity]] = {}
+        forward_references: Dict[str, set[SemanticEntity]] = {}
+        backward_references: Dict[str, set[SemanticEntity]] = {}
+        forward_id_references: Dict[str, set[SemanticEntity]] = {}
+        backward_id_references: Dict[str, set[SemanticEntity]] = {}
+        forward_id_referenced_by: Dict[str, set[SemanticEntity]] = {}
+        backward_id_referenced_by: Dict[str, set[SemanticEntity]] = {}
 
         # initialize with empty lists/dict
         for se in flat:
-- 
GitLab