Skip to content

Commit 018e3de

Browse files
kvidamotl
authored andcommitted
Update src/wireviz/wireviz.py (#383)
Raising TypeError is better than assert. (Black reformatted) Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
1 parent 07555f2 commit 018e3de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/wireviz/wireviz.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ def parse(
8888
raise Exception("No output formats or return types specified")
8989

9090
yaml_data, yaml_file = _get_yaml_data_and_path(inp)
91-
assert isinstance(
92-
yaml_data, dict
93-
), f"Expected a dict as top-level YAML input, but got: {type(yaml_data)}"
91+
if not isinstance(yaml_data, dict):
92+
raise TypeError(
93+
f"Expected a dict as top-level YAML input, but got: {type(yaml_data)}"
94+
)
9495
if output_formats:
9596
# need to write data to file, determine output directory and filename
9697
output_dir = _get_output_dir(yaml_file, output_dir)

0 commit comments

Comments
 (0)