diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index bcc3d28..32e16e3 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 @@ -27,7 +29,8 @@ class Harness: 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 + # check from and to connectors + for (name, pin) in zip([from_name, to_name], [from_pin, to_pin]): if name is not None and name in self.connectors: connector = self.connectors[name] if pin in connector.pinnumbers and pin in connector.pinout: @@ -278,7 +281,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 465b389..e99f97f 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -15,13 +15,12 @@ if __name__ == '__main__': from wireviz.Harness import Harness -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 @@ -194,7 +193,7 @@ def parse(yaml_input, file_out=None, generate_bom=False, return_types: (None, st raise Exception('Wrong number of connection parameters') 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 = [] @@ -211,7 +210,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() @@ -220,7 +219,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(): @@ -261,7 +260,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__':