diff options
| author | Bas van Beek <b.f.van.beek@vu.nl> | 2022-01-24 17:17:35 +0100 |
|---|---|---|
| committer | Bas van Beek <b.f.van.beek@vu.nl> | 2022-01-24 17:29:03 +0100 |
| commit | 5264dc220dc208e533bdbdcafa9f4f06ddb04aab (patch) | |
| tree | 5c3035d8acba53fe3a4efe9600f7a88eceefa055 /numpy/lib | |
| parent | 6218e76bc590e9253ed8d4c4b18c74aa81332b15 (diff) | |
| download | numpy-5264dc220dc208e533bdbdcafa9f4f06ddb04aab.tar.gz | |
MAINT: Create the `_DTypeLike` type-alias in `numpy.typing`
Represents a subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
Diffstat (limited to 'numpy/lib')
| -rw-r--r-- | numpy/lib/function_base.pyi | 8 | ||||
| -rw-r--r-- | numpy/lib/npyio.pyi | 9 | ||||
| -rw-r--r-- | numpy/lib/twodim_base.pyi | 7 |
3 files changed, 3 insertions, 21 deletions
diff --git a/numpy/lib/function_base.pyi b/numpy/lib/function_base.pyi index 6e2f886cf..d99672169 100644 --- a/numpy/lib/function_base.pyi +++ b/numpy/lib/function_base.pyi @@ -2,7 +2,6 @@ import sys from collections.abc import Sequence, Iterator, Callable, Iterable from typing import ( Literal as L, - Union, Any, TypeVar, overload, @@ -38,7 +37,7 @@ from numpy.typing import ( DTypeLike, _ShapeLike, _ScalarLike_co, - _SupportsDType, + _DTypeLike, _FiniteNestedSequence, _SupportsArray, _ArrayLikeInt_co, @@ -69,11 +68,6 @@ _ArrayType = TypeVar("_ArrayType", bound=NDArray[Any]) _2Tuple = tuple[_T, _T] _ArrayLike = _FiniteNestedSequence[_SupportsArray[dtype[_SCT]]] -_DTypeLike = Union[ - dtype[_SCT], - type[_SCT], - _SupportsDType[dtype[_SCT]], -] class _TrimZerosSequence(Protocol[_T_co]): def __len__(self) -> int: ... diff --git a/numpy/lib/npyio.pyi b/numpy/lib/npyio.pyi index 4f11fa807..b96e9dada 100644 --- a/numpy/lib/npyio.pyi +++ b/numpy/lib/npyio.pyi @@ -9,7 +9,6 @@ from typing import ( Any, TypeVar, Generic, - Union, IO, overload, Protocol, @@ -31,7 +30,7 @@ from numpy.typing import ( ArrayLike, DTypeLike, NDArray, - _SupportsDType, + _DTypeLike, _SupportsArrayFunc, ) @@ -47,12 +46,6 @@ _SCT = TypeVar("_SCT", bound=generic) _CharType_co = TypeVar("_CharType_co", str, bytes, covariant=True) _CharType_contra = TypeVar("_CharType_contra", str, bytes, contravariant=True) -_DTypeLike = Union[ - type[_SCT], - dtype[_SCT], - _SupportsDType[dtype[_SCT]], -] - class _SupportsGetItem(Protocol[_T_contra, _T_co]): def __getitem__(self, key: _T_contra, /) -> _T_co: ... diff --git a/numpy/lib/twodim_base.pyi b/numpy/lib/twodim_base.pyi index 491862408..1ac510ac2 100644 --- a/numpy/lib/twodim_base.pyi +++ b/numpy/lib/twodim_base.pyi @@ -26,7 +26,7 @@ from numpy import ( from numpy.typing import ( DTypeLike, - _SupportsDType, + _DTypeLike, ArrayLike, NDArray, _FiniteNestedSequence, @@ -47,11 +47,6 @@ _MaskFunc = Callable[ NDArray[Union[number[Any], bool_, timedelta64, datetime64, object_]], ] -_DTypeLike = Union[ - type[_SCT], - dtype[_SCT], - _SupportsDType[dtype[_SCT]], -] _ArrayLike = _FiniteNestedSequence[_SupportsArray[dtype[_SCT]]] __all__: list[str] |
