diff --git a/src/numpydantic/interface/dask.py b/src/numpydantic/interface/dask.py index 13c6c1a..960c94b 100644 --- a/src/numpydantic/interface/dask.py +++ b/src/numpydantic/interface/dask.py @@ -2,7 +2,7 @@ Interface for Dask arrays """ -from typing import Any, Iterable, Literal, Optional +from typing import Any, Iterable, List, Literal, Optional, Union import numpy as np from pydantic import SerializationInfo @@ -17,7 +17,7 @@ except ImportError: # pragma: no cover DaskArray = None -def _as_tuple(a_list: list | Any) -> tuple: +def _as_tuple(a_list: Any) -> tuple: """Make a list of list into a tuple of tuples""" return tuple( [_as_tuple(item) if isinstance(item, list) else item for item in a_list] @@ -93,7 +93,7 @@ class DaskInterface(Interface): @classmethod def to_json( cls, array: DaskArray, info: Optional[SerializationInfo] = None - ) -> list | DaskJsonDict: + ) -> Union[List, DaskJsonDict]: """ Convert an array to a JSON serializable array by first converting to a numpy array and then to a list. diff --git a/src/numpydantic/interface/zarr.py b/src/numpydantic/interface/zarr.py index 922d806..d79491c 100644 --- a/src/numpydantic/interface/zarr.py +++ b/src/numpydantic/interface/zarr.py @@ -65,7 +65,7 @@ class ZarrJsonDict(JsonDict): path: Optional[str] = None array: Optional[list] = None - def to_array_input(self) -> ZarrArray | ZarrArrayPath: + def to_array_input(self) -> Union[ZarrArray, ZarrArrayPath]: """ Construct a ZarrArrayPath if file and path are present, otherwise a ZarrArray @@ -168,7 +168,7 @@ class ZarrInterface(Interface): cls, array: Union[ZarrArray, str, Path, ZarrArrayPath, Sequence], info: Optional[SerializationInfo] = None, - ) -> list | ZarrJsonDict: + ) -> Union[list, ZarrJsonDict]: """ Dump a Zarr Array to JSON