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
3477d908
Commit
3477d908
authored
3 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
DOC: improved docstrings for some functions
parent
d6ceb195
No related branches found
No related tags found
2 merge requests
!33
MAINT: change arguments of create_user
,
!16
F retrieve substructure
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosdb/utils/plantuml.py
+28
-12
28 additions, 12 deletions
src/caosdb/utils/plantuml.py
with
28 additions
and
12 deletions
src/caosdb/utils/plantuml.py
+
28
−
12
View file @
3477d908
...
@@ -42,6 +42,18 @@ REFERENCE = "REFERENCE"
...
@@ -42,6 +42,18 @@ REFERENCE = "REFERENCE"
def
get_description
(
description_str
):
def
get_description
(
description_str
):
"""
Extract and format a description string from a record type or property.
Parameters
----------
description_str : str
The description string that is going to be formatted.
Returns
-------
str
The reformatted description ending in a line break.
"""
words
=
description_str
.
split
()
words
=
description_str
.
split
()
lines
=
[]
lines
=
[]
lines
.
append
(
""
)
lines
.
append
(
""
)
...
@@ -211,18 +223,6 @@ package \"The property P references an instance of D\" <<Rectangle>> {
...
@@ -211,18 +223,6 @@ package \"The property P references an instance of D\" <<Rectangle>> {
return
result
return
result
def
to_graphics
(
recordtypes
,
filename
):
"""
calls recordtypes_to_plantuml_string(), saves result to file and
creates an svg image
plantuml needs to be installed
@params:
recordtypes: itrable with the record types to be displayed
filname: filename of the image (e.g. data_structure; data_structure.pu and
data_structure.svg will be created.
"""
pu
=
recordtypes_to_plantuml_string
(
recordtypes
)
def
retrieve_substructure
(
start_record_types
,
depth
,
result_id_set
=
None
,
result_container
=
None
,
cleanup
=
True
):
def
retrieve_substructure
(
start_record_types
,
depth
,
result_id_set
=
None
,
result_container
=
None
,
cleanup
=
True
):
"""
Recursively retrieves CaosDB record types and properties, starting
"""
Recursively retrieves CaosDB record types and properties, starting
from given initial types up to a specific depth.
from given initial types up to a specific depth.
...
@@ -280,6 +280,22 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
...
@@ -280,6 +280,22 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
return
None
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]
Iterable with the entities to be displayed.
filename : str
filename of the image without the extension(e.g. data_structure;
data_structure.pu and data_structure.svg will be created.)
"""
pu
=
recordtypes_to_plantuml_string
(
recordtypes
)
pu_filename
=
filename
+
"
.pu
"
pu_filename
=
filename
+
"
.pu
"
with
open
(
pu_filename
,
"
w
"
)
as
pu_file
:
with
open
(
pu_filename
,
"
w
"
)
as
pu_file
:
...
...
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