Skip to content
Snippets Groups Projects
Commit 3477d908 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

DOC: improved docstrings for some functions

parent d6ceb195
No related branches found
No related tags found
2 merge requests!33MAINT: change arguments of create_user,!16F retrieve substructure
...@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment