TYP: fix method declarations in floating, timedelta64, and datetime64Backport#29791
Merged
charris merged 2 commits intonumpy:maintenance/2.3.xfrom Sep 23, 2025
Merged
TYP: fix method declarations in floating, timedelta64, and datetime64Backport#29791charris merged 2 commits intonumpy:maintenance/2.3.xfrom
charris merged 2 commits intonumpy:maintenance/2.3.xfrom
Conversation
|
Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code: scipy-stubs (https://github.com/scipy/scipy-stubs)
+ scipy-stubs/signal/_ltisys.pyi:388: error: Unused "type: ignore" comment [unused-ignore]
+ scipy-stubs/signal/_ltisys.pyi:389: error: Unused "type: ignore" comment [unused-ignore]
+ scipy-stubs/signal/_ltisys.pyi:390: error: Unused "type: ignore" comment [unused-ignore]
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "str" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__rsub__" of "floating" matches argument type "str" [operator]
+ freqtrade/data/converter/orderflow.py:175: note: def __rsub__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool], /) -> floating[Any]
+ freqtrade/data/converter/orderflow.py:175: note: def __rsub__(self, integer[Any] | floating[Any], /) -> floating[Any]
- freqtrade/data/converter/orderflow.py:175: note: def __call__(self, int, /) -> floating[Any]
+ freqtrade/data/converter/orderflow.py:175: note: def __rsub__(self, float, /) -> floating[Any]
- freqtrade/data/converter/orderflow.py:175: note: def __call__(self, float, /) -> floating[Any] | float64
- freqtrade/data/converter/orderflow.py:175: note: def __call__(self, complex, /) -> complexfloating[Any, Any] | complex128
+ freqtrade/data/converter/orderflow.py:175: note: def __rsub__(self, complex, /) -> complexfloating[Any, Any]
- freqtrade/data/converter/orderflow.py:175: note: def [_NBit2: NBitBase] __call__(self, integer[_NBit2] | floating[_NBit2], /) -> floating[Any] | floating[_NBit2]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "bytes" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__rsub__" of "floating" matches argument type "bytes" [operator]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "str" [operator]
+ freqtrade/data/converter/orderflow.py:175: note: def __sub__(self, int | floating[_16Bit] | unsignedinteger[_8Bit] | signedinteger[_8Bit] | numpy.bool[builtins.bool] | floating[Any], /) -> floating[Any]
+ freqtrade/data/converter/orderflow.py:175: note: def __sub__(self, integer[Any] | floating[Any], /) -> floating[Any]
+ freqtrade/data/converter/orderflow.py:175: note: def __sub__(self, float, /) -> floating[Any]
+ freqtrade/data/converter/orderflow.py:175: note: def __sub__(self, complex, /) -> complexfloating[Any, Any]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "bytes" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "date" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "date" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "datetime" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "datetime" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "timedelta" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "timedelta" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "datetime64[date | int | None]" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "datetime64[date | int | None]" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "timedelta64[timedelta | int | None]" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "timedelta64[timedelta | int | None]" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "Timestamp" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "Timestamp" [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__call__" of "_FloatOp" matches argument type "Timedelta" [call-overload]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "Timedelta" [operator]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_libs/tslibs/timestamps.pyi:181: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:191: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:201: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:211: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:353: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:364: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:375: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:386: error: Unused "type: ignore" comment [unused-ignore]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #29733.
Follow-up of #29695 and #29706, resolving python/mypy#15993 (comment)