Clean up types/imports
This commit is contained in:
parent
1cce6c1f70
commit
8a56679884
5 changed files with 14 additions and 10 deletions
|
|
@ -3,7 +3,7 @@ Tools are objects which dynamically generate simple single-use devices (e.g. wir
|
||||||
|
|
||||||
# TODO document all tools
|
# TODO document all tools
|
||||||
"""
|
"""
|
||||||
from typing import Literal, Any, Self, cast, TYPE_CHECKING
|
from typing import Literal, Any, Self, cast
|
||||||
from collections.abc import Sequence, Callable
|
from collections.abc import Sequence, Callable
|
||||||
from abc import ABCMeta # , abstractmethod # TODO any way to make Tool ok with implementing only one method?
|
from abc import ABCMeta # , abstractmethod # TODO any way to make Tool ok with implementing only one method?
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
@ -593,7 +593,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||||
success = False
|
success = False
|
||||||
# If ccw is None, we don't need a bend, but we still loop to reuse the logic.
|
# If ccw is None, we don't need a bend, but we still loop to reuse the logic.
|
||||||
# We'll use a dummy loop if bends is empty and ccw is None.
|
# We'll use a dummy loop if bends is empty and ccw is None.
|
||||||
bends = cast(list[AutoTool.Bend | None], self.bends)
|
bends = cast('list[AutoTool.Bend | None]', self.bends)
|
||||||
if ccw is None and not bends:
|
if ccw is None and not bends:
|
||||||
bends += [None]
|
bends += [None]
|
||||||
|
|
||||||
|
|
@ -613,7 +613,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||||
|
|
||||||
out_ptype_pair = (
|
out_ptype_pair = (
|
||||||
'unk' if out_ptype is None else out_ptype,
|
'unk' if out_ptype is None else out_ptype,
|
||||||
straight.ptype if ccw is None else cast(AutoTool.Bend, bend).out_port.ptype
|
straight.ptype if ccw is None else cast('AutoTool.Bend', bend).out_port.ptype
|
||||||
)
|
)
|
||||||
out_transition = self.transitions.get(out_ptype_pair, None)
|
out_transition = self.transitions.get(out_ptype_pair, None)
|
||||||
otrans_dxy = self._otransition2dxy(out_transition, bend_angle)
|
otrans_dxy = self._otransition2dxy(out_transition, bend_angle)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
Object representing a one multi-layer lithographic layout.
|
Object representing a one multi-layer lithographic layout.
|
||||||
A single level of hierarchical references is included.
|
A single level of hierarchical references is included.
|
||||||
"""
|
"""
|
||||||
from typing import cast, Self, Any, TypeVar
|
from typing import cast, Self, Any, TypeVar, TYPE_CHECKING
|
||||||
from collections.abc import Sequence, Mapping, MutableMapping, Iterable, Callable
|
from collections.abc import Sequence, Mapping, MutableMapping, Iterable, Callable
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
|
|
@ -25,6 +25,9 @@ from .error import PatternError, PortError
|
||||||
from .traits import AnnotatableImpl, Scalable, Mirrorable, Rotatable, Positionable, Repeatable, Bounded
|
from .traits import AnnotatableImpl, Scalable, Mirrorable, Rotatable, Positionable, Repeatable, Bounded
|
||||||
from .ports import Port, PortList
|
from .ports import Port, PortList
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .traits import Flippable
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import numpy
|
||||||
from numpy import pi
|
from numpy import pi
|
||||||
from numpy.typing import ArrayLike, NDArray
|
from numpy.typing import ArrayLike, NDArray
|
||||||
|
|
||||||
from .traits import PositionableImpl, Rotatable, PivotableImpl, Copyable, Mirrorable, Flippable
|
from .traits import PositionableImpl, Rotatable, PivotableImpl, Copyable, Flippable
|
||||||
from .utils import rotate_offsets_around, rotation_matrix_2d
|
from .utils import rotate_offsets_around, rotation_matrix_2d
|
||||||
from .error import PortError, format_stacktrace
|
from .error import PortError, format_stacktrace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import numpy
|
||||||
from numpy.typing import NDArray, ArrayLike
|
from numpy.typing import NDArray, ArrayLike
|
||||||
|
|
||||||
from ..traits import (
|
from ..traits import (
|
||||||
Rotatable, Mirrorable, Copyable, Scalable, FlippableImpl,
|
Rotatable, Copyable, Scalable, FlippableImpl,
|
||||||
Positionable, Pivotable, PivotableImpl, RepeatableImpl, AnnotatableImpl,
|
Positionable, Pivotable, PivotableImpl, RepeatableImpl, AnnotatableImpl,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
from typing import Self, Any, TYPE_CHECKING, cast
|
from typing import Self, cast, TYPE_CHECKING
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
from numpy.typing import ArrayLike, NDArray
|
from numpy.typing import NDArray
|
||||||
|
|
||||||
from ..error import MasqueError
|
from ..error import MasqueError
|
||||||
|
|
||||||
from .positionable import Positionable
|
|
||||||
from .repeatable import Repeatable
|
from .repeatable import Repeatable
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .positionable import Positionable
|
||||||
|
|
||||||
|
|
||||||
class Mirrorable(metaclass=ABCMeta):
|
class Mirrorable(metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue