summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBas van Beek <43369155+BvB93@users.noreply.github.com>2022-05-11 10:38:12 +0200
committerGitHub <noreply@github.com>2022-05-11 10:38:12 +0200
commitef3c1b8215d7510c5e8e13f27e075f35174c2efa (patch)
treea5396136d4dd914f47cbbc3d92ec3598fe80dc20 /numpy
parent79875572916a5c8805cb7bdd00a5b26df72b0733 (diff)
parent2e7b695373c05f744f2b4be89e9a4a21b7f0d854 (diff)
downloadnumpy-ef3c1b8215d7510c5e8e13f27e075f35174c2efa.tar.gz
Merge pull request #21490 from WarrenWeckesser/average-keepdims-typing
TYP: Add typing for the keepdims param. of 'average' and 'ma.average'
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/function_base.pyi8
-rw-r--r--numpy/ma/extras.pyi2
2 files changed, 9 insertions, 1 deletions
diff --git a/numpy/lib/function_base.pyi b/numpy/lib/function_base.pyi
index f8dbd8a8b..6c00d26b4 100644
--- a/numpy/lib/function_base.pyi
+++ b/numpy/lib/function_base.pyi
@@ -110,6 +110,7 @@ def average(
axis: None = ...,
weights: None | _ArrayLikeFloat_co= ...,
returned: L[False] = ...,
+ keepdims: L[False] = ...,
) -> floating[Any]: ...
@overload
def average(
@@ -117,6 +118,7 @@ def average(
axis: None = ...,
weights: None | _ArrayLikeComplex_co = ...,
returned: L[False] = ...,
+ keepdims: L[False] = ...,
) -> complexfloating[Any, Any]: ...
@overload
def average(
@@ -124,6 +126,7 @@ def average(
axis: None = ...,
weights: None | Any = ...,
returned: L[False] = ...,
+ keepdims: L[False] = ...,
) -> Any: ...
@overload
def average(
@@ -131,6 +134,7 @@ def average(
axis: None = ...,
weights: None | _ArrayLikeFloat_co= ...,
returned: L[True] = ...,
+ keepdims: L[False] = ...,
) -> _2Tuple[floating[Any]]: ...
@overload
def average(
@@ -138,6 +142,7 @@ def average(
axis: None = ...,
weights: None | _ArrayLikeComplex_co = ...,
returned: L[True] = ...,
+ keepdims: L[False] = ...,
) -> _2Tuple[complexfloating[Any, Any]]: ...
@overload
def average(
@@ -145,6 +150,7 @@ def average(
axis: None = ...,
weights: None | Any = ...,
returned: L[True] = ...,
+ keepdims: L[False] = ...,
) -> _2Tuple[Any]: ...
@overload
def average(
@@ -152,6 +158,7 @@ def average(
axis: None | _ShapeLike = ...,
weights: None | Any = ...,
returned: L[False] = ...,
+ keepdims: bool = ...,
) -> Any: ...
@overload
def average(
@@ -159,6 +166,7 @@ def average(
axis: None | _ShapeLike = ...,
weights: None | Any = ...,
returned: L[True] = ...,
+ keepdims: bool = ...,
) -> _2Tuple[Any]: ...
@overload
diff --git a/numpy/ma/extras.pyi b/numpy/ma/extras.pyi
index e66d7cb63..05ad87210 100644
--- a/numpy/ma/extras.pyi
+++ b/numpy/ma/extras.pyi
@@ -44,7 +44,7 @@ diagflat: _fromnxfunction_single
def apply_along_axis(func1d, axis, arr, *args, **kwargs): ...
def apply_over_axes(func, a, axes): ...
-def average(a, axis=..., weights=..., returned=...): ...
+def average(a, axis=..., weights=..., returned=..., keepdims=...): ...
def median(a, axis=..., out=..., overwrite_input=..., keepdims=...): ...
def compress_nd(x, axis=...): ...
def compress_rowcols(x, axis=...): ...