diff --git a/src/caoscrawler/sync_graph.py b/src/caoscrawler/sync_graph.py index 897918e275f6820bc82b3c5e3aa3490fdecc6609..0fe241da83ac0294a78485600dfea83a2d258abd 100644 --- a/src/caoscrawler/sync_graph.py +++ b/src/caoscrawler/sync_graph.py @@ -131,7 +131,7 @@ class SyncGraph: # set an ID in _mark_missing if a node is in the uncheck list. Thus, setting the ID once # prevents future attempts to set the ID of the same node. # Also, setting an identifiable is only done when needed, i.e. there is no identifiable. - # Note, that when ever one node is changed, we check all dependend nodes (see usage of + # Note, that when ever one node is changed, we check all dependent nodes (see usage of # `_get_nodes_whose_identity_relies_on`) whether something should be updated. Thus, we cannot # miss a necessary update. def __init__( @@ -361,10 +361,8 @@ class SyncGraph: ) node.identifiable = identifiable equivalent_se = self.get_equivalent(node) - if equivalent_se is not None and equivalent_se is not node: + if equivalent_se is not None: self._merge_into(node, equivalent_se) - if equivalent_se.identifiable is None: - raise ValueError("Identifiable is missing") else: if node.identifiable.get_representation() in self._identifiable_look_up: raise RuntimeError("Identifiable is already in the look up") @@ -541,7 +539,7 @@ class SyncGraph: - marks target as missing/existing if source was marked that way - adds an identifiable if now possible (e.g. merging based on ID might allow create an identifiable when none of the two nodes hand the sufficient properties on its own before) - - check whether dependend nodes can now get and identifiable (the merge might have set the + - check whether dependent nodes can now get and identifiable (the merge might have set the ID such that dependen nodes can now create an identifiable) """ # sanity checks @@ -627,7 +625,7 @@ class SyncGraph: # - mark existing # - mark missing # - merge - self._add_identifiables_to_dependend_nodes(target) + self._add_identifiables_to_dependent_nodes(target) if self.get_equivalent(target) is not None: self._merge_into(target, self.get_equivalent(target)) @@ -672,7 +670,7 @@ class SyncGraph: value=lambda val: se_lookup[id(val)], ) - def _add_identifiables_to_dependend_nodes(self, node): + def _add_identifiables_to_dependent_nodes(self, node): """For each dependent node, we check whether this allows to create an identifiable Last review by Alexander Schlemmer on 2024-05-29. @@ -693,7 +691,7 @@ class SyncGraph: # - mark existing # - mark missing # - merge - self._add_identifiables_to_dependend_nodes(node) + self._add_identifiables_to_dependent_nodes(node) # For each dependent node, we set the ID to None (missing) # (None is the default second argument of set_id_of_node.) for other_node in self._get_nodes_whose_identity_relies_on(node): @@ -713,4 +711,4 @@ class SyncGraph: # - mark existing # - mark missing # - merge - self._add_identifiables_to_dependend_nodes(node) + self._add_identifiables_to_dependent_nodes(node)