From fcdf73026779e2aaaa153d37361b262cd278922b Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Tue, 11 Jun 2024 11:06:55 +0200 Subject: [PATCH] FIX: Resolved unnoticed merge conflict. --- src/caoscrawler/identifiable.py | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/caoscrawler/identifiable.py b/src/caoscrawler/identifiable.py index d7bccac7..f6c85c69 100644 --- a/src/caoscrawler/identifiable.py +++ b/src/caoscrawler/identifiable.py @@ -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" -- GitLab