Skip to content
Snippets Groups Projects
Commit ad5a3161 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: make more attributes properties

parent 432a0e90
No related branches found
No related tags found
1 merge request!158Unmodifiable Identifiables
Pipeline #47756 canceled
...@@ -63,12 +63,12 @@ class Identifiable(): ...@@ -63,12 +63,12 @@ class Identifiable():
if properties is not None and 'name' in [k.lower() for k in properties.keys()]: 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 " raise ValueError("Please use the separete 'name' keyword instead of the properties "
"dict for name") "dict for name")
self.record_id = record_id self._record_id = record_id
self.path = path self._path = path
self.record_type = record_type self._record_type = record_type
self.name = name self._name = name
if name == "": if name == "":
self.name = None self._name = None
self._properties: dict = {} self._properties: dict = {}
if properties is not None: if properties is not None:
self._properties = properties self._properties = properties
...@@ -78,6 +78,26 @@ class Identifiable(): ...@@ -78,6 +78,26 @@ class Identifiable():
self._representation = sha256( self._representation = sha256(
self._create_hashable_string(self).encode('utf-8')).hexdigest() self._create_hashable_string(self).encode('utf-8')).hexdigest()
@property
def record_id(self):
"""Read-only access to the record id. """
return self._record_id.copy()
@property
def path(self):
"""Read-only access to the path. """
return self._path.copy()
@property
def name(self):
"""Read-only access to the name. """
return self._name.copy()
@property
def record_type(self):
"""Read-only access to the record_type. """
return self._record_type.copy()
@property @property
def properties(self): def properties(self):
"""Read-only access to the properties. """ """Read-only access to the properties. """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment