Cosmetic changes to argument lists

This commit is contained in:
Jan Petykiewicz 2019-05-17 00:39:46 -07:00
parent 58353b7884
commit 16c6bfc70a
9 changed files with 85 additions and 73 deletions

View File

@ -167,7 +167,7 @@ class Pattern:
def polygonize(self, def polygonize(self,
poly_num_points: int = None, poly_num_points: int = None,
poly_max_arclen: float=None poly_max_arclen: float = None,
) -> 'Pattern': ) -> 'Pattern':
""" """
Calls .to_polygons(...) on all the shapes in this Pattern and any referenced patterns, Calls .to_polygons(...) on all the shapes in this Pattern and any referenced patterns,
@ -191,7 +191,7 @@ class Pattern:
def manhattanize(self, def manhattanize(self,
grid_x: numpy.ndarray, grid_x: numpy.ndarray,
grid_y: numpy.ndarray grid_y: numpy.ndarray,
) -> 'Pattern': ) -> 'Pattern':
""" """
Calls .polygonize() and .flatten on the pattern, then calls .manhattanize() on all the Calls .polygonize() and .flatten on the pattern, then calls .manhattanize() on all the
@ -210,7 +210,7 @@ class Pattern:
def subpatternize(self, def subpatternize(self,
recursive: bool = True, recursive: bool = True,
norm_value: int=1e6, norm_value: int = int(1e6),
exclude_types: Tuple[Shape] = (Polygon,) exclude_types: Tuple[Shape] = (Polygon,)
) -> 'Pattern': ) -> 'Pattern':
""" """

View File

@ -167,7 +167,10 @@ class Arc(Shape):
new._angles = self._angles.copy() new._angles = self._angles.copy()
return new return new
def to_polygons(self, poly_num_points: int=None, poly_max_arclen: float=None) -> List[Polygon]: def to_polygons(self,
poly_num_points: int = None,
poly_max_arclen: float = None,
) -> List[Polygon]:
if poly_num_points is None: if poly_num_points is None:
poly_num_points = self.poly_num_points poly_num_points = self.poly_num_points
if poly_max_arclen is None: if poly_max_arclen is None:

View File

@ -58,7 +58,10 @@ class Circle(Shape):
new._offset = self._offset.copy() new._offset = self._offset.copy()
return new return new
def to_polygons(self, poly_num_points: int=None, poly_max_arclen: float=None) -> List[Polygon]: def to_polygons(self,
poly_num_points: int = None,
poly_max_arclen: float = None,
) -> List[Polygon]:
if poly_num_points is None: if poly_num_points is None:
poly_num_points = self.poly_num_points poly_num_points = self.poly_num_points
if poly_max_arclen is None: if poly_max_arclen is None:

View File

@ -107,7 +107,7 @@ class Ellipse(Shape):
def to_polygons(self, def to_polygons(self,
poly_num_points: int = None, poly_num_points: int = None,
poly_max_arclen: float=None poly_max_arclen: float = None,
) -> List[Polygon]: ) -> List[Polygon]:
if poly_num_points is None: if poly_num_points is None:
poly_num_points = self.poly_num_points poly_num_points = self.poly_num_points

View File

@ -98,7 +98,7 @@ class Polygon(Shape):
rotation: float = 0.0, rotation: float = 0.0,
offset: vector2 = (0.0, 0.0), offset: vector2 = (0.0, 0.0),
layer: int = 0, layer: int = 0,
dose: float=1.0 dose: float = 1.0,
) -> 'Polygon': ) -> 'Polygon':
""" """
Draw a square given side_length, centered on the origin. Draw a square given side_length, centered on the origin.
@ -125,7 +125,7 @@ class Polygon(Shape):
rotation: float = 0, rotation: float = 0,
offset: vector2 = (0.0, 0.0), offset: vector2 = (0.0, 0.0),
layer: int = 0, layer: int = 0,
dose: float=1.0 dose: float = 1.0,
) -> 'Polygon': ) -> 'Polygon':
""" """
Draw a rectangle with side lengths lx and ly, centered on the origin. Draw a rectangle with side lengths lx and ly, centered on the origin.
@ -156,7 +156,7 @@ class Polygon(Shape):
ymax: float = None, ymax: float = None,
ly: float = None, ly: float = None,
layer: int = 0, layer: int = 0,
dose: float = 1.0 dose: float = 1.0,
) -> 'Polygon': ) -> 'Polygon':
""" """
Draw a rectangle by specifying side/center positions. Draw a rectangle by specifying side/center positions.

View File

@ -193,7 +193,10 @@ class Shape(metaclass=ABCMeta):
self.translate(+pivot) self.translate(+pivot)
return self return self
def manhattanize_fast(self, grid_x: numpy.ndarray, grid_y: numpy.ndarray) -> List['Polygon']: def manhattanize_fast(self,
grid_x: numpy.ndarray,
grid_y: numpy.ndarray,
) -> List['Polygon']:
""" """
Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape. Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape.
@ -295,7 +298,10 @@ class Shape(metaclass=ABCMeta):
return manhattan_polygons return manhattan_polygons
def manhattanize(self, grid_x: numpy.ndarray, grid_y: numpy.ndarray) -> List['Polygon']: def manhattanize(self,
grid_x: numpy.ndarray,
grid_y: numpy.ndarray
) -> List['Polygon']:
""" """
Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape. Returns a list of polygons with grid-aligned ("Manhattan") edges approximating the shape.

View File

@ -96,7 +96,7 @@ class Text(Shape):
def to_polygons(self, def to_polygons(self,
_poly_num_points: int = None, _poly_num_points: int = None,
_poly_max_arclen: float=None _poly_max_arclen: float = None,
) -> List[Polygon]: ) -> List[Polygon]:
all_polygons = [] all_polygons = []
total_advance = 0 total_advance = 0