Cleanup based on flake8 lint
This commit is contained in:
parent
4ae98a94ed
commit
9026103b51
@ -1,17 +1,15 @@
|
||||
"""
|
||||
Simplified Pattern assembly (`Builder`)
|
||||
"""
|
||||
from typing import Self, Sequence, Mapping, Literal, overload
|
||||
from typing import Self, Sequence, Mapping
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from numpy import pi
|
||||
from numpy.typing import ArrayLike
|
||||
|
||||
from ..pattern import Pattern
|
||||
from ..ref import Ref
|
||||
from ..library import ILibrary
|
||||
from ..error import PortError, BuildError
|
||||
from ..error import BuildError
|
||||
from ..ports import PortList, Port
|
||||
from ..abstract import Abstract
|
||||
|
||||
|
@ -399,12 +399,12 @@ class Pather(Builder):
|
||||
is_horizontal = numpy.isclose(port.rotation % pi, 0)
|
||||
if is_horizontal:
|
||||
if y is not None:
|
||||
raise BuildError(f'Asked to path to y-coordinate, but port is horizontal')
|
||||
raise BuildError('Asked to path to y-coordinate, but port is horizontal')
|
||||
if position is None:
|
||||
position = x
|
||||
else:
|
||||
if x is not None:
|
||||
raise BuildError(f'Asked to path to x-coordinate, but port is vertical')
|
||||
raise BuildError('Asked to path to x-coordinate, but port is vertical')
|
||||
if position is None:
|
||||
position = y
|
||||
|
||||
|
@ -12,15 +12,13 @@ from numpy import pi
|
||||
from numpy.typing import ArrayLike
|
||||
|
||||
from ..pattern import Pattern
|
||||
from ..ref import Ref
|
||||
from ..library import ILibrary, Library
|
||||
from ..library import ILibrary
|
||||
from ..error import PortError, BuildError
|
||||
from ..ports import PortList, Port
|
||||
from ..abstract import Abstract
|
||||
from ..utils import SupportsBool
|
||||
from .tools import Tool, RenderStep
|
||||
from .utils import ell
|
||||
from .builder import Builder
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -491,12 +489,12 @@ class RenderPather(PortList):
|
||||
is_horizontal = numpy.isclose(port.rotation % pi, 0)
|
||||
if is_horizontal:
|
||||
if y is not None:
|
||||
raise BuildError(f'Asked to path to y-coordinate, but port is horizontal')
|
||||
raise BuildError('Asked to path to y-coordinate, but port is horizontal')
|
||||
if position is None:
|
||||
position = x
|
||||
else:
|
||||
if x is not None:
|
||||
raise BuildError(f'Asked to path to x-coordinate, but port is vertical')
|
||||
raise BuildError('Asked to path to x-coordinate, but port is vertical')
|
||||
if position is None:
|
||||
position = y
|
||||
|
||||
|
@ -262,7 +262,6 @@ class BasicTool(Tool, metaclass=ABCMeta):
|
||||
default_out_ptype: str
|
||||
""" Default value for out_ptype """
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class LData:
|
||||
""" Data for planL """
|
||||
|
@ -122,6 +122,8 @@ def ell(
|
||||
orig_offsets = numpy.array([p.offset for p in ports.values()])
|
||||
rot_offsets = (rot_matrix @ orig_offsets.T).T
|
||||
|
||||
# ordering_base = rot_offsets.T * [[1], [-1 if ccw else 1]] # could work, but this is actually a more complex routing problem
|
||||
# y_order = numpy.lexsort(ordering_base) # (need to make sure we don't collide with the next input port @ same y)
|
||||
y_order = ((-1 if ccw else 1) * rot_offsets[:, 1]).argsort(kind='stable')
|
||||
y_ind = numpy.empty_like(y_order, dtype=int)
|
||||
y_ind[y_order] = numpy.arange(y_ind.shape[0])
|
||||
|
@ -1,6 +1,5 @@
|
||||
from typing import Any
|
||||
import copy
|
||||
import math
|
||||
|
||||
import numpy
|
||||
from numpy import pi
|
||||
@ -231,7 +230,7 @@ class Arc(Shape):
|
||||
|
||||
def get_thetas(inner: bool) -> NDArray[numpy.float64]:
|
||||
""" Figure out the parameter values at which we should place vertices to meet the arclength constraint"""
|
||||
dr = -self.width / 2.0 * (-1 if inner else 1)
|
||||
#dr = -self.width / 2.0 * (-1 if inner else 1)
|
||||
|
||||
n_pts = numpy.ceil(2 * pi * max(self.radii) / max_arclen).astype(int)
|
||||
arc_lengths, thetas = get_arclens(n_pts, *a_ranges[0 if inner else 1])
|
||||
|
Loading…
Reference in New Issue
Block a user