Repository navigation
fix: skip missing-super-call checks in TYPE_CHECKING blocks - #5180
Aayushyaash wants to merge 2 commits into
Conversation
|
This pull request has been imported. If you are a Meta employee, you can view this in D124393475. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
f34a2a8 to
5e3acd7
Compare
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +1 new errors, -39 fixed errors
By preset: +0/-0 (default), +0/-0 (strict)
Projects with changes (7):
pip: +0 -1
steam.py: +1 -0
bokeh: +0 -33
urllib3: +0 -1
mongo-python-driver: +0 -1
PyWinCtl: +0 -2
discord.py: +0 -1
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
pip (https://github.com/pypa/pip)
- ERROR src/pip/_vendor/urllib3/_base_connection.py:142:13-21: Method `BaseHTTPSConnection.__init__` does not call the method of the same name in a parent class [missing-super-call]
steam.py (https://github.com/Gobot1234/steam.py)
+ ERROR steam/reaction.py:170:24-38: Unused `# type: ignore` comment [unused-type-ignore]
bokeh (https://github.com/bokeh/bokeh)
- ERROR src/bokeh/models/annotations/geometry.py:87:13-21: Method `AreaVisuals.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/annotations/geometry.py:119:13-21: Method `BoxInteractionHandles.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/callbacks.py:105:13-21: Method `CustomJS.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/expressions.py:246:13-21: Method `XComponent.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/expressions.py:253:13-21: Method `YComponent.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/filters.py:84:13-21: Method `InversionFilter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/filters.py:102:13-21: Method `IntersectionFilter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/filters.py:108:13-21: Method `UnionFilter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/filters.py:114:13-21: Method `DifferenceFilter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/filters.py:120:13-21: Method `SymmetricDifferenceFilter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/formatters.py:735:13-21: Method `DatetimeTickFormatter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/formatters.py:881:13-21: Method `TimedeltaTickFormatter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/graphs.py:117:13-21: Method `NodeCoordinates.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/graphs.py:127:13-21: Method `EdgeCoordinates.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/graphs.py:134:13-21: Method `EdgePointCoordinates.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/layouts.py:524:13-21: Method `TabPanel.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/nodes.py:165:13-21: Method `Node.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tickers.py:201:13-21: Method `AdaptiveTicker.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tickers.py:261:13-21: Method `DaysTicker.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tickers.py:275:13-21: Method `MonthsTicker.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:423:13-21: Method `PanTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:438:13-21: Method `ClickPanTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:564:13-21: Method `WheelPanTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:618:13-21: Method `WheelZoomTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:856:13-21: Method `TapTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:952:13-21: Method `CrosshairTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:1056:13-21: Method `BoxZoomTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:1126:13-21: Method `ZoomInTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:1141:13-21: Method `ZoomOutTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:1168:13-21: Method `BoxSelectTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/tools.py:1416:13-21: Method `HoverTool.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/widgets/tables.py:575:13-21: Method `TableColumn.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/bokeh/models/widgets/tables.py:640:13-21: Method `DataTable.__init__` does not call the method of the same name in a parent class [missing-super-call]
urllib3 (https://github.com/urllib3/urllib3)
- ERROR src/urllib3/_base_connection.py:142:13-21: Method `BaseHTTPSConnection.__init__` does not call the method of the same name in a parent class [missing-super-call]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- ERROR bson/codec_options.py:257:13-20: Method `CodecOptions.__new__` does not call the method of the same name in a parent class [missing-super-call]
PyWinCtl (https://github.com/Kalmat/PyWinCtl)
- ERROR src/pywinctl/_pywinctl_win.py:348:17-25: Method `TITLEBARINFO.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/pywinctl/_pywinctl_win.py:427:13-21: Method `tagWINDOWINFO.__init__` does not call the method of the same name in a parent class [missing-super-call]
discord.py (https://github.com/Rapptz/discord.py)
- ERROR discord/ext/commands/bot.py:1541:13-21: Method `AutoShardedBot.__init__` does not call the method of the same name in a parent class [missing-super-call] |
|
While investigating this, I noticed that
I’ve left these cases out of this PR to keep the change focused on #5136 ( |
Summary
Methods defined inside
if TYPE_CHECKING:blocks are type-checking declarations rather than runtime implementations. Requiring an explicitsuper()call in these methods can result in false-positivemissing-super-callerrors.Previously,
check_missing_super_call_for_field()skipped this check for.pyiinterface stub files but did not account for methods insideTYPE_CHECKINGblocks.This PR updates the check to skip methods whose
toplevel_func_metadata()hasflags.is_in_type_checking_blockset.Fixes #5136
Test Plan
Added a regression test in
pyrefly/lib/test/class_overrides.rsfor a method inside aTYPE_CHECKINGblock that should not report amissing-super-callerror.Validation: