Skip to content

Commit

Permalink
style: Ran black/isort on skidl and test files.
Browse files Browse the repository at this point in the history
  • Loading branch information
devbisme committed Dec 20, 2022
1 parent fa25b25 commit b2f80f0
Show file tree
Hide file tree
Showing 35 changed files with 412 additions and 202 deletions.
39 changes: 35 additions & 4 deletions skidl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from .alias import Alias
from .bus import Bus
from .circuit import Circuit, HIER_SEP
from .circuit import HIER_SEP, Circuit
from .group import Group, SubCircuit, subcircuit
from .interface import Interface
from .logger import erc_logger
Expand All @@ -37,11 +37,42 @@
from .netlist_to_skidl import netlist_to_skidl
from .network import Network, tee
from .package import Package, package
from .part import Part, PartTmplt, SkidlPart, NETLIST, LIBRARY, TEMPLATE
from .part_query import search, show, search_parts_iter, search_parts, show_part, search_footprints_iter, search_footprints, show_footprint
from .part import LIBRARY, NETLIST, TEMPLATE, Part, PartTmplt, SkidlPart
from .part_query import (
search,
search_footprints,
search_footprints_iter,
search_parts,
search_parts_iter,
show,
show_footprint,
show_part,
)
from .pin import Pin
from .schlib import SchLib
from .skidl import lib_search_paths, footprint_search_paths, set_default_tool, get_default_tool, set_query_backup_lib, get_query_backup_lib, set_backup_lib, get_backup_lib, load_backup_lib, ERC, erc_assert, generate_netlist, generate_pcb, generate_xml, generate_schematic, generate_svg, generate_graph, reset, backup_parts, POWER, no_files
from .skidl import (
ERC,
POWER,
backup_parts,
erc_assert,
footprint_search_paths,
generate_graph,
generate_netlist,
generate_pcb,
generate_schematic,
generate_svg,
generate_xml,
get_backup_lib,
get_default_tool,
get_query_backup_lib,
lib_search_paths,
load_backup_lib,
no_files,
reset,
set_backup_lib,
set_default_tool,
set_query_backup_lib,
)
from .tools import KICAD, SKIDL, SPICE, node

standard_library.install_aliases()
10 changes: 5 additions & 5 deletions skidl/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
)

import builtins
from builtins import range, str, super
import re
from builtins import range, str, super

from future import standard_library

Expand All @@ -26,14 +26,14 @@
from .pin import Pin
from .skidlbaseobj import SkidlBaseObject
from .utilities import (
get_unique_name,
flatten,
expand_indices,
filter_list,
find_num_copies,
flatten,
from_iadd,
rmv_iadd,
filter_list,
get_unique_name,
list_or_scalar,
rmv_iadd,
)

# Prefix for implicit buses.
Expand Down
22 changes: 14 additions & 8 deletions skidl/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@
from .pckg_info import __version__
from .pin import Pin
from .schlib import SchLib
from .scriptinfo import get_skidl_trace, get_script_name
from .scriptinfo import get_script_name, get_skidl_trace
from .skidlbaseobj import SkidlBaseObject
from .utilities import reset_get_unique_name, flatten, expand_buses, opened, num_to_chars

from .utilities import (
expand_buses,
flatten,
num_to_chars,
opened,
reset_get_unique_name,
)

standard_library.install_aliases()

Expand Down Expand Up @@ -478,6 +483,7 @@ def _check_for_empty_footprints(self):
for part in self.parts:
if getattr(part, "footprint", "") == "":
import skidl

skidl.empty_footprint_handler(part)

def _preprocess(self):
Expand Down Expand Up @@ -798,12 +804,12 @@ def get_net_nc_stubs(self):
"""Get all nets/buses that are stubs or no-connects."""

# Search all nets for those set as stubs or that are no-connects.
stubs = [n for n in self.nets if getattr(n, "stub", False) or isinstance(n, NCNet)]
stubs = [
n for n in self.nets if getattr(n, "stub", False) or isinstance(n, NCNet)
]

# Also find buses that are set as stubs and add their individual nets.
stubs.extend(
expand_buses([b for b in self.buses if getattr(b, "stub", False)])
)
stubs.extend(expand_buses([b for b in self.buses if getattr(b, "stub", False)]))

return stubs

Expand Down Expand Up @@ -966,6 +972,7 @@ def generate_schematic(self, **kwargs):
"""

import skidl

from .tools import tool_modules

# Reset the counters to clear any warnings/errors from previous run.
Expand All @@ -979,7 +986,6 @@ def generate_schematic(self, **kwargs):

active_logger.report_summary("generating schematic")


def generate_dot(
self,
file_=None,
Expand Down
1 change: 0 additions & 1 deletion skidl/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from future import standard_library


standard_library.install_aliases()


Expand Down
9 changes: 8 additions & 1 deletion skidl/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
from .pin import Pin
from .protonet import ProtoNet
from .skidlbaseobj import SkidlBaseObject
from .utilities import from_iadd, rmv_iadd, expand_indices, list_or_scalar, to_list, filter_list
from .utilities import (
expand_indices,
filter_list,
from_iadd,
list_or_scalar,
rmv_iadd,
to_list,
)

standard_library.install_aliases()

Expand Down
20 changes: 17 additions & 3 deletions skidl/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@
)

import collections
import re
from builtins import range, super
from copy import copy, deepcopy
import re

from future import standard_library

from .erc import dflt_net_erc
from .logger import active_logger
from .skidlbaseobj import SkidlBaseObject
from .utilities import from_iadd, set_iadd, rmv_iadd, expand_indices, filter_list, get_unique_name, expand_buses, flatten, find_num_copies
from .utilities import (
expand_buses,
expand_indices,
filter_list,
find_num_copies,
flatten,
from_iadd,
get_unique_name,
rmv_iadd,
set_iadd,
)

standard_library.install_aliases()

Expand Down Expand Up @@ -645,6 +655,7 @@ def generate_netlist_net(self, tool=None):
"""

