Skip to content
Snippets Groups Projects
Verified Commit fcdf7302 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

FIX: Resolved unnoticed merge conflict.

parent f57ee93e
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!171sav/spss converter
Pipeline #51984 passed with warnings
......@@ -53,19 +53,10 @@ class Identifiable():
backrefs: list, TODO future
"""
<< << << < HEAD
def __init__(self, record_id: Optional[int] = None, path: Optional[str] = None,
record_type: Optional[str] = None,
def __init__(self, record_id: Optional[int] = None, record_type: Optional[str] = None,
name: Optional[str] = None, properties: Optional[dict] = None,
backrefs: Optional[list[Union[int, str]]] = None):
if (record_id is None and path is None and name is None
== == ===
def __init__(self, record_id: int=None, record_type: str=None,
name: str=None, properties: dict=None,
backrefs: list[Union[int, str]]=None):
if (record_id is None and name is None
>> >>>> > dev
and (backrefs is None or len(backrefs) == 0)
and (properties is None or len(properties) == 0)):
raise ValueError(
......@@ -74,17 +65,17 @@ class Identifiable():
if properties is not None and 'name' in [k.lower() for k in properties.keys()]:
raise ValueError("Please use the separete 'name' keyword instead of the properties "
"dict for name")
self.record_id=record_id
self.record_type=record_type
self.name=name
self.record_id = record_id
self.record_type = record_type
self.name = name
if name == "":
self.name=None
self.properties: dict={}
self.name = None
self.properties: dict = {}
if properties is not None:
self.properties=properties
self.backrefs: list[Union[int, db.Entity]]=[]
self.properties = properties
self.backrefs: list[Union[int, db.Entity]] = []
if backrefs is not None:
self.backrefs=backrefs
self.backrefs = backrefs
def get_representation(self) -> str:
return sha256(Identifiable._create_hashable_string(self).encode('utf-8')).hexdigest()
......@@ -118,7 +109,7 @@ class Identifiable():
creates a string from the attributes of an identifiable that can be hashed
String has the form "P<parent>N<name>R<reference-ids>a:5b:10"
"""
rec_string="P<{}>N<{}>R<{}>".format(
rec_string = "P<{}>N<{}>R<{}>".format(
identifiable.record_type,
identifiable.name,
[Identifiable._value_representation(el) for el in identifiable.backrefs])
......@@ -141,7 +132,7 @@ class Identifiable():
def __repr__(self):
""" deterministic text representation of the identifiable """
pstring=json.dumps({k: str(v) for k, v in self.properties.items()})
pstring = json.dumps({k: str(v) for k, v in self.properties.items()})
return (f"{self.__class__.__name__} for RT {self.record_type}: id={self.record_id}; "
f"name={self.name}\n"
f"\tproperties:\n{pstring}\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment