some typing clarifications

lethe/HEAD
Jan Petykiewicz 4 years ago
parent ee8f015172
commit f312f50751

@ -376,7 +376,7 @@ def read(stream: io.BufferedIOBase,
def _mlayer2gds(mlayer: layer_t) -> Tuple[int, int]: def _mlayer2gds(mlayer: layer_t) -> Tuple[int, int]:
""" Helper to turn a layer tuple-or-int into a layer and datatype""" """ Helper to turn a layer tuple-or-int into a layer and datatype"""
if is_scalar(mlayer): if isinstance(mlayer, int):
layer = mlayer layer = mlayer
data_type = 0 data_type = 0
else: else:
@ -477,6 +477,7 @@ def _subpatterns_to_refs(subpatterns: List[subpattern_t]
# Note: GDS mirrors first and rotates second # Note: GDS mirrors first and rotates second
mirror_across_x, extra_angle = normalize_mirror(subpat.mirrored) mirror_across_x, extra_angle = normalize_mirror(subpat.mirrored)
ref: Union[gdsii.elements.SRef, gdsii.elements.ARef]
if isinstance(subpat, GridRepetition): if isinstance(subpat, GridRepetition):
xy = numpy.array(subpat.offset) + [ xy = numpy.array(subpat.offset) + [
[0, 0], [0, 0],
@ -502,8 +503,8 @@ def _subpatterns_to_refs(subpatterns: List[subpattern_t]
def _shapes_to_elements(shapes: List[Shape], def _shapes_to_elements(shapes: List[Shape],
polygonize_paths: bool = False polygonize_paths: bool = False
) -> List[gdsii.elements.Boundary]: ) -> List[Union[gdsii.elements.Boundary, gdsii.elements.Path]]:
elements = [] elements: List[Union[gdsii.elements.Boundary, gdsii.elements.Path]] = []
# Add a Boundary element for each shape, and Path elements if necessary # Add a Boundary element for each shape, and Path elements if necessary
for shape in shapes: for shape in shapes:
layer, data_type = _mlayer2gds(shape.layer) layer, data_type = _mlayer2gds(shape.layer)

Loading…
Cancel
Save