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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
1edbf1f8
Verified
Commit
1edbf1f8
authored
3 years ago
by
Alexander Kreft
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Fix bug in retrieve_substructure
parent
2bb76a0e
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!33
MAINT: change arguments of create_user
,
!16
F retrieve substructure
Pipeline
#14053
passed with warnings
3 years ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosdb/utils/plantuml.py
+8
-8
8 additions, 8 deletions
src/caosdb/utils/plantuml.py
with
8 additions
and
8 deletions
src/caosdb/utils/plantuml.py
+
8
−
8
View file @
1edbf1f8
...
...
@@ -223,6 +223,7 @@ package \"The property P references an instance of D\" <<Rectangle>> {
return
result
def
retrieve_substructure
(
start_record_types
,
depth
,
result_id_set
=
None
,
result_container
=
None
,
cleanup
=
True
):
"""
Recursively retrieves CaosDB record types and properties, starting
from given initial types up to a specific depth.
...
...
@@ -262,11 +263,11 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
if
is_reference
(
prop
.
datatype
)
and
prop
.
datatype
!=
db
.
FILE
and
depth
>
0
:
rt
=
db
.
RecordType
(
name
=
get_referenced_recordtype
(
prop
.
datatype
)).
retrieve
()
retrieve_substructure
([
rt
],
depth
-
1
,
result_id_set
,
result_container
,
False
)
else
:
if
prop
.
id
not
in
result_id_set
:
result_container
.
append
(
prop
)
if
prop
.
id
not
in
result_id_set
:
result_container
.
append
(
prop
)
result_id_set
.
add
(
prop
.
id
)
for
parent
in
entity
.
parents
:
rt
=
db
.
RecordType
(
id
=
parent
.
id
).
retrieve
()
if
parent
.
id
not
in
result_id_set
:
...
...
@@ -278,14 +279,14 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
if
cleanup
:
return
result_container
return
None
def
to_graphics
(
recordtypes
,
filename
):
"""
Calls recordtypes_to_plantuml_string(), saves result to file and
creates an svg image
plantuml needs to be installed.
Parameters
----------
recordtypes : Iterable[db.Entity]
...
...
@@ -296,7 +297,6 @@ def to_graphics(recordtypes, filename):
"""
pu
=
recordtypes_to_plantuml_string
(
recordtypes
)
pu_filename
=
filename
+
"
.pu
"
with
open
(
pu_filename
,
"
w
"
)
as
pu_file
:
pu_file
.
write
(
pu
)
...
...
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