Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
85d807d3
Commit
85d807d3
authored
6 months ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add docstrings
parent
f6c3fba0
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!189
ENH: add convenience functions
,
!177
ENH: add convenience functions
Pipeline
#60229
passed with warnings
6 months ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
This commit is part of merge request
!177
. Comments created here will be created in the context of that merge request.
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/linkahead/common/models.py
+5
-0
5 additions, 0 deletions
src/linkahead/common/models.py
with
5 additions
and
0 deletions
src/linkahead/common/models.py
+
5
−
0
Edit
View file @
85d807d3
...
@@ -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]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment