-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Narrowing for comparisons against x.__class__ #20642
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: beartype (https://github.com/beartype/beartype)
+ beartype/_util/hint/pep/utilpepsign.py:592: error: Unused "type: ignore" comment [unused-ignore]
black (https://github.com/psf/black)
+ src/blib2to3/pytree.py:84:9: error: Returning Any from function declared to return "bool" [no-any-return]
static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/util.py:2085: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2087: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2089: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2095: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2096: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2186: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/util.py:2188: error: Unused "type: ignore" comment [unused-ignore]
- static_frame/core/util.py:2307: error: "Hashable" has no attribute "start" [attr-defined]
- static_frame/core/util.py:2307: note: Error code "attr-defined" not covered by "type: ignore" comment
- static_frame/core/util.py:2309: error: "Hashable" has no attribute "stop" [attr-defined]
- static_frame/core/util.py:2309: note: Error code "attr-defined" not covered by "type: ignore" comment
- static_frame/core/util.py:2310: error: "Hashable" has no attribute "stop" [attr-defined]
- static_frame/core/util.py:2310: note: Error code "attr-defined" not covered by "type: ignore" comment
- static_frame/core/util.py:2311: error: "Hashable" has no attribute "step" [attr-defined]
- static_frame/core/util.py:2311: note: Error code "attr-defined" not covered by "type: ignore" comment
- static_frame/core/util.py:2312: error: "Hashable" has no attribute "step" [attr-defined]
- static_frame/core/util.py:2312: note: Error code "attr-defined" not covered by "type: ignore" comment
+ static_frame/core/loc_map.py:157: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/loc_map.py:169: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/loc_map.py:171: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/loc_map.py:174: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/loc_map.py:176: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/loc_map.py:177: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/node_fill_value.py:126: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/container_util.py:1065: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/container_util.py:1526: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/container_util.py:1528: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/container_util.py:1541: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:491: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:492: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:2368: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3343: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3347: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3348: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3351: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3352: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3356: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3358: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3361: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/type_blocks.py:3366: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:228: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:231: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:332: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:419: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:458: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:459: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:482: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:1031: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:1088: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index.py:1899: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index_hierarchy.py:492: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index_hierarchy.py:494: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index_hierarchy.py:567: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index_hierarchy.py:2177: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/index_auto.py:85: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/archive_npy.py:232: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/series.py:634: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/series.py:636: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/series.py:639: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/series.py:642: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/series.py:645: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:1304: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:1441: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:3491: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:3494: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:3497: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/frame.py:3499: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/bus.py:524: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/bus.py:526: error: Unused "type: ignore" comment [unused-ignore]
+ static_frame/core/bus.py:528: error: Unused "type: ignore" comment [unused-ignore]
|
|
The black case is covered by a test from #20603 |
|
|
||
| def bar(y: Any): | ||
| if y.__class__ == int: | ||
| reveal_type(y) # N: Revealed type is "Any" |
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 think this Any will actually get fixed by #20643
JukkaL
left a comment
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'm glad to see so many type ignores fixed! Thanks!
No description provided.