-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
TYP: fix method declarations in floating, timedelta64, and datetime64
#29733
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
Conversation
|
Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code: 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]
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]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_libs/tslibs/timestamps.pyi:182: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:192: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:202: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timestamps.pyi:212: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:356: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:367: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:378: error: Unused "type: ignore" comment [unused-ignore]
+ pandas-stubs/_libs/tslibs/timedeltas.pyi:389: error: Unused "type: ignore" comment [unused-ignore]
|
|
I like the mypy_primer diffs. For freqtrade it's safe to ignore, because it's just showing that the reported error code changed for a single line. Footnotes
|
|
Thanks Joren. |
Follow-up of #29695 and #29706, resolving python/mypy#15993 (comment)