import skidl

from .tools import tool_modules

tool = tool or skidl.get_default_tool()
Expand All @@ -666,6 +677,7 @@ def generate_xml_net(self, tool=None):
"""

import skidl

from .tools import tool_modules

tool = tool or skidl.get_default_tool()
Expand Down Expand Up @@ -718,7 +730,9 @@ def name(self, name):

# Now name the object with the given name or some variation
# of it that doesn't collide with anything else in the list.
super(Net, self.__class__).name.fset(self, get_unique_name(self.circuit.nets, "name", NET_PREFIX, name))
super(Net, self.__class__).name.fset(
self, get_unique_name(self.circuit.nets, "name", NET_PREFIX, name)
)

@name.deleter
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion skidl/netpinlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .network import Network
from .pin import Pin
from .protonet import ProtoNet
from .utilities import set_iadd, expand_buses, flatten
from .utilities import expand_buses, flatten, set_iadd

standard_library.install_aliases()

Expand Down
15 changes: 9 additions & 6 deletions skidl/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
from .logger import active_logger
from .skidlbaseobj import SkidlBaseObject
from .utilities import (
from_iadd,
rmv_iadd,
add_unique_attr,
expand_indices,
filter_list,
get_unique_name,
flatten,
find_num_copies,
to_list,
flatten,
from_iadd,
get_unique_name,
list_or_scalar,
add_unique_attr,
rmv_iadd,
to_list,
)

standard_library.install_aliases()
Expand Down Expand Up @@ -991,6 +991,7 @@ def generate_netlist_component(self, tool=None):
"""

import skidl

from .tools import tool_modules

tool = tool or skidl.get_default_tool()
Expand All @@ -1009,6 +1010,7 @@ def generate_xml_component(self, tool=None):
"""

import skidl

from .tools import tool_modules

tool = tool or skidl.get_default_tool()
Expand All @@ -1024,6 +1026,7 @@ def generate_svg_component(self, symtx="", tool=None, net_stubs=None):
"""

import skidl

from .tools import tool_modules

tool = tool or skidl.get_default_tool()
Expand Down
1 change: 1 addition & 0 deletions skidl/part_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def search_parts_iter(terms, tool=None):

import skidl
import skidl.tools

from .schlib import SchLib

if tool is None:
Expand Down
14 changes: 7 additions & 7 deletions skidl/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
unicode_literals,
)

import random
import re
import sys
import random
from builtins import range, super
from collections import defaultdict
from copy import copy
Expand All @@ -27,13 +27,13 @@
from .logger import active_logger
from .skidlbaseobj import ERROR, OK, WARNING, SkidlBaseObject
from .utilities import (
from_iadd,
set_iadd,
rmv_iadd,
expand_indices,
expand_buses,
flatten,
expand_indices,
find_num_copies,
flatten,
from_iadd,
rmv_iadd,
set_iadd,
to_list,
)

Expand Down Expand Up @@ -237,7 +237,7 @@ def _normalize_num(self):
"""

# Split the pin number into an initial alpha BGA row followed by column number.
n = list(re.match(r"(\D*)(.*)", str(self.num)).group(1,2))
n = list(re.match(r"(\D*)(.*)", str(self.num)).group(1, 2))

# Uppercase the BGA row. This has no effect if it's not a BGA.
n[0] = n[0].upper()
Expand Down
26 changes: 17 additions & 9 deletions skidl/pyspice.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@

from future import standard_library

from .skidl import set_default_tool, generate_netlist, reset, lib_search_paths, generate_svg
from .net import Net
from .schlib import SchLib
from .part import TEMPLATE, Part
from .group import subcircuit
from .tools.spice import node, Parameters, XspiceModel
from .package import package
from .bus import Bus
from .tools import SKIDL, SPICE, KICAD
from .group import subcircuit
from .logger import active_logger
from .net import Net
from .package import package
from .part import TEMPLATE, Part
from .schlib import SchLib
from .skidl import (
generate_netlist,
generate_svg,
lib_search_paths,
reset,
set_default_tool,
)
from .tools import KICAD, SKIDL, SPICE
from .tools.spice import Parameters, XspiceModel, node

standard_library.install_aliases()

Expand All @@ -34,7 +40,9 @@
from PySpice.Unit import *

except ImportError:
active_logger.warning("PySpice does not support Python 2, so SPICE simulation is not possible.")
active_logger.warning(
"PySpice does not support Python 2, so SPICE simulation is not possible."
)

else:
from .libs.pyspice_sklib import *
Expand Down
8 changes: 4 additions & 4 deletions skidl/schematics/debug_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

# __all__ = ["Router",]

from builtins import range, zip, super
from builtins import range, super, zip
from collections import defaultdict
from enum import Enum
from itertools import zip_longest, chain
from random import randint, choice
from itertools import chain, zip_longest
from random import choice, randint

from future import standard_library

from ..part import Part
from ..tools.kicad.constants import GRID
from .geometry import Point, Vector, BBox, Tx, Segment
from .geometry import BBox, Point, Segment, Tx, Vector

standard_library.install_aliases()

Expand Down
Loading

0 comments on commit b2f80f0

Please sign in to comment.