mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2024-11-10 00:34:29 +00:00
python 3.10 compat re: TypeAlias
This commit is contained in:
parent
b7d88c46c8
commit
0ee371ad05
3 changed files with 11 additions and 5 deletions
|
@ -14,7 +14,13 @@ Check these using ``in`` rather than ``==``. This interface will develop in futu
|
||||||
versions to allow a single dtype check.
|
versions to allow a single dtype check.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Tuple, TypeAlias, Union
|
import sys
|
||||||
|
from typing import Tuple, Union
|
||||||
|
|
||||||
|
if sys.version_info.minor >= 10:
|
||||||
|
from typing import TypeAlias
|
||||||
|
else:
|
||||||
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ except ImportError:
|
||||||
|
|
||||||
if sys.version_info.minor >= 10:
|
if sys.version_info.minor >= 10:
|
||||||
from typing import TypeAlias
|
from typing import TypeAlias
|
||||||
|
else:
|
||||||
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
H5Arraylike: TypeAlias = Tuple[Union[Path, str], str]
|
H5Arraylike: TypeAlias = Tuple[Union[Path, str], str]
|
||||||
else: # pragma: no cover
|
|
||||||
H5Arraylike = Tuple[Union[Path, str], str]
|
|
||||||
|
|
||||||
|
|
||||||
class H5ArrayPath(NamedTuple):
|
class H5ArrayPath(NamedTuple):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
from typing import Any, Tuple, Union, Type
|
from typing import Any, Tuple, Union, Type
|
||||||
|
|
||||||
if sys.version_info.minor >= 11:
|
if sys.version_info.minor >= 10:
|
||||||
from typing import TypeAlias
|
from typing import TypeAlias
|
||||||
else:
|
else:
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias
|
||||||
|
|
Loading…
Reference in a new issue