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

DOC: add docstrings

parent f6c3fba0
Branches
Tags
2 merge requests!189ENH: add convenience functions,!177ENH: add convenience functions
Pipeline #60229 passed with warnings
This commit is part of merge request !177. Comments created here will be created in the context of that merge request.
...@@ -506,6 +506,7 @@ class Entity: ...@@ -506,6 +506,7 @@ class Entity:
return self return self
def get_versionid(self): def get_versionid(self):
"""Returns the concatenation of ID and version"""
return str(self.id)+"@"+str(self.version.id) return str(self.id)+"@"+str(self.version.id)
def get_importance(self, property): # @ReservedAssignment def get_importance(self, property): # @ReservedAssignment
...@@ -2131,9 +2132,11 @@ class Property(Entity): ...@@ -2131,9 +2132,11 @@ class Property(Entity):
def value_matches_versionid(self): def value_matches_versionid(self):
"""Returns True if the value matches the pattern <id>@<version>"""
return value_matches_versionid(self.value) return value_matches_versionid(self.value)
def get_id_from_versionid_value(self): def get_id_from_versionid_value(self):
"""Returns the ID part of the versionid with the pattern <id>@<version>"""
return get_id_from_versionid(self.value) return get_id_from_versionid(self.value)
class Message(object): class Message(object):
...@@ -5682,6 +5685,7 @@ def _filter_entity_list_by_identity(listobject: list[Entity], ...@@ -5682,6 +5685,7 @@ def _filter_entity_list_by_identity(listobject: list[Entity],
return matches return matches
def value_matches_versionid(value: Union[int, str]): def value_matches_versionid(value: Union[int, str]):
"""Returns True if the value matches the pattern <id>@<version>"""
if isinstance(value, int): if isinstance(value, int):
return False return False
if not isinstance(value, str): if not isinstance(value, str):
...@@ -5690,4 +5694,5 @@ def value_matches_versionid(value: Union[int, str]): ...@@ -5690,4 +5694,5 @@ def value_matches_versionid(value: Union[int, str]):
return "@" in value return "@" in value
def get_id_from_versionid(versionid: str): def get_id_from_versionid(versionid: str):
"""Returns the ID part of the versionid with the pattern <id>@<version>"""
return versionid.split("@")[0] return versionid.split("@")[0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment