Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
36cddad8
Commit
36cddad8
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: some clean up
parent
6055192a
No related branches found
No related tags found
3 merge requests
!91
Release 0.3
,
!69
Refactor Identifiable and caches
,
!67
MAINT: introduce an identifiable class
Pipeline
#30542
failed
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/identifiable.py
+9
-10
9 additions, 10 deletions
src/caoscrawler/identifiable.py
with
9 additions
and
10 deletions
src/caoscrawler/identifiable.py
+
9
−
10
View file @
36cddad8
...
...
@@ -88,6 +88,7 @@ class Identifiable():
def
_create_hashable_string
(
identifiable
:
Identifiable
)
->
str
:
"""
creates a string from the attributes of an identifiable that can be hashed
String has the form
"
P<parent>N<name>a:5b:10
"
"""
rec_string
=
"
P<{}>N<{}>
"
.
format
(
identifiable
.
record_type
,
identifiable
.
name
)
# TODO this structure neglects Properties if multiple exist for the same name
...
...
@@ -100,18 +101,16 @@ class Identifiable():
"""
Identifiables are equal if they belong to the same Record. Since ID and path are on their
own enough to identify the Record it is sufficient if those attributes are equal.
1. both IDs are set (not None) -> equal if IDs are equal
2. both paths are set (not None) -> equal if paths are equal
3. equal if attribute representations are equal
"""
if
not
isinstance
(
other
,
Identifiable
):
return
False
if
self
.
record_id
is
not
None
and
self
.
record_id
==
other
.
record_id
:
return
True
elif
(
self
.
record_id
is
not
None
and
other
.
record_id
is
not
None
and
self
.
record_id
==
other
.
record_id
):
return
False
elif
self
.
path
is
not
None
and
self
.
path
==
other
.
path
:
return
True
elif
(
self
.
path
is
not
None
and
other
.
path
is
not
None
and
self
.
path
==
other
.
id
):
return
False
raiser
ValueError
(
"
Identifiable can only be compared to other Identifiable objects.
"
)
elif
self
.
record_id
is
not
None
and
other
.
record_id
is
not
None
:
return
self
.
record_id
==
other
.
record_id
elif
self
.
path
is
not
None
and
other
.
path
is
not
None
:
return
self
.
path
==
other
.
path
elif
self
.
get_representation
()
==
other
.
get_representation
():
return
True
else
:
...
...
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