flake8-aided fixes
This commit is contained in:
parent
db9b39dbc0
commit
6b01b43559
29 changed files with 241 additions and 349 deletions
|
|
@ -48,7 +48,7 @@ class Arc(Shape, metaclass=AutoSlots):
|
|||
|
||||
# radius properties
|
||||
@property
|
||||
def radii(self) -> Any: #TODO mypy#3004 NDArray[numpy.float64]:
|
||||
def radii(self) -> Any: # TODO mypy#3004 NDArray[numpy.float64]:
|
||||
"""
|
||||
Return the radii `[rx, ry]`
|
||||
"""
|
||||
|
|
@ -85,7 +85,7 @@ class Arc(Shape, metaclass=AutoSlots):
|
|||
|
||||
# arc start/stop angle properties
|
||||
@property
|
||||
def angles(self) -> Any: #TODO mypy#3004 NDArray[numpy.float64]:
|
||||
def angles(self) -> Any: # TODO mypy#3004 NDArray[numpy.float64]:
|
||||
"""
|
||||
Return the start and stop angles `[a_start, a_stop]`.
|
||||
Angles are measured from x-axis after rotation
|
||||
|
|
@ -171,9 +171,9 @@ class Arc(Shape, metaclass=AutoSlots):
|
|||
raw: bool = False,
|
||||
) -> None:
|
||||
if raw:
|
||||
assert(isinstance(radii, numpy.ndarray))
|
||||
assert(isinstance(angles, numpy.ndarray))
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert isinstance(radii, numpy.ndarray)
|
||||
assert isinstance(angles, numpy.ndarray)
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
self._radii = radii
|
||||
self._angles = angles
|
||||
self._width = width
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Circle(Shape, metaclass=AutoSlots):
|
|||
raw: bool = False,
|
||||
) -> None:
|
||||
if raw:
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
self._radius = radius
|
||||
self._offset = offset
|
||||
self._repetition = repetition
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Ellipse(Shape, metaclass=AutoSlots):
|
|||
|
||||
# radius properties
|
||||
@property
|
||||
def radii(self) -> Any: #TODO mypy#3004 NDArray[numpy.float64]:
|
||||
def radii(self) -> Any: # TODO mypy#3004 NDArray[numpy.float64]:
|
||||
"""
|
||||
Return the radii `[rx, ry]`
|
||||
"""
|
||||
|
|
@ -106,8 +106,8 @@ class Ellipse(Shape, metaclass=AutoSlots):
|
|||
raw: bool = False,
|
||||
) -> None:
|
||||
if raw:
|
||||
assert(isinstance(radii, numpy.ndarray))
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert isinstance(radii, numpy.ndarray)
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
self._radii = radii
|
||||
self._offset = offset
|
||||
self._rotation = rotation
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
|
||||
# cap_extensions property
|
||||
@property
|
||||
def cap_extensions(self) -> Optional[Any]: #TODO mypy#3004 NDArray[numpy.float64]]:
|
||||
def cap_extensions(self) -> Optional[Any]: # TODO mypy#3004 NDArray[numpy.float64]]:
|
||||
"""
|
||||
Path end-cap extension
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
|
||||
# vertices property
|
||||
@property
|
||||
def vertices(self) -> Any: #TODO mypy#3004 NDArray[numpy.float64]]:
|
||||
def vertices(self) -> Any: # TODO mypy#3004 NDArray[numpy.float64]]:
|
||||
"""
|
||||
Vertices of the path (Nx2 ndarray: `[[x0, y0], [x1, y1], ...]`)
|
||||
"""
|
||||
|
|
@ -162,9 +162,9 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
self._cap_extensions = None # Since .cap setter might access it
|
||||
|
||||
if raw:
|
||||
assert(isinstance(vertices, numpy.ndarray))
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert(isinstance(cap_extensions, numpy.ndarray) or cap_extensions is None)
|
||||
assert isinstance(vertices, numpy.ndarray)
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
assert isinstance(cap_extensions, numpy.ndarray) or cap_extensions is None
|
||||
self._vertices = vertices
|
||||
self._offset = offset
|
||||
self._repetition = repetition
|
||||
|
|
@ -229,7 +229,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
Returns:
|
||||
The resulting Path object
|
||||
"""
|
||||
#TODO: needs testing
|
||||
# TODO: needs testing
|
||||
direction = numpy.array([1, 0])
|
||||
|
||||
verts = [numpy.zeros(2)]
|
||||
|
|
@ -409,7 +409,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
if self.cap == PathCap.Square:
|
||||
extensions = numpy.full(2, self.width / 2)
|
||||
elif self.cap == PathCap.SquareCustom:
|
||||
assert(isinstance(self.cap_extensions, numpy.ndarray))
|
||||
assert isinstance(self.cap_extensions, numpy.ndarray)
|
||||
extensions = self.cap_extensions
|
||||
else:
|
||||
# Flush or Circle
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
|
||||
# vertices property
|
||||
@property
|
||||
def vertices(self) -> Any: #TODO mypy#3004 NDArray[numpy.float64]:
|
||||
def vertices(self) -> Any: # TODO mypy#3004 NDArray[numpy.float64]:
|
||||
"""
|
||||
Vertices of the polygon (Nx2 ndarray: `[[x0, y0], [x1, y1], ...]`)
|
||||
"""
|
||||
|
|
@ -88,8 +88,8 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
raw: bool = False,
|
||||
) -> None:
|
||||
if raw:
|
||||
assert(isinstance(vertices, numpy.ndarray))
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert isinstance(vertices, numpy.ndarray)
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
self._vertices = vertices
|
||||
self._offset = offset
|
||||
self._repetition = repetition
|
||||
|
|
@ -212,17 +212,17 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
"""
|
||||
if lx is None:
|
||||
if xctr is None:
|
||||
assert(xmin is not None)
|
||||
assert(xmax is not None)
|
||||
assert xmin is not None
|
||||
assert xmax is not None
|
||||
xctr = 0.5 * (xmax + xmin)
|
||||
lx = xmax - xmin
|
||||
elif xmax is None:
|
||||
assert(xmin is not None)
|
||||
assert(xctr is not None)
|
||||
assert xmin is not None
|
||||
assert xctr is not None
|
||||
lx = 2 * (xctr - xmin)
|
||||
elif xmin is None:
|
||||
assert(xctr is not None)
|
||||
assert(xmax is not None)
|
||||
assert xctr is not None
|
||||
assert xmax is not None
|
||||
lx = 2 * (xmax - xctr)
|
||||
else:
|
||||
raise PatternError('Two of xmin, xctr, xmax, lx must be None!')
|
||||
|
|
@ -230,29 +230,29 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
if xctr is not None:
|
||||
pass
|
||||
elif xmax is None:
|
||||
assert(xmin is not None)
|
||||
assert(lx is not None)
|
||||
assert xmin is not None
|
||||
assert lx is not None
|
||||
xctr = xmin + 0.5 * lx
|
||||
elif xmin is None:
|
||||
assert(xmax is not None)
|
||||
assert(lx is not None)
|
||||
assert xmax is not None
|
||||
assert lx is not None
|
||||
xctr = xmax - 0.5 * lx
|
||||
else:
|
||||
raise PatternError('Two of xmin, xctr, xmax, lx must be None!')
|
||||
|
||||
if ly is None:
|
||||
if yctr is None:
|
||||
assert(ymin is not None)
|
||||
assert(ymax is not None)
|
||||
assert ymin is not None
|
||||
assert ymax is not None
|
||||
yctr = 0.5 * (ymax + ymin)
|
||||
ly = ymax - ymin
|
||||
elif ymax is None:
|
||||
assert(ymin is not None)
|
||||
assert(yctr is not None)
|
||||
assert ymin is not None
|
||||
assert yctr is not None
|
||||
ly = 2 * (yctr - ymin)
|
||||
elif ymin is None:
|
||||
assert(yctr is not None)
|
||||
assert(ymax is not None)
|
||||
assert yctr is not None
|
||||
assert ymax is not None
|
||||
ly = 2 * (ymax - yctr)
|
||||
else:
|
||||
raise PatternError('Two of ymin, yctr, ymax, ly must be None!')
|
||||
|
|
@ -260,12 +260,12 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
if yctr is not None:
|
||||
pass
|
||||
elif ymax is None:
|
||||
assert(ymin is not None)
|
||||
assert(ly is not None)
|
||||
assert ymin is not None
|
||||
assert ly is not None
|
||||
yctr = ymin + 0.5 * ly
|
||||
elif ymin is None:
|
||||
assert(ly is not None)
|
||||
assert(ymax is not None)
|
||||
assert ly is not None
|
||||
assert ymax is not None
|
||||
yctr = ymax - 0.5 * ly
|
||||
else:
|
||||
raise PatternError('Two of ymin, yctr, ymax, ly must be None!')
|
||||
|
|
@ -331,7 +331,6 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
poly.rotate(rotation)
|
||||
return poly
|
||||
|
||||
|
||||
def to_polygons(
|
||||
self,
|
||||
poly_num_points: Optional[int] = None, # unused
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
|
|||
|
||||
# Mirrored property
|
||||
@property
|
||||
def mirrored(self) -> Any: #TODO mypy#3004 NDArray[numpy.bool_]:
|
||||
def mirrored(self) -> Any: # TODO mypy#3004 NDArray[numpy.bool_]:
|
||||
return self._mirrored
|
||||
|
||||
@mirrored.setter
|
||||
|
|
@ -79,8 +79,8 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
|
|||
raw: bool = False,
|
||||
) -> None:
|
||||
if raw:
|
||||
assert(isinstance(offset, numpy.ndarray))
|
||||
assert(isinstance(mirrored, numpy.ndarray))
|
||||
assert isinstance(offset, numpy.ndarray)
|
||||
assert isinstance(mirrored, numpy.ndarray)
|
||||
self._offset = offset
|
||||
self._layer = layer
|
||||
self._string = string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue