From 3585a6e089d23ddea4de8f7f80451363599deeed Mon Sep 17 00:00:00 2001 From: Janus Heide Date: Thu, 27 Jan 2022 18:10:37 +0100 Subject: [PATCH 1/4] added missing where typehints in fromnumeric.pyi --- numpy/core/fromnumeric.pyi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/numpy/core/fromnumeric.pyi b/numpy/core/fromnumeric.pyi index 3cbe1d5c5ce2..c8ef5d53d97a 100644 --- a/numpy/core/fromnumeric.pyi +++ b/numpy/core/fromnumeric.pyi @@ -246,6 +246,7 @@ def all( axis: None = ..., out: None = ..., keepdims: Literal[False] = ..., + where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload def all( @@ -253,6 +254,7 @@ def all( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload @@ -261,6 +263,7 @@ def any( axis: None = ..., out: None = ..., keepdims: Literal[False] = ..., + where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload def any( @@ -268,6 +271,7 @@ def any( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + where: _ArrayLikeBool_co = ..., ) -> Any: ... def cumsum( @@ -342,6 +346,7 @@ def mean( dtype: DTypeLike = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + where: _ArrayLikeBool_co = ..., ) -> Any: ... def std( @@ -351,6 +356,7 @@ def std( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., + where: _ArrayLikeBool_co = ..., ) -> Any: ... def var( @@ -360,4 +366,5 @@ def var( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., + where: _ArrayLikeBool_co = ..., ) -> Any: ... From 71bd34192e9c259ec4ff72061ee9f98ba4544607 Mon Sep 17 00:00:00 2001 From: Janus Date: Fri, 28 Jan 2022 08:12:47 +0100 Subject: [PATCH 2/4] Update numpy/core/fromnumeric.pyi Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> --- numpy/core/fromnumeric.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/numpy/core/fromnumeric.pyi b/numpy/core/fromnumeric.pyi index c8ef5d53d97a..0f0c0e8dd70e 100644 --- a/numpy/core/fromnumeric.pyi +++ b/numpy/core/fromnumeric.pyi @@ -246,6 +246,7 @@ def all( axis: None = ..., out: None = ..., keepdims: Literal[False] = ..., + *, where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload From 1e1739f467724a6891c896fd4ef0c5b613cd4e60 Mon Sep 17 00:00:00 2001 From: Janus Heide Date: Fri, 28 Jan 2022 09:01:01 +0100 Subject: [PATCH 3/4] consistency between keyword only where arguments --- numpy/core/fromnumeric.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/numpy/core/fromnumeric.pyi b/numpy/core/fromnumeric.pyi index 0f0c0e8dd70e..4a5e50503fe0 100644 --- a/numpy/core/fromnumeric.pyi +++ b/numpy/core/fromnumeric.pyi @@ -255,6 +255,7 @@ def all( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + *, where: _ArrayLikeBool_co = ..., ) -> Any: ... @@ -264,6 +265,7 @@ def any( axis: None = ..., out: None = ..., keepdims: Literal[False] = ..., + *, where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload @@ -272,6 +274,7 @@ def any( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + *, where: _ArrayLikeBool_co = ..., ) -> Any: ... @@ -347,6 +350,7 @@ def mean( dtype: DTypeLike = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., + *, where: _ArrayLikeBool_co = ..., ) -> Any: ... @@ -357,6 +361,7 @@ def std( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., + *, where: _ArrayLikeBool_co = ..., ) -> Any: ... @@ -367,5 +372,6 @@ def var( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., + *, where: _ArrayLikeBool_co = ..., ) -> Any: ... From b48b73b427d0926736bac62fac27d519df4c25d9 Mon Sep 17 00:00:00 2001 From: Janus Heide Date: Fri, 28 Jan 2022 09:06:13 +0100 Subject: [PATCH 4/4] added where typehints to __init__.pyi --- numpy/__init__.pyi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index c6f59c4ca716..0684f477c716 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -1030,6 +1030,8 @@ class _ArrayOrScalarCommon: axis: None = ..., out: None = ..., keepdims: L[False] = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload def all( @@ -1037,6 +1039,8 @@ class _ArrayOrScalarCommon: axis: Optional[_ShapeLike] = ..., out: None = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload def all( @@ -1044,6 +1048,8 @@ class _ArrayOrScalarCommon: axis: Optional[_ShapeLike] = ..., out: _NdArraySubClass = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> _NdArraySubClass: ... @overload @@ -1052,6 +1058,8 @@ class _ArrayOrScalarCommon: axis: None = ..., out: None = ..., keepdims: L[False] = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> bool_: ... @overload def any( @@ -1059,6 +1067,8 @@ class _ArrayOrScalarCommon: axis: Optional[_ShapeLike] = ..., out: None = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload def any( @@ -1066,6 +1076,8 @@ class _ArrayOrScalarCommon: axis: Optional[_ShapeLike] = ..., out: _NdArraySubClass = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> _NdArraySubClass: ... @overload @@ -1248,6 +1260,8 @@ class _ArrayOrScalarCommon: dtype: DTypeLike = ..., out: None = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload def mean( @@ -1256,6 +1270,8 @@ class _ArrayOrScalarCommon: dtype: DTypeLike = ..., out: _NdArraySubClass = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> _NdArraySubClass: ... @overload @@ -1339,6 +1355,8 @@ class _ArrayOrScalarCommon: out: None = ..., ddof: int = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload def std( @@ -1348,6 +1366,8 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., ddof: int = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> _NdArraySubClass: ... @overload @@ -1379,6 +1399,8 @@ class _ArrayOrScalarCommon: out: None = ..., ddof: int = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> Any: ... @overload def var( @@ -1388,6 +1410,8 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., ddof: int = ..., keepdims: bool = ..., + *, + where: _ArrayLikeBool_co = ..., ) -> _NdArraySubClass: ... _DType = TypeVar("_DType", bound=dtype[Any])