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: Andreas Motl <andreas.motl@panodata.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
This commit is contained in:
Daniel Rojas 2025-03-01 17:25:31 +01:00
parent 7077543600
commit 9d1700c4a0

View File

@ -116,8 +116,11 @@ def parse(
# keep track of auto-generated designators to avoid duplicates
autogenerated_designators = {}
# When title is not given, either deduce it from filename, or use default text.
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
# parse YAML input file ====================================================