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

STY: fixed style

parent 5f2ca1dc
No related branches found
No related tags found
2 merge requests!57RELEASE 0.7.3,!47Refactored the plantuml module
Pipeline #20462 passed
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment