From c89cf735aecd31f5deb438788bcf41c1b7e1b231 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Fri, 15 Oct 2021 17:39:33 +0200 Subject: [PATCH] Apply some manual fixes, reapply `black` --- src/wireviz/DataClasses.py | 39 ++++---- src/wireviz/Harness.py | 195 ++++++++++++++----------------------- src/wireviz/wireviz.py | 45 ++++----- src/wireviz/wv_bom.py | 7 +- src/wireviz/wv_cli.py | 3 +- src/wireviz/wv_colors.py | 181 ++++------------------------------ src/wireviz/wv_gv_html.py | 17 ++-- src/wireviz/wv_helper.py | 5 +- src/wireviz/wv_html.py | 9 +- 9 files changed, 147 insertions(+), 354 deletions(-) diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index ad7317f..8907ffe 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -98,13 +98,12 @@ class Image: self.fixedsize = (self.width or self.height) and self.scale is None if self.scale is None: - self.scale = ( - "false" - if not self.width and not self.height - else "both" - if self.width and self.height - else "true" - ) # When only one dimension is specified. + if not self.width and not self.height: + self.scale = "false" + elif self.width and self.height: + self.scale = "both" + else: + self.scale = "true" # When only one dimension is specified. if self.fixedsize: # If only one dimension is specified, compute the other @@ -133,9 +132,8 @@ class AdditionalComponent: @property def description(self) -> str: - return self.type.rstrip() + ( - f", {self.subtype.rstrip()}" if self.subtype else "" - ) + s = self.type.rstrip() + f", {self.subtype.rstrip()}" if self.subtype else "" + return s @dataclass @@ -203,9 +201,8 @@ class Connector: self.show_name = self.style != "simple" and self.name[0:2] != "__" if self.show_pincount is None: - self.show_pincount = ( - self.style != "simple" - ) # hide pincount for simple (1 pin) connectors by default + # hide pincount for simple (1 pin) connectors by default + self.show_pincount = self.style != "simple" for loop in self.loops: # TODO: check that pins to connect actually exist @@ -322,9 +319,8 @@ class Cable: if self.wirecount: # number of wires explicitly defined if self.colors: # use custom color palette (partly or looped if needed) pass - elif ( - self.color_code - ): # use standard color palette (partly or looped if needed) + elif self.color_code: + # use standard color palette (partly or looped if needed) if self.color_code not in COLOR_CODES: raise Exception("Unknown color code") self.colors = COLOR_CODES[self.color_code] @@ -361,14 +357,12 @@ class Cable: raise Exception("lists of part data are only supported for bundles") if self.show_name is None: - self.show_name = ( - self.name[0:2] != "__" - ) # hide designators for auto-generated cables by default + # hide designators for auto-generated cables by default + self.show_name = self.name[0:2] != "__" if not self.show_wirenumbers: - self.show_wirenumbers = ( - self.category != "bundle" - ) # by default, show wire numbers for cables, hide for bundles + # by default, show wire numbers for cables, hide for bundles + self.show_wirenumbers = self.category != "bundle" for i, item in enumerate(self.additional_components): if isinstance(item, dict): @@ -383,6 +377,7 @@ class Cable: to_name: Optional[Designator], to_pin: NoneOrMorePinIndices, ) -> None: + from_pin = int2tuple(from_pin) via_wire = int2tuple(via_wire) to_pin = int2tuple(to_pin) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 3e7903c..0103816 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -130,9 +130,8 @@ class Harness: raise Exception( f"{via_name}:{via_wire} is used for more than one wire." ) - via_wire = ( - cable.colors.index(via_wire) + 1 - ) # list index starts at 0, wire IDs start at 1 + # list index starts at 0, wire IDs start at 1 + via_wire = cable.colors.index(via_wire) + 1 elif via_wire in cable.wirelabels: if cable.wirelabels.count(via_wire) > 1: raise Exception( @@ -180,37 +179,22 @@ class Harness: connector.ports_left = True # Use left side pins. html = [] + # fmt: off + rows = [[f'{html_bgcolor(connector.bgcolor_title)}{remove_links(connector.name)}' + if connector.show_name else None], + [pn_info_string(HEADER_PN, None, remove_links(connector.pn)), + html_line_breaks(pn_info_string(HEADER_MPN, connector.manufacturer, connector.mpn)), + html_line_breaks(pn_info_string(HEADER_SPN, connector.supplier, connector.spn))], + [html_line_breaks(connector.type), + html_line_breaks(connector.subtype), + f'{connector.pincount}-pin' if connector.show_pincount else None, + translate_color(connector.color, self.options.color_mode) if connector.color else None, + html_colorbar(connector.color)], + '' if connector.style != 'simple' else None, + [html_image(connector.image)], + [html_caption(connector.image)]] + # fmt: on - rows = [ - [ - f"{html_bgcolor(connector.bgcolor_title)}{remove_links(connector.name)}" - if connector.show_name - else None - ], - [ - pn_info_string(HEADER_PN, None, remove_links(connector.pn)), - html_line_breaks( - pn_info_string( - HEADER_MPN, connector.manufacturer, connector.mpn - ) - ), - html_line_breaks( - pn_info_string(HEADER_SPN, connector.supplier, connector.spn) - ), - ], - [ - html_line_breaks(connector.type), - html_line_breaks(connector.subtype), - f"{connector.pincount}-pin" if connector.show_pincount else None, - translate_color(connector.color, self.options.color_mode) - if connector.color - else None, - html_colorbar(connector.color), - ], - "" if connector.style != "simple" else None, - [html_image(connector.image)], - [html_caption(connector.image)], - ] rows.extend(get_additional_component_table(self, connector)) rows.append([html_line_breaks(connector.notes)]) html.extend(nested_html_table(rows, html_bgcolor_attr(connector.bgcolor))) @@ -231,6 +215,7 @@ class Harness: and not connector.visible_pins.get(pinname, False) ): continue + pinhtml.append(" ") if connector.ports_left: pinhtml.append(f' {pinname}') @@ -238,16 +223,14 @@ class Harness: pinhtml.append(f" {pinlabel}") if connector.pincolors: if pincolor in wv_colors._color_hex.keys(): - pinhtml.append( - f' {translate_color(pincolor, self.options.color_mode)}' - ) - pinhtml.append(' ') - pinhtml.append(' ') - pinhtml.append( - f' ' - ) - pinhtml.append("
") - pinhtml.append(" ") + # fmt: off + pinhtml.append(f' {translate_color(pincolor, self.options.color_mode)}') + pinhtml.append( ' ') + pinhtml.append( ' ') + pinhtml.append(f' ') + pinhtml.append( '
') + pinhtml.append( ' ') + # fmt: on else: pinhtml.append(' ') @@ -309,61 +292,36 @@ class Harness: elif cable.gauge_unit.upper() == "AWG": awg_fmt = f" ({mm2_equiv(cable.gauge)} mm\u00B2)" - rows = [ - [ - f"{html_bgcolor(cable.bgcolor_title)}{remove_links(cable.name)}" - if cable.show_name - else None - ], - [ - pn_info_string(HEADER_PN, None, remove_links(cable.pn)) - if not isinstance(cable.pn, list) - else None, - html_line_breaks( - pn_info_string( - HEADER_MPN, - cable.manufacturer - if not isinstance(cable.manufacturer, list) - else None, - cable.mpn if not isinstance(cable.mpn, list) else None, - ) - ), - html_line_breaks( - pn_info_string( - HEADER_SPN, - cable.supplier - if not isinstance(cable.supplier, list) - else None, - cable.spn if not isinstance(cable.spn, list) else None, - ) - ), - ], - [ - html_line_breaks(cable.type), - f"{cable.wirecount}x" if cable.show_wirecount else None, - f"{cable.gauge} {cable.gauge_unit}{awg_fmt}" - if cable.gauge - else None, - "+ S" if cable.shield else None, - f"{cable.length} {cable.length_unit}" if cable.length > 0 else None, - translate_color(cable.color, self.options.color_mode) - if cable.color - else None, - html_colorbar(cable.color), - ], - "", - [html_image(cable.image)], - [html_caption(cable.image)], - ] + # fmt: off + rows = [[f'{html_bgcolor(cable.bgcolor_title)}{remove_links(cable.name)}' + if cable.show_name else None], + [pn_info_string(HEADER_PN, None, + remove_links(cable.pn)) if not isinstance(cable.pn, list) else None, + html_line_breaks(pn_info_string(HEADER_MPN, + cable.manufacturer if not isinstance(cable.manufacturer, list) else None, + cable.mpn if not isinstance(cable.mpn, list) else None)), + html_line_breaks(pn_info_string(HEADER_SPN, + cable.supplier if not isinstance(cable.supplier, list) else None, + cable.spn if not isinstance(cable.spn, list) else None))], + [html_line_breaks(cable.type), + f'{cable.wirecount}x' if cable.show_wirecount else None, + f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None, + '+ S' if cable.shield else None, + f'{cable.length} {cable.length_unit}' if cable.length > 0 else None, + translate_color(cable.color, self.options.color_mode) if cable.color else None, + html_colorbar(cable.color)], + '', + [html_image(cable.image)], + [html_caption(cable.image)]] + # fmt: on rows.extend(get_additional_component_table(self, cable)) rows.append([html_line_breaks(cable.notes)]) html.extend(nested_html_table(rows, html_bgcolor_attr(cable.bgcolor))) wirehtml = [] - wirehtml.append( - '' - ) # conductor table + # conductor table + wirehtml.append('
') wirehtml.append(" ") for i, (connection_color, wirelabel) in enumerate( @@ -389,28 +347,20 @@ class Harness: wirehtml.append(f" ") wirehtml.append(" ") - bgcolors = ( - ["#000000"] + get_color_hex(connection_color, pad=pad) + ["#000000"] - ) + # fmt: off + bgcolors = ['#000000'] + get_color_hex(connection_color, pad=pad) + ['#000000'] wirehtml.append(f" ") - wirehtml.append( - f' ") num_rows = num_rows + 1 @@ -43,9 +43,8 @@ def nested_html_table( html.append(" ") num_rows = num_rows + 1 if num_rows == 0: # empty table - html.append( - "" - ) # generate empty cell to avoid GraphViz errors + # generate empty cell to avoid GraphViz errors + html.append("") html.append("
 
