GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TYP: Type ``MaskedArray.__{add,radd,sub,rsub}__`` by MarcoGorelli · Pull Request #29012 · numpy/numpy

TYP: Type MaskedArray.__{add,radd,sub,rsub}__ #29012

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.

Sign up for GitHub

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

Merged
jorenham merged 8 commits into numpy:main from MarcoGorelli:ma-arithmetic
May 28, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

TYP: Type MaskedArray.__{add,radd,sub,rsub}__ #29012

Changes from 1 commit
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
9bc7b74
TYP: Type ``MaskedArray.__{add,radd,sub,rsub}__``
MarcoGorelli May 20, 2025
02fbee2
Merge remote-tracking branch 'upstream/main' into ma-arithmetic
MarcoGorelli May 20, 2025
5889f5c
"in-sync" comment in test, copy comment in __radd__, use _AnyShape
MarcoGorelli May 20, 2025
d605c2f
noop
MarcoGorelli May 21, 2025
dd7293b
Merge remote-tracking branch 'upstream/main' into ma-arithmetic
MarcoGorelli May 22, 2025
93edb06
Merge remote-tracking branch 'upstream/main' into ma-arithmetic
MarcoGorelli May 27, 2025
3158d6a
keep in sync comments
MarcoGorelli May 28, 2025
c8bceae
Merge remote-tracking branch 'upstream/main' into ma-arithmetic
MarcoGorelli May 28, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
keep in sync comments
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@MarcoGorelli
MarcoGorelli committed May 28, 2025
commit 3158d6af44f20b0cfa809ad85a964994dd82c68d

There are no files selected for viewing

14 changes: 10 additions & 4 deletions 14 numpy/__init__.pyi
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __rdivmod__(self: NDArray[timedelta64], lhs: _ArrayLike[timedelta64], /) -> tuple[NDArray[int64], NDArray[timedelta64]]: ...

# Keep in sync with `MaskedArray.__add__`
@overload
def __add__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ...
@overload
Expand Down Expand Up @@ -2856,6 +2857,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __add__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ...

# Keep in sync with `MaskedArray.__radd__`
@overload # signature equivalent to __add__
def __radd__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ...
@overload
Expand Down Expand Up @@ -2903,6 +2905,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __radd__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ...

# Keep in sync with `MaskedArray.__sub__`
@overload
def __sub__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ...
@overload
Expand Down Expand Up @@ -2940,6 +2943,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __sub__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ...

# Keep in sync with `MaskedArray.__rsub__`
@overload
def __rsub__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ...
@overload
Expand Down Expand Up @@ -3359,6 +3363,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
# object and its value is >= 0
# NOTE: Due to a mypy bug, overloading on e.g. `self: NDArray[SCT_floating]` won't
# work, as this will lead to `false negatives` when using these inplace ops.
# Keep in sync with `MaskedArray.__iadd__`
@overload
def __iadd__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
@overload
Expand Down Expand Up @@ -3386,7 +3391,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __iadd__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...

#
# Keep in sync with `MaskedArray.__isub__`
@overload
def __isub__(
self: NDArray[unsignedinteger],
Expand All @@ -3404,7 +3409,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __isub__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...

#
# Keep in sync with `MaskedArray.__imul__`
@overload
def __imul__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
@overload
Expand All @@ -3426,6 +3431,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __imul__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...

# Keep in sync with `MaskedArray.__ipow__`
@overload
def __ipow__(
self: NDArray[unsignedinteger],
Expand All @@ -3441,15 +3447,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
@overload
def __ipow__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...

#
# Keep in sync with `MaskedArray.__itruediv__`
@overload
def __itruediv__(self: NDArray[floating | timedelta64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
@overload
def __itruediv__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
@overload
def __itruediv__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...

# keep in sync with `__imod__`
# keep in sync with `__imod__` and `MaskedArray.__ifloordiv__`
@overload
def __ifloordiv__(
self: NDArray[unsignedinteger],
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.