- Make Imread __init__ signature more compatible with typing.

- Support czi metadata version 1.1.
This commit is contained in:
Wim Pomp
2024-04-24 17:11:58 +02:00
parent 8bf1646736
commit c13ae9d4ad
4 changed files with 409 additions and 416 deletions

View File

@@ -256,11 +256,16 @@ class Imread(np.lib.mixins.NDArrayOperatorsMixin, ABC):
return super().__new__(subclass)
raise ReaderNotFoundError(f'No reader found for {path}.')
def __init__(self, base: Imread = None,
slice: tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] = None, # noqa
shape: tuple[int, ...] = (0, 0, 0, 0, 0),
dtype: DTypeLike = None,
frame_decorator: Callable[[Imread, np.ndarray, int, int, int], np.ndarray] = None) -> None:
def __init__(self, *args: Any, **kwargs: Any):
def parse(base: Imread = None, # noqa
slice: tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] = None, # noqa
shape: tuple[int, ...] = (0, 0, 0, 0, 0), # noqa
dtype: DTypeLike = None, # noqa
frame_decorator: Callable[[Imread, np.ndarray, int, int, int], np.ndarray] = None # noqa
) -> tuple[Any, ...]:
return base, slice, shape, dtype, frame_decorator
base, slice, shape, dtype, frame_decorator = parse(*args, **kwargs) # noqa
self.base = base or self
self.slice = slice
self._shape = Shape(shape)