-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Do not narrow types to Never with binder #18972
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 open source code: pandas (https://github.com/pandas-dev/pandas)
- pandas/io/formats/style.py:1903: error: "Never" has no attribute "shape" [attr-defined]
- pandas/io/formats/style.py:1906: error: "Never" has no attribute "shape" [attr-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/dataframe_util.py: note: In function "convert_anything_to_list":
+ lib/streamlit/dataframe_util.py:927:17: error: List item 0 has incompatible type "Union[str, int, float]"; expected "V_co" [list-item]
static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/frame.py:5610: error: Unused "type: ignore" comment [unused-ignore]
spark (https://github.com/apache/spark)
+ python/pyspark/core/context.py:837: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/core/context.py:838: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/ml/connect/readwrite.py:98: error: Redundant cast to "JavaEstimator[Any]" [redundant-cast]
+ python/pyspark/ml/connect/readwrite.py:101: error: Redundant cast to "JavaEvaluator" [redundant-cast]
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/parsing.py:588: error: "Never" has no attribute "__iter__" (not iterable) [attr-defined]
- tanjun/dependencies/limiters.py:851: error: "Never" has no attribute "unlock" [attr-defined]
|
This impacts several existing issues: sterliakov/mypy-issues#27 |
Hm, interesting... As I said, it is gray area, but IMO most of the impact looks positive, I will however take a closer look later today or tomorrow. |
OK, I went through @JukkaL unless you have objections, I am going to merge this soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the new behavior seems better.
Fixes #18967
Fixes #16494
Fixes #15793
Fixes #12949
As you can see from updated test cases, it is kind of gray area, so whether we go this way will depend on the
mypy_primer
results (and also potentially on Dropbox internal code bases, where the above issue may cause problems).