diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index a5e5d6e..5b50bb4 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -4,7 +4,9 @@ from wireviz.DataClasses import Connector, Cable from graphviz import Graph from wireviz import wv_colors -from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, nested_html_table, flatten2d, index_if_list, html_line_breaks, graphviz_line_breaks, remove_line_breaks +from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, \ + nested_html_table, flatten2d, index_if_list, html_line_breaks, \ + graphviz_line_breaks, remove_line_breaks from collections import Counter from typing import List @@ -23,8 +25,7 @@ class Harness: self.cables[name] = Cable(name, *args, **kwargs) def connect(self, from_name, from_pin, via_name, via_pin, to_name, to_pin): - - for (name, pin) in zip([from_name, to_name], [from_pin, to_pin]): # check from and to connectors + for (name, pin) in zip([from_name, to_name], [from_pin, to_pin]): # check from and to connectors if name is not None and name in self.connectors: connector = self.connectors[name] if pin in connector.pinnumbers and pin in connector.pinout: @@ -274,7 +275,7 @@ class Harness: data.seek(0) return data.read() - def output(self, filename, directory='_output', view=False, cleanup=True, fmt='pdf', gen_bom=False): + def output(self, filename, directory='_output', view=False, cleanup=True, fmt=('pdf', )): # graphical output graph = self.create_graph() for f in fmt: diff --git a/src/wireviz/build_examples.py b/src/wireviz/build_examples.py index 18654ef..e622941 100755 --- a/src/wireviz/build_examples.py +++ b/src/wireviz/build_examples.py @@ -16,7 +16,7 @@ if demos: for i in range(1,demos+1): fn = '../../examples/demo{:02d}.yml'.format(i) print(fn) - wireviz.parse_file(fn, generate_bom=True) + wireviz.parse_file(fn) if examples: with open(os.path.abspath('../../examples/readme.md'), 'w') as file: @@ -24,7 +24,7 @@ if examples: for i in range(1,examples+1): fn = '../../examples/ex{:02d}.yml'.format(i) print(fn) - wireviz.parse_file(fn, generate_bom=True) + wireviz.parse_file(fn) file.write('## Example {:02d}\n'.format(i)) file.write('![](ex{:02d}.png)\n\n'.format(i)) @@ -36,7 +36,7 @@ if tutorials: for i in range(1,tutorials+1): fn = '../../tutorial/tutorial{:02d}.yml'.format(i) print(fn) - wireviz.parse_file(fn, generate_bom=True) + wireviz.parse_file(fn) with open(os.path.abspath('../../tutorial/tutorial{:02d}.md'.format(i)), 'r') as info: for line in info: diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 672dbdd..dfdf887 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -16,13 +16,12 @@ from wireviz.Harness import Harness from wireviz.wv_helper import expand -def parse(yaml_input, file_out=None, generate_bom=False, return_types: (None, str, Tuple[str]) = None): +def parse(yaml_input, file_out=None, return_types: (None, str, Tuple[str]) = None): """ Parses yaml input string and does the high-level harness conversion :param yaml_input: a string containing the yaml input data :param file_out: - :param generate_bom: :param return_types: if None, then returns None; if the value is a string, then a corresponding data format will be returned; if the value is a tuple of strings, then for every valid format in the `return_types` tuple, another return type @@ -171,7 +170,7 @@ def parse(yaml_input, file_out=None, generate_bom=False, return_types: (None, st harness.connect(from_name, from_pin, via_name, via_pin, to_name, to_pin) if file_out is not None: - harness.output(filename=file_out, fmt=('png', 'svg'), gen_bom=generate_bom, view=False) + harness.output(filename=file_out, fmt=('png', 'svg'), view=False) if return_types is not None: returns = [] @@ -188,7 +187,7 @@ def parse(yaml_input, file_out=None, generate_bom=False, return_types: (None, st return tuple(returns) if len(returns) != 1 else returns[0] -def parse_file(yaml_file, file_out=None, generate_bom=False): +def parse_file(yaml_file, file_out=None): with open(yaml_file, 'r') as file: yaml_input = file.read() @@ -197,7 +196,7 @@ def parse_file(yaml_file, file_out=None, generate_bom=False): file_out = fn file_out = os.path.abspath(file_out) - parse(yaml_input, file_out=file_out, generate_bom=generate_bom) + parse(yaml_input, file_out=file_out) def parse_cmdline(): @@ -238,7 +237,7 @@ def main(): file_out = args.output_file file_out = os.path.abspath(file_out) - parse(yaml_input, file_out=file_out, generate_bom=args.generate_bom) + parse(yaml_input, file_out=file_out) if __name__ == '__main__':