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
fcdf7302
Verified
Commit
fcdf7302
authored
10 months ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Resolved unnoticed merge conflict.
parent
f57ee93e
No related branches found
No related tags found
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!171
sav/spss converter
Pipeline
#51984
passed with warnings
10 months 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
+11
-20
11 additions, 20 deletions
src/caoscrawler/identifiable.py
with
11 additions
and
20 deletions
src/caoscrawler/identifiable.py
+
11
−
20
View file @
fcdf7302
...
...
@@ -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
"
\t
properties:
\n
{
pstring
}
\n
"
...
...
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