improve type annotations
This commit is contained in:
parent
f996a1629f
commit
c4dfd06a42
@ -100,7 +100,7 @@ def build(patterns: Union[Pattern, List[Pattern]],
|
|||||||
patterns = [patterns]
|
patterns = [patterns]
|
||||||
|
|
||||||
if disambiguate_func is None:
|
if disambiguate_func is None:
|
||||||
disambiguate_func = disambiguate_pattern_names
|
disambiguate_func = disambiguate_pattern_names # type: ignore
|
||||||
assert(disambiguate_func is not None) # placate mypy
|
assert(disambiguate_func is not None) # placate mypy
|
||||||
|
|
||||||
if not modify_originals:
|
if not modify_originals:
|
||||||
|
@ -128,6 +128,7 @@ def build(patterns: Union[Pattern, List[Pattern]],
|
|||||||
for tt in (True, False)]
|
for tt in (True, False)]
|
||||||
|
|
||||||
def layer2oas(mlayer: layer_t) -> Tuple[int, int]:
|
def layer2oas(mlayer: layer_t) -> Tuple[int, int]:
|
||||||
|
assert(layer_map is not None)
|
||||||
layer_num = layer_map[mlayer] if isinstance(mlayer, str) else mlayer
|
layer_num = layer_map[mlayer] if isinstance(mlayer, str) else mlayer
|
||||||
return _mlayer2oas(layer_num)
|
return _mlayer2oas(layer_num)
|
||||||
else:
|
else:
|
||||||
@ -275,6 +276,7 @@ def read(stream: io.BufferedIOBase,
|
|||||||
# note XELEMENT has no repetition
|
# note XELEMENT has no repetition
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
assert(not isinstance(element.repetition, fatamorgana.ReuseRepetition))
|
||||||
repetition = repetition_fata2masq(element.repetition)
|
repetition = repetition_fata2masq(element.repetition)
|
||||||
|
|
||||||
# Switch based on element type:
|
# Switch based on element type:
|
||||||
@ -490,6 +492,7 @@ def _placement_to_subpat(placement: fatrec.Placement, lib: fatamorgana.OasisLayo
|
|||||||
Helper function to create a SubPattern from a placment. Sets subpat.pattern to None
|
Helper function to create a SubPattern from a placment. Sets subpat.pattern to None
|
||||||
and sets the instance .identifier to (struct_name,).
|
and sets the instance .identifier to (struct_name,).
|
||||||
"""
|
"""
|
||||||
|
assert(not isinstance(placement.repetition, fatamorgana.ReuseRepetition))
|
||||||
xy = numpy.array((placement.x, placement.y))
|
xy = numpy.array((placement.x, placement.y))
|
||||||
mag = placement.magnification if placement.magnification is not None else 1
|
mag = placement.magnification if placement.magnification is not None else 1
|
||||||
pname = placement.get_name()
|
pname = placement.get_name()
|
||||||
|
Loading…
Reference in New Issue
Block a user