Apply black *.py ../../setup.py

black==23.3.0
This commit is contained in:
KV 2024-07-12 18:58:28 +02:00
parent 828de3f118
commit 73f56b2efc
4 changed files with 5 additions and 11 deletions

View File

@ -91,7 +91,6 @@ class Image:
# See also HTML doc at https://graphviz.org/doc/info/shapes.html#html # See also HTML doc at https://graphviz.org/doc/info/shapes.html#html
def __post_init__(self): def __post_init__(self):
if self.fixedsize is None: if self.fixedsize is None:
# Default True if any dimension specified unless self.scale also is specified. # Default True if any dimension specified unless self.scale also is specified.
self.fixedsize = (self.width or self.height) and self.scale is None self.fixedsize = (self.width or self.height) and self.scale is None
@ -166,7 +165,6 @@ class Connector:
additional_components: List[AdditionalComponent] = field(default_factory=list) additional_components: List[AdditionalComponent] = field(default_factory=list)
def __post_init__(self) -> None: def __post_init__(self) -> None:
if isinstance(self.image, dict): if isinstance(self.image, dict):
self.image = Image(**self.image) self.image = Image(**self.image)
@ -276,7 +274,6 @@ class Cable:
additional_components: List[AdditionalComponent] = field(default_factory=list) additional_components: List[AdditionalComponent] = field(default_factory=list)
def __post_init__(self) -> None: def __post_init__(self) -> None:
if isinstance(self.image, dict): if isinstance(self.image, dict):
self.image = Image(**self.image) self.image = Image(**self.image)
@ -386,7 +383,6 @@ class Cable:
to_name: Optional[Designator], to_name: Optional[Designator],
to_pin: NoneOrMorePinIndices, to_pin: NoneOrMorePinIndices,
) -> None: ) -> None:
from_pin = int2tuple(from_pin) from_pin = int2tuple(from_pin)
via_wire = int2tuple(via_wire) via_wire = int2tuple(via_wire)
to_pin = int2tuple(to_pin) to_pin = int2tuple(to_pin)

View File

@ -57,12 +57,14 @@ OLD_CONNECTOR_ATTR = {
"autogenerate": "is replaced with new syntax in v0.4", "autogenerate": "is replaced with new syntax in v0.4",
} }
def check_old(node: str, old_attr: dict, args: dict) -> None: def check_old(node: str, old_attr: dict, args: dict) -> None:
"""Raise exception for any outdated attributes in args.""" """Raise exception for any outdated attributes in args."""
for attr, descr in old_attr.items(): for attr, descr in old_attr.items():
if attr in args: if attr in args:
raise ValueError(f"'{attr}' in {node}: '{attr}' {descr}") raise ValueError(f"'{attr}' in {node}: '{attr}' {descr}")
@dataclass @dataclass
class Harness: class Harness:
metadata: Metadata metadata: Metadata
@ -184,7 +186,6 @@ class Harness:
dot.attr("edge", style="bold", fontname=self.options.fontname) dot.attr("edge", style="bold", fontname=self.options.fontname)
for connector in self.connectors.values(): for connector in self.connectors.values():
# If no wires connected (except maybe loop wires)? # If no wires connected (except maybe loop wires)?
if not (connector.ports_left or connector.ports_right): if not (connector.ports_left or connector.ports_right):
connector.ports_left = True # Use left side pins. connector.ports_left = True # Use left side pins.
@ -294,7 +295,6 @@ class Harness:
) )
for cable in self.cables.values(): for cable in self.cables.values():
html = [] html = []
awg_fmt = "" awg_fmt = ""

View File

@ -209,7 +209,6 @@ def parse(
expected_type = alternating_types[1 - alternating_types.index(expected_type)] expected_type = alternating_types[1 - alternating_types.index(expected_type)]
for connection_set in connection_sets: for connection_set in connection_sets:
# figure out number of parallel connections within this set # figure out number of parallel connections within this set
connectioncount = [] connectioncount = []
for entry in connection_set: for entry in connection_set:

View File

@ -22,7 +22,6 @@ def generate_html_output(
metadata: Metadata, metadata: Metadata,
options: Options, options: Options,
): ):
# load HTML template # load HTML template
templatename = metadata.get("template", {}).get("name") templatename = metadata.get("template", {}).get("name")
if templatename: if templatename:
@ -112,9 +111,9 @@ def generate_html_output(
if isinstance(entry, Dict): if isinstance(entry, Dict):
replacements[f"<!-- %{item}_{index+1}% -->"] = str(category) replacements[f"<!-- %{item}_{index+1}% -->"] = str(category)
for entry_key, entry_value in entry.items(): for entry_key, entry_value in entry.items():
replacements[f"<!-- %{item}_{index+1}_{entry_key}% -->"] = ( replacements[
html_line_breaks(str(entry_value)) f"<!-- %{item}_{index+1}_{entry_key}% -->"
) ] = html_line_breaks(str(entry_value))
elif isinstance(entry, (str, int, float)): elif isinstance(entry, (str, int, float)):
pass # TODO?: replacements[f"<!-- %{item}_{category}% -->"] = html_line_breaks(str(entry)) pass # TODO?: replacements[f"<!-- %{item}_{category}% -->"] = html_line_breaks(str(entry))