TYP: Better ndarray
binop return types for float64
& ``complex128"
#28112
+455
−231
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.
Backport of #28108 and #28089.
This improved the return types of the following
numpy.ndarray
methods:__[r]add__
__[r]sub__
__[r]mul__
__[r]matmul__
__[r]truediv__
__[r]floordiv__
__[r]mod__
__[r]divmod__
__[r]pow__
Closes #20099 (not sure why, but a win is a win 🤷🏻)
Closes #22631
Closes #27957
Closes #27965
Closes #28071
Towards #28076 (I'm guessing that this fixes something between 75%~95% of the possible 2.2.0 typing issues)
MAINT: bump mypy to 1.14.1
Some type-tests needed to be refined because mypy now supports generic
slice
types.The updated bundled typeshed was causing
memoryview[int]
to not be accepted anymore bynpt.ArrayLike
onpython<3.12
. This was also the case with pyright. I solved this by backportingcollections.abc.Buffer
onpython<3.12
, and included it in thenumpy.typing.ArrayLike
type alias, making it equivalent to itspython>=3.12
variant (from a static typing perspective).1.14.1
release notes