Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT, TYP: Added missing where typehints in fromnumeric.pyi #20936

Merged
merged 4 commits into from Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions numpy/__init__.pyi
Expand Up @@ -1030,20 +1030,26 @@ class _ArrayOrScalarCommon:
axis: None = ...,
out: None = ...,
keepdims: L[False] = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> bool_: ...
@overload
def all(
self,
axis: Optional[_ShapeLike] = ...,
out: None = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...
@overload
def all(
self,
axis: Optional[_ShapeLike] = ...,
out: _NdArraySubClass = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> _NdArraySubClass: ...

@overload
Expand All @@ -1052,20 +1058,26 @@ class _ArrayOrScalarCommon:
axis: None = ...,
out: None = ...,
keepdims: L[False] = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> bool_: ...
@overload
def any(
self,
axis: Optional[_ShapeLike] = ...,
out: None = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...
@overload
def any(
self,
axis: Optional[_ShapeLike] = ...,
out: _NdArraySubClass = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> _NdArraySubClass: ...

@overload
Expand Down Expand Up @@ -1248,6 +1260,8 @@ class _ArrayOrScalarCommon:
dtype: DTypeLike = ...,
out: None = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...
@overload
def mean(
Expand All @@ -1256,6 +1270,8 @@ class _ArrayOrScalarCommon:
dtype: DTypeLike = ...,
out: _NdArraySubClass = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> _NdArraySubClass: ...

@overload
Expand Down Expand Up @@ -1339,6 +1355,8 @@ class _ArrayOrScalarCommon:
out: None = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...
@overload
def std(
Expand All @@ -1348,6 +1366,8 @@ class _ArrayOrScalarCommon:
out: _NdArraySubClass = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> _NdArraySubClass: ...

@overload
Expand Down Expand Up @@ -1379,6 +1399,8 @@ class _ArrayOrScalarCommon:
out: None = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...
@overload
def var(
Expand All @@ -1388,6 +1410,8 @@ class _ArrayOrScalarCommon:
out: _NdArraySubClass = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> _NdArraySubClass: ...

_DType = TypeVar("_DType", bound=dtype[Any])
Expand Down
14 changes: 14 additions & 0 deletions numpy/core/fromnumeric.pyi
Expand Up @@ -246,13 +246,17 @@ def all(
axis: None = ...,
out: None = ...,
keepdims: Literal[False] = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> bool_: ...
@overload
def all(
a: ArrayLike,
axis: Optional[_ShapeLike] = ...,
out: Optional[ndarray] = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...

@overload
Expand All @@ -261,13 +265,17 @@ def any(
axis: None = ...,
out: None = ...,
keepdims: Literal[False] = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> bool_: ...
@overload
def any(
a: ArrayLike,
axis: Optional[_ShapeLike] = ...,
out: Optional[ndarray] = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...

def cumsum(
Expand Down Expand Up @@ -342,6 +350,8 @@ def mean(
dtype: DTypeLike = ...,
out: Optional[ndarray] = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...

def std(
Expand All @@ -351,6 +361,8 @@ def std(
out: Optional[ndarray] = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...

def var(
Expand All @@ -360,4 +372,6 @@ def var(
out: Optional[ndarray] = ...,
ddof: int = ...,
keepdims: bool = ...,
*,
where: _ArrayLikeBool_co = ...,
) -> Any: ...