Skip to content

Commit

Permalink
Add more manual fixes, reapply black
Browse files Browse the repository at this point in the history
  • Loading branch information
formatc1702 committed Oct 11, 2021
1 parent 96c3b90 commit c1b1b63
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,8 @@ def __post_init__(self) -> None:
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]
Expand Down
15 changes: 6 additions & 9 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,16 @@ def create_graph(self) -> Graph:
wirehtml.append(
' <table cellspacing="0" cellborder="0" border="0">'
)
for j, bgcolor in enumerate(
bgcolors[::-1]
): # Reverse to match the curved wires when more than 2 colors
for j, bgcolor in enumerate(bgcolors[::-1]):
# Reverse to match the curved wires when more than 2 colors
wirehtml.append(
f' <tr><td colspan="3" cellpadding="0" height="2" bgcolor="{bgcolor if bgcolor != "" else wv_colors.default_color}" border="0"></td></tr>'
)
wirehtml.append(" </table>")
wirehtml.append(" </td>")
wirehtml.append(" </tr>")
if (
cable.category == "bundle"
): # for bundles individual wires can have part information
if cable.category == "bundle":
# for bundles individual wires can have part information
# create a list of wire parameters
wireidentification = []
if isinstance(cable.pn, list):
Expand Down Expand Up @@ -473,9 +471,8 @@ def create_graph(self) -> Graph:

# connections
for connection in cable.connections:
if isinstance(
connection.via_port, int
): # check if it's an actual wire and not a shield
# check if it's an actual wire and not a shield
if isinstance(connection.via_port, int):
dot.attr(
"edge",
color=":".join(
Expand Down
5 changes: 2 additions & 3 deletions src/wireviz/wireviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ def check_designators(what, where): # helper function
else:
sublist.append([item, 1])
connection_list.append(sublist)
elif isinstance(
item, list
): # a list of single-pin components were specified
elif isinstance(item, list):
# a list of single-pin components were specified
sublist = []
for subitem in item:
if yaml_data["connectors"][subitem].get("autogenerate"):
Expand Down
7 changes: 2 additions & 5 deletions src/wireviz/wv_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c1b1b63

Please sign in to comment.