diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-21 20:24:22 +0100 |
---|---|---|
committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-23 21:15:00 +0100 |
commit | 7b5f39b5eeac583f822741eaf95a8229f2b5f8d7 (patch) | |
tree | a7a83a47f39d1e4e29becb5f835158e4b1c86e3a /numpy/core/numeric.pyi | |
parent | 99ed44df750fedfc0bbf956c88d15befd5e760cd (diff) | |
download | numpy-7b5f39b5eeac583f822741eaf95a8229f2b5f8d7.tar.gz |
STY: Use subscriptable `builtins` types over the generic aliases in `typing`
Diffstat (limited to 'numpy/core/numeric.pyi')
-rw-r--r-- | numpy/core/numeric.pyi | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/numpy/core/numeric.pyi b/numpy/core/numeric.pyi index d7ec30351..a8727b1ce 100644 --- a/numpy/core/numeric.pyi +++ b/numpy/core/numeric.pyi @@ -2,13 +2,10 @@ from typing import ( Any, Union, Sequence, - Tuple, Callable, - List, overload, TypeVar, Literal, - Type, SupportsAbs, SupportsIndex, NoReturn, @@ -57,13 +54,13 @@ _ArrayType = TypeVar("_ArrayType", bound=NDArray[Any]) _DTypeLike = Union[ dtype[_SCT], - Type[_SCT], + type[_SCT], _SupportsDType[dtype[_SCT]], ] _ArrayLike = _FiniteNestedSequence[_SupportsArray[dtype[_SCT]]] _CorrelateMode = Literal["valid", "same", "full"] -__all__: List[str] +__all__: list[str] @overload def zeros_like( @@ -406,43 +403,43 @@ def outer( def tensordot( a: _ArrayLikeBool_co, b: _ArrayLikeBool_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[bool_]: ... @overload def tensordot( a: _ArrayLikeUInt_co, b: _ArrayLikeUInt_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[unsignedinteger[Any]]: ... @overload def tensordot( a: _ArrayLikeInt_co, b: _ArrayLikeInt_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[signedinteger[Any]]: ... @overload def tensordot( a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[floating[Any]]: ... @overload def tensordot( a: _ArrayLikeComplex_co, b: _ArrayLikeComplex_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def tensordot( a: _ArrayLikeTD64_co, b: _ArrayLikeTD64_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[timedelta64]: ... @overload def tensordot( a: _ArrayLikeObject_co, b: _ArrayLikeObject_co, - axes: int | Tuple[_ShapeLike, _ShapeLike] = ..., + axes: int | tuple[_ShapeLike, _ShapeLike] = ..., ) -> NDArray[object_]: ... @overload @@ -528,15 +525,15 @@ def cross( @overload def indices( dimensions: Sequence[int], - dtype: Type[int] = ..., + dtype: type[int] = ..., sparse: Literal[False] = ..., ) -> NDArray[int_]: ... @overload def indices( dimensions: Sequence[int], - dtype: Type[int] = ..., + dtype: type[int] = ..., sparse: Literal[True] = ..., -) -> Tuple[NDArray[int_], ...]: ... +) -> tuple[NDArray[int_], ...]: ... @overload def indices( dimensions: Sequence[int], @@ -548,7 +545,7 @@ def indices( dimensions: Sequence[int], dtype: _DTypeLike[_SCT], sparse: Literal[True], -) -> Tuple[NDArray[_SCT], ...]: ... +) -> tuple[NDArray[_SCT], ...]: ... @overload def indices( dimensions: Sequence[int], @@ -560,7 +557,7 @@ def indices( dimensions: Sequence[int], dtype: DTypeLike, sparse: Literal[True], -) -> Tuple[NDArray[Any], ...]: ... +) -> tuple[NDArray[Any], ...]: ... def fromfunction( function: Callable[..., _T], |