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

TYP,MAINT: Change more overloads to play nice with pyright #22389

Merged
merged 1 commit into from Oct 6, 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
6 changes: 6 additions & 0 deletions numpy/__init__.pyi
Expand Up @@ -35,6 +35,8 @@ from numpy._typing import (
_ArrayLikeObject_co,
_ArrayLikeStr_co,
_ArrayLikeBytes_co,
_ArrayLikeUnknown,
_UnknownType,

# DTypes
DTypeLike,
Expand Down Expand Up @@ -2047,6 +2049,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __radd__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...

@overload
def __sub__(self: NDArray[_UnknownType], other: _ArrayLikeUnknown) -> NDArray[Any]: ...
@overload
def __sub__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NoReturn: ...
@overload
Expand All @@ -2070,6 +2074,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __sub__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...

@overload
def __rsub__(self: NDArray[_UnknownType], other: _ArrayLikeUnknown) -> NDArray[Any]: ...
@overload
def __rsub__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NoReturn: ...
@overload
Expand Down
1 change: 1 addition & 0 deletions numpy/_typing/__init__.py
Expand Up @@ -199,6 +199,7 @@ class _8Bit(_16Bit): # type: ignore[misc]
_ArrayLikeStr_co as _ArrayLikeStr_co,
_ArrayLikeBytes_co as _ArrayLikeBytes_co,
_ArrayLikeUnknown as _ArrayLikeUnknown,
_UnknownType as _UnknownType,
)
from ._generic_alias import (
NDArray as NDArray,
Expand Down