python 3.9 compat

This commit is contained in:
sneakers-the-rat 2024-04-22 20:14:06 -07:00
parent 9c306db791
commit 2e5d0f4192
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D

View file

@ -2,8 +2,9 @@
Interfaces for HDF5 Datasets Interfaces for HDF5 Datasets
""" """
import sys
from pathlib import Path from pathlib import Path
from typing import Any, NamedTuple, Tuple, TypeAlias, Union from typing import Any, NamedTuple, Tuple, Union
import numpy as np import numpy as np
@ -15,7 +16,12 @@ try:
except ImportError: except ImportError:
h5py = None h5py = None
H5Arraylike: TypeAlias = Tuple[Union[Path, str], str] if sys.version_info.minor >= 3.10:
from typing import TypeAlias
H5Arraylike: TypeAlias = Tuple[Union[Path, str], str]
else: # pragma: no cover
H5Arraylike = Tuple[Union[Path, str], str]
class H5ArrayPath(NamedTuple): class H5ArrayPath(NamedTuple):