Improve gracefulness when invoking wireviz.parse() without file_out

This happened to be a regression for WireViz-Web [1], which aims to do
as much in memory as possible.

[1] https://github.com/daq-tools/wireviz-web.

kvid rebased and mixed original commit with similar change by Daniel Rojas

Co-authored-by: kvid <kvid@users.noreply.github.com>
This commit is contained in:
Andreas Motl 2021-10-22 22:17:23 +02:00 committed by KV
parent d680361556
commit 49c7685bb2

View File

@ -115,8 +115,9 @@ def parse(
# keep track of auto-generated designators to avoid duplicates # keep track of auto-generated designators to avoid duplicates
autogenerated_designators = {} autogenerated_designators = {}
# When title is not given, either deduce it from filename, or use default text.
if "title" not in harness.metadata: if "title" not in harness.metadata:
harness.metadata["title"] = Path(yaml_file).stem if yaml_file else "" harness.metadata["title"] = Path(yaml_file).stem if yaml_file else "WireViz diagram and BOM"
# add items # add items
# parse YAML input file ==================================================== # parse YAML input file ====================================================