Skip to content

Commit

Permalink
Merge pull request #22389 from charris/backport-22359
Browse files Browse the repository at this point in the history
TYP,MAINT: Change more overloads to play nice with pyright
  • Loading branch information
charris committed Oct 6, 2022
2 parents bd936cc + 182e7c4 commit 5303507
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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

0 comments on commit 5303507

Please sign in to comment.