diff options
author | czgdp1807 <gdp.1807@gmail.com> | 2021-06-07 15:05:24 +0530 |
---|---|---|
committer | czgdp1807 <gdp.1807@gmail.com> | 2021-06-07 15:05:24 +0530 |
commit | 6f0f6ac879724aaa105dcf29def1e88e66420f5c (patch) | |
tree | 6cef9901c1c7f2365bcf10cf1fb2a061a0ee5d72 /numpy/typing/_array_like.py | |
parent | 4e59da126b522dd5a894041a4c9570e130fe7ae4 (diff) | |
parent | 21838b4b21d8c702730aba80131fe6ee5fe5116f (diff) | |
download | numpy-6f0f6ac879724aaa105dcf29def1e88e66420f5c.tar.gz |
resolved conflicts
Diffstat (limited to 'numpy/typing/_array_like.py')
-rw-r--r-- | numpy/typing/_array_like.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/typing/_array_like.py b/numpy/typing/_array_like.py index 2b823ecc0..3bdbed8f8 100644 --- a/numpy/typing/_array_like.py +++ b/numpy/typing/_array_like.py @@ -1,7 +1,7 @@ from __future__ import annotations import sys -from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar +from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic from numpy import ( ndarray, @@ -34,7 +34,7 @@ _ScalarType = TypeVar("_ScalarType", bound=generic) _DType = TypeVar("_DType", bound="dtype[Any]") _DType_co = TypeVar("_DType_co", covariant=True, bound="dtype[Any]") -if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: +if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS or sys.version_info >= (3, 8): # The `_SupportsArray` protocol only cares about the default dtype # (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned # array. @@ -43,7 +43,7 @@ if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: class _SupportsArray(Protocol[_DType_co]): def __array__(self) -> ndarray[Any, _DType_co]: ... else: - _SupportsArray = Any + class _SupportsArray(Generic[_DType_co]): ... # TODO: Wait for support for recursive types _NestedSequence = Union[ |