' - ) - wirehtml.append( - ' ' - ) - for j, bgcolor in enumerate( - bgcolors[::-1] - ): # Reverse to match the curved wires when more than 2 colors - wirehtml.append( - f' ' - ) + wirehtml.append(f' ") wirehtml.append(" ") - if ( - cable.category == "bundle" - ): # for bundles individual wires can have part information + # fmt: on + + # for bundles, individual wires can have part information + if cable.category == "bundle": # create a list of wire parameters wireidentification = [] if isinstance(cable.pn, list): @@ -439,14 +389,14 @@ class Harness: wireidentification.append(html_line_breaks(supplier_info)) # print parameters into a table row under the wire if len(wireidentification) > 0: + # fmt: off wirehtml.append(' ") + # fmt: on if cable.shield: wirehtml.append(" ") # spacer @@ -464,9 +414,9 @@ class Harness: else: # shield is shown as a thin black wire attributes = f'height="2" bgcolor="#000000" border="0"' - wirehtml.append( - f' ' - ) + # fmt: off + wirehtml.append(f' ') + # fmt: on wirehtml.append(" ") wirehtml.append("
') + wirehtml.append(' ') + for j, bgcolor in enumerate(bgcolors[::-1]): # Reverse to match the curved wires when more than 2 colors + wirehtml.append(f' ') wirehtml.append("
") wirehtml.append("
') - wirehtml.append( - ' ' - ) + wirehtml.append('
') for attrib in wireidentification: wirehtml.append(f" ") wirehtml.append("
{attrib}
") wirehtml.append("
 
 
") @@ -477,9 +427,8 @@ class Harness: # connections for connection in cable.connections: - if isinstance( - connection.via_port, int - ): # check if it's an actual wire and not a shield + if isinstance(connection.via_port, int): + # check if it's an actual wire and not a shield dot.attr( "edge", color=":".join( @@ -734,15 +683,15 @@ class Harness: with open_file_write(f"{filename}.bom.tsv") as file: file.write(tuplelist2tsv(bomlist)) if "csv" in fmt: - print( - "CSV output is not yet supported" - ) # TODO: implement CSV output (preferrably using CSV library) + # TODO: implement CSV output (preferrably using CSV library) + print("CSV output is not yet supported") # HTML output if "html" in fmt: generate_html_output(filename, bomlist, self.metadata, self.options) # PDF output if "pdf" in fmt: - print("PDF output is not yet supported") # TODO: implement PDF output + # TODO: implement PDF output + print("PDF output is not yet supported") # delete SVG if not needed if "html" in fmt and not "svg" in fmt and not svg_already_exists: Path(f"{filename}.svg").unlink() diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 5f11736..032afca 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -86,12 +86,10 @@ def parse( tweak=Tweak(**yaml_data.get("tweak", {})), ) # others - designators_and_templates = ( - {} - ) # store mapping of components to their respective template - autogenerated_designators = ( - {} - ) # keep track of auto-generated designators to avoid duplicates + # store mapping of components to their respective template + designators_and_templates = {} + # keep track of auto-generated designators to avoid duplicates + autogenerated_designators = {} if "title" not in harness.metadata: harness.metadata["title"] = Path(file_out).stem @@ -110,9 +108,8 @@ def parse( image = attribs.get("image") if isinstance(image, dict): image_path = image["src"] - if ( - image_path and not Path(image_path).is_absolute() - ): # resolve relative image path + if image_path and not Path(image_path).is_absolute(): + # resolve relative image path image["src"] = smart_file_resolve( image_path, image_paths ) @@ -187,9 +184,8 @@ def parse( if isinstance(entry, list): connectioncount.append(len(entry)) elif isinstance(entry, dict): - connectioncount.append( - len(expand(list(entry.values())[0])) - ) # - X1: [1-4,6] yields 5 + connectioncount.append(len(expand(list(entry.values())[0]))) + # e.g.: - X1: [1-4,6] yields 5 else: pass # strings do not reveal connectioncount if not any(connectioncount): @@ -258,9 +254,8 @@ def parse( if designator in harness.connectors: # existing connector instance check_type(designator, template, "connector") - elif ( - template in template_connectors.keys() - ): # generate new connector instance from template + elif template in template_connectors.keys(): + # generate new connector instance from template check_type(designator, template, "connector") harness.add_connector( name=designator, **template_connectors[template] @@ -268,9 +263,8 @@ def parse( elif designator in harness.cables: # existing cable instance check_type(designator, template, "cable/arrow") - elif ( - template in template_cables.keys() - ): # generate new cable instance from template + elif template in template_cables.keys(): + # generate new cable instance from template check_type(designator, template, "cable/arrow") harness.add_cable(name=designator, **template_cables[template]) @@ -295,18 +289,16 @@ def parse( designator = list(item.keys())[0] if designator in harness.cables: - if ( - index_item == 0 - ): # list started with a cable, no connector to join on left side + if index_item == 0: + # list started with a cable, no connector to join on left side from_name, from_pin = (None, None) else: from_name, from_pin = get_single_key_and_value( entry[index_item - 1] ) via_name, via_pin = (designator, item[designator]) - if ( - index_item == len(entry) - 1 - ): # list ends with a cable, no connector to join on right side + if index_item == len(entry) - 1: + # list ends with a cable, no connector to join on right side to_name, to_pin = (None, None) else: to_name, to_pin = get_single_key_and_value( @@ -335,9 +327,8 @@ def parse( harness.add_mate_pin( from_name, from_pin, to_name, to_pin, designator ) - elif ( - "=" in designator and index_entry == 0 - ): # mate two connectors as a whole + elif "=" in designator and index_entry == 0: + # mate two connectors as a whole harness.add_mate_component(from_name, to_name, designator) # harness population completed ============================================= diff --git a/src/wireviz/wv_bom.py b/src/wireviz/wv_bom.py index 29b49ef..6689d79 100644 --- a/src/wireviz/wv_bom.py +++ b/src/wireviz/wv_bom.py @@ -214,11 +214,8 @@ def get_bom_index(bom: List[BOMEntry], target: BOMKey) -> int: def bom_list(bom: List[BOMEntry]) -> List[List[str]]: """Return list of BOM rows as lists of column strings with headings in top row.""" keys = list(BOM_COLUMNS_ALWAYS) # Always include this fixed set of BOM columns. - for ( - fieldname - ) in ( - BOM_COLUMNS_OPTIONAL - ): # Include only those optional BOM columns that are in use. + for fieldname in BOM_COLUMNS_OPTIONAL: + # Include only those optional BOM columns that are in use. if any(entry.get(fieldname) for entry in bom): keys.append(fieldname) # Custom mapping from internal name to BOM column headers. diff --git a/src/wireviz/wv_cli.py b/src/wireviz/wv_cli.py index b3f3daf..65a20a6 100644 --- a/src/wireviz/wv_cli.py +++ b/src/wireviz/wv_cli.py @@ -23,7 +23,8 @@ format_codes = { "t": "tsv", } -epilog = "The -f or --format option accepts a string containing one or more of the following characters to specify which file types to output:\n" +epilog = "The -f or --format option accepts a string containing one or more of the " +epilog += "following characters to specify which file types to output:\n" epilog += ", ".join([f"{key} ({value.upper()})" for key, value in format_codes.items()]) diff --git a/src/wireviz/wv_colors.py b/src/wireviz/wv_colors.py index 7e9a6b4..857f307 100644 --- a/src/wireviz/wv_colors.py +++ b/src/wireviz/wv_colors.py @@ -3,177 +3,38 @@ from typing import Dict, List COLOR_CODES = { + # fmt: off "DIN": [ - "WH", - "BN", - "GN", - "YE", - "GY", - "PK", - "BU", - "RD", - "BK", - "VT", - "GYPK", - "RDBU", - "WHGN", - "BNGN", - "WHYE", - "YEBN", - "WHGY", - "GYBN", - "WHPK", - "PKBN", - "WHBU", - "BNBU", - "WHRD", - "BNRD", - "WHBK", - "BNBK", - "GYGN", - "YEGY", - "PKGN", - "YEPK", - "GNBU", - "YEBU", - "GNRD", - "YERD", - "GNBK", - "YEBK", - "GYBU", - "PKBU", - "GYRD", - "PKRD", - "GYBK", - "PKBK", - "BUBK", - "RDBK", - "WHBNBK", - "YEGNBK", - "GYPKBK", - "RDBUBK", - "WHGNBK", - "BNGNBK", - "WHYEBK", - "YEBNBK", - "WHGYBK", - "GYBNBK", - "WHPKBK", - "PKBNBK", - "WHBUBK", - "BNBUBK", - "WHRDBK", - "BNRDBK", + "WH", "BN", "GN", "YE", "GY", "PK", "BU", "RD", "BK", "VT", "GYPK", "RDBU", + "WHGN", "BNGN", "WHYE", "YEBN", "WHGY", "GYBN", "WHPK", "PKBN", "WHBU", "BNBU", + "WHRD", "BNRD", "WHBK", "BNBK", "GYGN", "YEGY", "PKGN", "YEPK", "GNBU", "YEBU", + "GNRD", "YERD", "GNBK", "YEBK", "GYBU", "PKBU", "GYRD", "PKRD", "GYBK", "PKBK", + "BUBK", "RDBK", "WHBNBK", "YEGNBK", "GYPKBK", "RDBUBK", "WHGNBK", "BNGNBK", + "WHYEBK", "YEBNBK", "WHGYBK", "GYBNBK", "WHPKBK", "PKBNBK", "WHBUBK", + "BNBUBK", "WHRDBK", "BNRDBK", ], + # fmt: on "IEC": ["BN", "RD", "OG", "YE", "GN", "BU", "VT", "GY", "WH", "BK"], "BW": ["BK", "WH"], # 25-pair color code - see also https://en.wikipedia.org/wiki/25-pair_color_code # 5 major colors (WH,RD,BK,YE,VT) combined with 5 minor colors (BU,OG,GN,BN,SL). # Each POTS pair tip (+) had major/minor color, and ring (-) had minor/major color. + # fmt: off "TEL": [ # 25x2: Ring and then tip of each pair - "BUWH", - "WHBU", - "OGWH", - "WHOG", - "GNWH", - "WHGN", - "BNWH", - "WHBN", - "SLWH", - "WHSL", - "BURD", - "RDBU", - "OGRD", - "RDOG", - "GNRD", - "RDGN", - "BNRD", - "RDBN", - "SLRD", - "RDSL", - "BUBK", - "BKBU", - "OGBK", - "BKOG", - "GNBK", - "BKGN", - "BNBK", - "BKBN", - "SLBK", - "BKSL", - "BUYE", - "YEBU", - "OGYE", - "YEOG", - "GNYE", - "YEGN", - "BNYE", - "YEBN", - "SLYE", - "YESL", - "BUVT", - "VTBU", - "OGVT", - "VTOG", - "GNVT", - "VTGN", - "BNVT", - "VTBN", - "SLVT", - "VTSL", + "BUWH", "WHBU", "OGWH", "WHOG", "GNWH", "WHGN", "BNWH", "WHBN", "SLWH", "WHSL", + "BURD", "RDBU", "OGRD", "RDOG", "GNRD", "RDGN", "BNRD", "RDBN", "SLRD", "RDSL", + "BUBK", "BKBU", "OGBK", "BKOG", "GNBK", "BKGN", "BNBK", "BKBN", "SLBK", "BKSL", + "BUYE", "YEBU", "OGYE", "YEOG", "GNYE", "YEGN", "BNYE", "YEBN", "SLYE", "YESL", + "BUVT", "VTBU", "OGVT", "VTOG", "GNVT", "VTGN", "BNVT", "VTBN", "SLVT", "VTSL", ], "TELALT": [ # 25x2: Tip and then ring of each pair - "WHBU", - "BU", - "WHOG", - "OG", - "WHGN", - "GN", - "WHBN", - "BN", - "WHSL", - "SL", - "RDBU", - "BURD", - "RDOG", - "OGRD", - "RDGN", - "GNRD", - "RDBN", - "BNRD", - "RDSL", - "SLRD", - "BKBU", - "BUBK", - "BKOG", - "OGBK", - "BKGN", - "GNBK", - "BKBN", - "BNBK", - "BKSL", - "SLBK", - "YEBU", - "BUYE", - "YEOG", - "OGYE", - "YEGN", - "GNYE", - "YEBN", - "BNYE", - "YESL", - "SLYE", - "VTBU", - "BUVT", - "VTOG", - "OGVT", - "VTGN", - "GNVT", - "VTBN", - "BNVT", - "VTSL", - "SLVT", + "WHBU", "BU", "WHOG", "OG", "WHGN", "GN", "WHBN", "BN", "WHSL", "SL", + "RDBU", "BURD", "RDOG", "OGRD", "RDGN", "GNRD", "RDBN", "BNRD", "RDSL", "SLRD", + "BKBU", "BUBK", "BKOG", "OGBK", "BKGN", "GNBK", "BKBN", "BNBK", "BKSL", "SLBK", + "YEBU", "BUYE", "YEOG", "OGYE", "YEGN", "GNYE", "YEBN", "BNYE", "YESL", "SLYE", + "VTBU", "BUVT", "VTOG", "OGVT", "VTGN", "GNVT", "VTBN", "BNVT", "VTSL", "SLVT", ], + # fmt: on "T568A": ["WHGN", "GN", "WHOG", "BU", "WHBU", "OG", "WHBN", "BN"], "T568B": ["WHOG", "OG", "WHGN", "BU", "WHBU", "GN", "WHBN", "BN"], } diff --git a/src/wireviz/wv_gv_html.py b/src/wireviz/wv_gv_html.py index ea52c10..ec80aa7 100644 --- a/src/wireviz/wv_gv_html.py +++ b/src/wireviz/wv_gv_html.py @@ -25,15 +25,15 @@ def nested_html_table( if isinstance(row, List): if len(row) > 0 and any(row): html.append("
") - html.append( - ' ' - ) + # fmt: off + html.append('
') + # fmt: on for cell in row: if cell is not None: # Inject attributes to the preceeding '.replace(">{cell}'.replace(">
tag where needed - html.append( - f' {cell}
") html.append("
") return html diff --git a/src/wireviz/wv_helper.py b/src/wireviz/wv_helper.py index 7cbe125..a10f6ac 100644 --- a/src/wireviz/wv_helper.py +++ b/src/wireviz/wv_helper.py @@ -58,9 +58,8 @@ def expand(yaml_data): else: # a == b output.append(a) # range of length 1 except: - output.append( - e - ) # '-' was not a delimiter between two ints, pass e through unchanged + # '-' was not a delimiter between two ints, pass e through unchanged + output.append(e) else: try: x = int(e) # single int diff --git a/src/wireviz/wv_html.py b/src/wireviz/wv_html.py index 6389503..6b85ef7 100644 --- a/src/wireviz/wv_html.py +++ b/src/wireviz/wv_html.py @@ -104,14 +104,15 @@ def generate_html_output( replacements['"sheetsize_default"'] = '"{}"'.format( metadata.get("template", {}).get("sheetsize", "") - ) # include quotes so no replacement happens within