Repository navigation
Improve abc module and builtin function decorators (without ParamSpec) - #5703
Conversation
* Make classmethod and staticmethod generic. * abstractclassmethod and abstractstaticmethod are classes, not functions. * Remove mypy-specific comments.
This comment has been minimized.
This comment has been minimized.
|
@rchen152 Do you know what the problem here is? Is |
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This comment has been minimized.
This comment has been minimized.
|
@srittau We probably just need to copy the changes to builtins.pyi to pytype/stubs/. I'll give that a try. |
|
@rchen152 Please don't change anything permanent for now, though. We are still figuring out whether this PR is the best course of action. |
|
I finally got around to testing out making classmethod and staticmethod generic in pytype (google/pytype@6ca00db). And yep, once I do that, pytype_test passes on this PR. So if you do decide to go with this, the pytype_test fix should be pretty straightforward. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Import Callable from collections.abc
This comment has been minimized.
This comment has been minimized.
|
Looking at the primer output:
|
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
Marking as ready to review again. @rchen152: Could you make the necessary changes to pytype? |
Will do! Hopefully I'll be able to make this change and release it this week; either way, I'll update in a couple days. |
We need to make classmethod and staticmethod generic to unblock python/typeshed#5703. Running pytype over that PR also exposes a circular dependency bug involving star imports, which I've fixed. PiperOrigin-RevId: 420213268
|
Alright, pytype-2022.1.7 contains the necessary changes for pytype_test to play nicely with this PR. |
This comment has been minimized.
This comment has been minimized.
|
Looks good now. |
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
2 similar comments
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
AlexWaygood
left a comment
There was a problem hiding this comment.
Looks like these comments were accidentally added back in the merge as well
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
|
Diff from mypy_primer, showing the effect of this PR on open source code: freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/data/history/jsondatahandler.py:26: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:38: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/jsondatahandler.py:126: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:24: error: Signature of "ohlcv_get_available_data" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:36: error: Signature of "ohlcv_get_pairs" incompatible with supertype "IDataHandler"
+ freqtrade/data/history/hdf5datahandler.py:111: error: Signature of "trades_get_pairs" incompatible with supertype "IDataHandler"
|
functions.