Skip to content
Snippets Groups Projects
Commit 65ca9fba authored by I. Nüske's avatar I. Nüske
Browse files

MNT: Use new Entity getters

parent fa86a04e
No related branches found
No related tags found
2 merge requests!128MNT: Added a warning when column metadata is not configured, and a better...,!126Fix pylint errors
...@@ -296,7 +296,7 @@ class DataModel(dict): ...@@ -296,7 +296,7 @@ class DataModel(dict):
if parent.name in visited_parents: if parent.name in visited_parents:
continue continue
visited_parents.add(parent.name) visited_parents.add(parent.name)
parent_importance = importances.get(parent._flags.get("inheritance"), 999) parent_importance = importances.get(parent.flags.get("inheritance"), 999)
if parent.name in self: if parent.name in self:
deep_parent = self.get_deep(parent.name, # visited_props=visited_props, deep_parent = self.get_deep(parent.name, # visited_props=visited_props,
visited_parents=visited_parents visited_parents=visited_parents
......
...@@ -43,10 +43,9 @@ class EntityMapping(object): ...@@ -43,10 +43,9 @@ class EntityMapping(object):
self.to_target = {} self.to_target = {}
def add(self, target, existing): def add(self, target, existing):
if target._cuid is None: if target.cuid is None:
target._cuid = str(uuid())
self.to_existing[str(target._cuid)] = existing
target._cuid = str(uuid()) # pylint: disable=protected-access target._cuid = str(uuid()) # pylint: disable=protected-access
self.to_existing[str(target.cuid)] = existing
self.to_target[existing.id] = target self.to_target[existing.id] = target
...@@ -108,11 +107,11 @@ def update_structure(em, updating: db.Container, target_structure: db.Record): ...@@ -108,11 +107,11 @@ def update_structure(em, updating: db.Container, target_structure: db.Record):
A record which may have references to other records. Must be a DAG. A record which may have references to other records. Must be a DAG.
""" """
if target_structure._cuid in em.to_existing: if target_structure.cuid in em.to_existing:
update_matched_entity(em, update_matched_entity(em,
updating, updating,
target_structure, target_structure,
em.to_existing[target_structure._cuid]) em.to_existing[target_structure.cuid])
for prop in target_structure.get_properties(): for prop in target_structure.get_properties():
if prop.is_reference(server_retrieval=True): if prop.is_reference(server_retrieval=True):
...@@ -139,8 +138,8 @@ def update_matched_entity(em, updating, target_record, existing_record): ...@@ -139,8 +138,8 @@ def update_matched_entity(em, updating, target_record, existing_record):
# check for remaining property types # check for remaining property types
if isinstance(prop.value, db.Entity): if isinstance(prop.value, db.Entity):
if prop.value._cuid in em.to_existing: if prop.value.cuid in em.to_existing:
value = em.to_existing[prop.value._cuid].id value = em.to_existing[prop.value.cuid].id
else: else:
value = prop.value.id value = prop.value.id
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment