From 5f93f9ef8ecb00ba1e6ef4247aacd15586779bff Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Sun, 8 Sep 2024 08:51:46 +0200 Subject: [PATCH 1/2] Change type of layer Metadata from Dict to Mapping --- src/npe2/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/npe2/types.py b/src/npe2/types.py index 3f649005..7c82325f 100644 --- a/src/npe2/types.py +++ b/src/npe2/types.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import ( TYPE_CHECKING, Callable, @@ -48,7 +49,7 @@ def __array__(self) -> "np.ndarray": LayerName = Literal[ "graph", "image", "labels", "points", "shapes", "surface", "tracks", "vectors" ] -Metadata = Dict +Metadata = Mapping DataType = Union[ArrayLike, Sequence[ArrayLike]] FullLayerData = Tuple[DataType, Metadata, LayerName] LayerData = Union[Tuple[DataType], Tuple[DataType, Metadata], FullLayerData] From 9ff0b2c984c5f4ea4e19b538d29a32f96e491374 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2024 06:53:08 +0000 Subject: [PATCH 2/2] style: [pre-commit.ci] auto fixes [...] --- src/npe2/types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/npe2/types.py b/src/npe2/types.py index 7c82325f..da7e72ba 100644 --- a/src/npe2/types.py +++ b/src/npe2/types.py @@ -2,7 +2,6 @@ from typing import ( TYPE_CHECKING, Callable, - Dict, List, Literal, NewType,