Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
65ca9fba
Commit
65ca9fba
authored
6 months ago
by
I. Nüske
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Use new Entity getters
parent
fa86a04e
No related branches found
No related tags found
2 merge requests
!128
MNT: Added a warning when column metadata is not configured, and a better...
,
!126
Fix pylint errors
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/models/data_model.py
+1
-1
1 addition, 1 deletion
src/caosadvancedtools/models/data_model.py
src/caosadvancedtools/structure_mapping.py
+6
-7
6 additions, 7 deletions
src/caosadvancedtools/structure_mapping.py
with
7 additions
and
8 deletions
src/caosadvancedtools/models/data_model.py
+
1
−
1
View file @
65ca9fba
...
@@ -296,7 +296,7 @@ class DataModel(dict):
...
@@ -296,7 +296,7 @@ class DataModel(dict):
if
parent
.
name
in
visited_parents
:
if
parent
.
name
in
visited_parents
:
continue
continue
visited_parents
.
add
(
parent
.
name
)
visited_parents
.
add
(
parent
.
name
)
parent_importance
=
importances
.
get
(
parent
.
_
flags
.
get
(
"
inheritance
"
),
999
)
parent_importance
=
importances
.
get
(
parent
.
flags
.
get
(
"
inheritance
"
),
999
)
if
parent
.
name
in
self
:
if
parent
.
name
in
self
:
deep_parent
=
self
.
get_deep
(
parent
.
name
,
# visited_props=visited_props,
deep_parent
=
self
.
get_deep
(
parent
.
name
,
# visited_props=visited_props,
visited_parents
=
visited_parents
visited_parents
=
visited_parents
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/structure_mapping.py
+
6
−
7
View file @
65ca9fba
...
@@ -43,10 +43,9 @@ class EntityMapping(object):
...
@@ -43,10 +43,9 @@ class EntityMapping(object):
self
.
to_target
=
{}
self
.
to_target
=
{}
def
add
(
self
,
target
,
existing
):
def
add
(
self
,
target
,
existing
):
if
target
.
_cuid
is
None
:
if
target
.
cuid
is
None
:
target
.
_cuid
=
str
(
uuid
())
self
.
to_existing
[
str
(
target
.
_cuid
)]
=
existing
target
.
_cuid
=
str
(
uuid
())
# pylint: disable=protected-access
target
.
_cuid
=
str
(
uuid
())
# pylint: disable=protected-access
self
.
to_existing
[
str
(
target
.
cuid
)]
=
existing
self
.
to_target
[
existing
.
id
]
=
target
self
.
to_target
[
existing
.
id
]
=
target
...
@@ -108,11 +107,11 @@ def update_structure(em, updating: db.Container, target_structure: db.Record):
...
@@ -108,11 +107,11 @@ def update_structure(em, updating: db.Container, target_structure: db.Record):
A record which may have references to other records. Must be a DAG.
A record which may have references to other records. Must be a DAG.
"""
"""
if
target_structure
.
_
cuid
in
em
.
to_existing
:
if
target_structure
.
cuid
in
em
.
to_existing
:
update_matched_entity
(
em
,
update_matched_entity
(
em
,
updating
,
updating
,
target_structure
,
target_structure
,
em
.
to_existing
[
target_structure
.
_
cuid
])
em
.
to_existing
[
target_structure
.
cuid
])
for
prop
in
target_structure
.
get_properties
():
for
prop
in
target_structure
.
get_properties
():
if
prop
.
is_reference
(
server_retrieval
=
True
):
if
prop
.
is_reference
(
server_retrieval
=
True
):
...
@@ -139,8 +138,8 @@ def update_matched_entity(em, updating, target_record, existing_record):
...
@@ -139,8 +138,8 @@ def update_matched_entity(em, updating, target_record, existing_record):
# check for remaining property types
# check for remaining property types
if
isinstance
(
prop
.
value
,
db
.
Entity
):
if
isinstance
(
prop
.
value
,
db
.
Entity
):
if
prop
.
value
.
_
cuid
in
em
.
to_existing
:
if
prop
.
value
.
cuid
in
em
.
to_existing
:
value
=
em
.
to_existing
[
prop
.
value
.
_
cuid
].
id
value
=
em
.
to_existing
[
prop
.
value
.
cuid
].
id
else
:
else
:
value
=
prop
.
value
.
id
value
=
prop
.
value
.
id
else
:
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