some type updates

This commit is contained in:
Jan Petykiewicz 2023-01-18 18:14:53 -08:00 committed by jan
parent c7f3e7ee52
commit 2635c6c20c
2 changed files with 7 additions and 5 deletions

View File

@ -22,7 +22,7 @@ DL2 = TypeVar('DL2', bound='LazyDeviceLibrary')
LDL = TypeVar('LDL', bound='LibDeviceLibrary') LDL = TypeVar('LDL', bound='LibDeviceLibrary')
class LazyDeviceLibrary: class LazyDeviceLibrary(Mapping[str, DeviceRef]):
""" """
This class maps names to functions which generate or load the This class maps names to functions which generate or load the
relevant `Device` object. relevant `Device` object.
@ -61,7 +61,7 @@ class LazyDeviceLibrary:
return iter(self.keys()) return iter(self.keys())
def __repr__(self) -> str: def __repr__(self) -> str:
return '<LazyDeviceLibrary with keys ' + repr(list(self.generators.keys())) + '>' return '<LazyDeviceLibrary with keys ' + repr(list(self.keys())) + '>'
def get_device(self, key: str) -> Device: def get_device(self, key: str) -> Device:
if self.enable_cache and key in self.cache: if self.enable_cache and key in self.cache:

View File

@ -15,9 +15,11 @@ if TYPE_CHECKING:
# Type definitions # Type definitions
normalized_shape_tuple = Tuple[Tuple, normalized_shape_tuple = Tuple[
Tuple,
Tuple[NDArray[numpy.float64], float, float, bool, float], Tuple[NDArray[numpy.float64], float, float, bool, float],
Callable[[], 'Shape']] Callable[[], 'Shape'],
]
# ## Module-wide defaults # ## Module-wide defaults
# Default number of points per polygon for shapes # Default number of points per polygon for shapes