From 4a7c43a92161b7d83b6836d9663dc694efe9fa7c Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander@mail-schlemmer.de> Date: Thu, 17 Mar 2022 12:34:59 +0100 Subject: [PATCH] STY: fixed style --- src/caosdb/utils/plantuml.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/caosdb/utils/plantuml.py b/src/caosdb/utils/plantuml.py index 2cc1bb53..0c7936a9 100644 --- a/src/caosdb/utils/plantuml.py +++ b/src/caosdb/utils/plantuml.py @@ -168,8 +168,6 @@ hide circle\n else: raise ValueError("Unknown style.") - - if add_properties: result += "package Properties #DDDDDD {\n" for p in properties: @@ -293,7 +291,7 @@ 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) - + # TODO: clean up this hack # TODO: make it also work for files if is_reference(prop.datatype) and prop.value is not None: @@ -358,13 +356,13 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, if output_dirname is None: output_dirname = os.getcwd() - + allowed_formats = [ "tpng", "tsvg", "teps", "tpdf", "tvdx", "txmi", "tscxml", "thtml", "ttxt", "tutxt", "tlatex", "tlatex:nopreamble"] with tempfile.TemporaryDirectory() as td: - + pu_filename = os.path.join(td, filename + ".pu") with open(pu_filename, "w") as pu_file: pu_file.write(pu) @@ -373,7 +371,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, extension = format[1:] if ":" in extension: extension = extension[:extension.index(":")] - + if format not in allowed_formats: raise RuntimeError("Format not allowed.") cmd = "plantuml -{} {}".format(format, pu_filename) @@ -381,6 +379,8 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, print("Executing:", cmd) if os.system(cmd) != 0: # TODO: replace with subprocess.run - raise Exception("An error occured during the execution of plantuml. " + raise Exception("An error occured during the execution of " + "plantuml. " "Is plantuml installed?") - shutil.copy(os.path.join(td, filename + "." + extension), output_dirname) + shutil.copy(os.path.join(td, filename + "." + extension), + output_dirname) -- GitLab