summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-05-08 17:37:12 +0200
committerGitHub <noreply@github.com>2023-05-08 17:37:12 +0200
commite4d2cdb5158358349d8f4ee3358f75420a38ebf5 (patch)
treedc19fc3aba02d5141a6fc07399db8e8e18b31f26 /numpy/core
parentc7724ee776f3aa447d89170809aace0461ccacf0 (diff)
parent2cd27f7c2dcf8599196709d9774960b51eca6a1c (diff)
downloadnumpy-e4d2cdb5158358349d8f4ee3358f75420a38ebf5.tar.gz
Merge pull request #23735 from BvB93/typing_1_25
TYP: Update type annotations for the numpy 1.25 release
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/einsumfunc.pyi53
-rw-r--r--numpy/core/fromnumeric.pyi4
2 files changed, 52 insertions, 5 deletions
diff --git a/numpy/core/einsumfunc.pyi b/numpy/core/einsumfunc.pyi
index c811a5783..ad483bb90 100644
--- a/numpy/core/einsumfunc.pyi
+++ b/numpy/core/einsumfunc.pyi
@@ -5,10 +5,6 @@ from numpy import (
ndarray,
dtype,
bool_,
- unsignedinteger,
- signedinteger,
- floating,
- complexfloating,
number,
_OrderKACF,
)
@@ -18,12 +14,14 @@ from numpy._typing import (
_ArrayLikeInt_co,
_ArrayLikeFloat_co,
_ArrayLikeComplex_co,
+ _ArrayLikeObject_co,
_DTypeLikeBool,
_DTypeLikeUInt,
_DTypeLikeInt,
_DTypeLikeFloat,
_DTypeLikeComplex,
_DTypeLikeComplex_co,
+ _DTypeLikeObject,
)
_ArrayType = TypeVar(
@@ -132,6 +130,51 @@ def einsum(
optimize: _OptimizeKind = ...,
) -> _ArrayType: ...
+@overload
+def einsum(
+ subscripts: str | _ArrayLikeInt_co,
+ /,
+ *operands: _ArrayLikeObject_co,
+ out: None = ...,
+ dtype: None | _DTypeLikeObject = ...,
+ order: _OrderKACF = ...,
+ casting: _CastingSafe = ...,
+ optimize: _OptimizeKind = ...,
+) -> Any: ...
+@overload
+def einsum(
+ subscripts: str | _ArrayLikeInt_co,
+ /,
+ *operands: Any,
+ casting: _CastingUnsafe,
+ dtype: None | _DTypeLikeObject = ...,
+ out: None = ...,
+ order: _OrderKACF = ...,
+ optimize: _OptimizeKind = ...,
+) -> Any: ...
+@overload
+def einsum(
+ subscripts: str | _ArrayLikeInt_co,
+ /,
+ *operands: _ArrayLikeObject_co,
+ out: _ArrayType,
+ dtype: None | _DTypeLikeObject = ...,
+ order: _OrderKACF = ...,
+ casting: _CastingSafe = ...,
+ optimize: _OptimizeKind = ...,
+) -> _ArrayType: ...
+@overload
+def einsum(
+ subscripts: str | _ArrayLikeInt_co,
+ /,
+ *operands: Any,
+ out: _ArrayType,
+ casting: _CastingUnsafe,
+ dtype: None | _DTypeLikeObject = ...,
+ order: _OrderKACF = ...,
+ optimize: _OptimizeKind = ...,
+) -> _ArrayType: ...
+
# NOTE: `einsum_call` is a hidden kwarg unavailable for public use.
# It is therefore excluded from the signatures below.
# NOTE: In practice the list consists of a `str` (first element)
@@ -139,6 +182,6 @@ def einsum(
def einsum_path(
subscripts: str | _ArrayLikeInt_co,
/,
- *operands: _ArrayLikeComplex_co,
+ *operands: _ArrayLikeComplex_co | _DTypeLikeObject,
optimize: _OptimizeKind = ...,
) -> tuple[list[Any], str]: ...
diff --git a/numpy/core/fromnumeric.pyi b/numpy/core/fromnumeric.pyi
index 17b17819d..43d178557 100644
--- a/numpy/core/fromnumeric.pyi
+++ b/numpy/core/fromnumeric.pyi
@@ -1047,3 +1047,7 @@ def var(
*,
where: _ArrayLikeBool_co = ...,
) -> _ArrayType: ...
+
+max = amax
+min = amin
+round = around