Skip to content

Commit

Permalink
Diagram generator can handle empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
netsatan committed Nov 23, 2022
1 parent 5167940 commit 7f70a0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Empty file.
Empty file.
7 changes: 6 additions & 1 deletion specifipy/parsers/diagram_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,10 @@ def generate_diagram(
joined_links_to_generate = "\t" + "\n\t".join(links_to_generate)

diagram_definition = f'with Diagram("{source_file_name}", show=False, filename="{base_path if base_path else ""}{source_file_name}"):\n'
generated_file = f"{self.header}\n{diagram_definition}\n{joined_elements_to_generate}\n{joined_links_to_generate}"
if len(links_to_generate) == 0:
generated_file = f"{self.header}\n{diagram_definition}\n\tpass"
elif len(elements_to_generate) == 0:
generated_file = f"{self.header}\n{diagram_definition}\n\tpass"
else:
generated_file = f"{self.header}\n{diagram_definition}\n{joined_elements_to_generate}\n{joined_links_to_generate}"
exec(f"{generated_file}")

0 comments on commit 7f70a0f

Please sign in to comment.