improve type annotations

This commit is contained in:
Jan Petykiewicz 2020-09-18 19:06:44 -07:00
parent f996a1629f
commit c4dfd06a42
2 changed files with 4 additions and 1 deletions

View File

@ -100,7 +100,7 @@ def build(patterns: Union[Pattern, List[Pattern]],
patterns = [patterns]
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
if not modify_originals:

View File

@ -128,6 +128,7 @@ def build(patterns: Union[Pattern, List[Pattern]],
for tt in (True, False)]
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
return _mlayer2oas(layer_num)
else:
@ -275,6 +276,7 @@ def read(stream: io.BufferedIOBase,
# note XELEMENT has no repetition
continue
assert(not isinstance(element.repetition, fatamorgana.ReuseRepetition))
repetition = repetition_fata2masq(element.repetition)
# 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
and sets the instance .identifier to (struct_name,).
"""
assert(not isinstance(placement.repetition, fatamorgana.ReuseRepetition))
xy = numpy.array((placement.x, placement.y))
mag = placement.magnification if placement.magnification is not None else 1
pname = placement.get_name()