From 0b173700fa6e8d1da587440e494e0dbb07b46d7d Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 27 Mar 2023 17:56:15 +0200 Subject: [PATCH] Apply black --- src/wireviz/wireviz.py | 1 - src/wireviz/wv_dataclasses.py | 6 +----- src/wireviz/wv_graphviz.py | 12 +++++++++--- src/wireviz/wv_harness.py | 8 ++++++-- src/wireviz/wv_output.py | 1 - 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 18022ee..dce05ad 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -207,7 +207,6 @@ def parse( expected_type = alternating_types[1 - alternating_types.index(expected_type)] for connection_set in connection_sets: - # figure out number of parallel connections within this set connectioncount = [] for entry in connection_set: diff --git a/src/wireviz/wv_dataclasses.py b/src/wireviz/wv_dataclasses.py index b0c4ed1..3e08375 100644 --- a/src/wireviz/wv_dataclasses.py +++ b/src/wireviz/wv_dataclasses.py @@ -86,7 +86,6 @@ class Options: _image_paths: List = field(default_factory=list) def __post_init__(self): - self.bgcolor = SingleColor(self.bgcolor) self.bgcolor_node = SingleColor(self.bgcolor_node) self.bgcolor_connector = SingleColor(self.bgcolor_connector) @@ -124,7 +123,6 @@ class Image: # See also HTML doc at https://graphviz.org/doc/info/shapes.html#html def __post_init__(self): - self.bgcolor = SingleColor(self.bgcolor) if self.fixedsize is None: @@ -258,7 +256,7 @@ class Component: else: return self.amount - @property + @property def has_pn_info(self) -> bool: return any([self.pn, self.manufacturer, self.mpn, self.supplier, self.spn]) @@ -368,7 +366,6 @@ class Connector(TopLevelGraphicalComponent): return None # connectors do not support units. def __post_init__(self) -> None: - super().fill_partnumbers() self.bgcolor = SingleColor(self.bgcolor) @@ -654,7 +651,6 @@ class Cable(TopLevelGraphicalComponent): return None # non-bundles do not support lists of part data def __post_init__(self) -> None: - super().fill_partnumbers() self.bgcolor = SingleColor(self.bgcolor) diff --git a/src/wireviz/wv_graphviz.py b/src/wireviz/wv_graphviz.py index b01b40e..e1c5d03 100644 --- a/src/wireviz/wv_graphviz.py +++ b/src/wireviz/wv_graphviz.py @@ -230,8 +230,15 @@ def nested_table(lines: List[Td]) -> Table: def nested_table_dict(d: dict) -> Table: rows = [] for k, v in d.items(): - rows.append(Tr([Td(k, align="left", balign="left", valign="top"), Td(html_line_breaks(v), align="left", balign="left")])) - return Table(rows, border=0, cellborder=1, cellpadding=3, cellspacing=0) + rows.append( + Tr( + [ + Td(k, align="left", balign="left", valign="top"), + Td(html_line_breaks(v), align="left", balign="left"), + ] + ) + ) + return Table(rows, border=0, cellborder=1, cellpadding=3, cellspacing=0) def gv_pin_table(component) -> Table: @@ -282,7 +289,6 @@ def gv_conductor_table(cable) -> Table: inserted_break_inbetween = False for wire in cable.wire_objects.values(): - # insert blank space between wires and shields if isinstance(wire, ShieldClass) and not inserted_break_inbetween: rows.append(Tr(Td(" "))) # spacer row between wires and shields diff --git a/src/wireviz/wv_harness.py b/src/wireviz/wv_harness.py index 249bfa9..bda2891 100644 --- a/src/wireviz/wv_harness.py +++ b/src/wireviz/wv_harness.py @@ -35,7 +35,11 @@ from wireviz.wv_graphviz import ( parse_arrow_str, set_dot_basics, ) -from wireviz.wv_output import embed_svg_images, embed_svg_images_file, generate_html_output +from wireviz.wv_output import ( + embed_svg_images, + embed_svg_images_file, + generate_html_output, +) from wireviz.wv_utils import bom2tsv, open_file_write @@ -217,7 +221,7 @@ class Harness: to_pin: Union[int, str], ) -> None: # check from and to connectors - for (name, pin) in zip([from_name, to_name], [from_pin, to_pin]): + 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] # check if provided name is ambiguous diff --git a/src/wireviz/wv_output.py b/src/wireviz/wv_output.py index 2f1cf33..d5f686b 100644 --- a/src/wireviz/wv_output.py +++ b/src/wireviz/wv_output.py @@ -68,7 +68,6 @@ def generate_html_output( metadata: Metadata, options: Options, ): - # load HTML template templatename = metadata.get("template", {}).get("name") if templatename: