Details
Description
The NoneType in QtWidgets.pyi cannot be resolved by type checker like pyright
Example:
action_testme = QtGui.QAction("TestMe", self) menu.addAction(action_testme)
Type check error is:
Type of "addAction" is partially unknown Type of "addAction" is "Overload[(action: QAction) -> None, (arg__1: QIcon | QPixmap, text: str, arg__3: object, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int | Unknown = ...) -> None, (icon: QIcon | QPixmap, text: str) -> QAction, (icon: QIcon | QPixmap, text: str, callable: object) -> QAction, (icon: QIcon | QPixmap, text: str, receiver: QObject, member: bytes, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (icon: QIcon | QPixmap, text: str, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, callable: object) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (text: str) -> QAction, (text: str, arg__2: object, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int | Unknown = ...) -> None, (text: str, callable: object) -> QAction, (text: str, receiver: QObject, member: bytes, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (text: str, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, callable: object) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction]"
This can be fixed by adding this import to QtWidgets.pyi
from types import NoneType
Attachments
Issue Links
- resulted in
-
PYSIDE-2284 NoneType is an Unknown import
- Closed
For Gerrit Dashboard: PYSIDE-2278 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
470814,3 | Type hints: Fix checks for None with pyright | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
470865,2 | Type hints: Fix checks for None with pyright | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
471481,4 | Type hints: Fix missing NoneType import | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
471645,2 | Type hints: Fix missing NoneType import | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
555365,4 | Fix missing NoneType import, amended | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
556314,2 | Fix missing NoneType import, amended | 6.7 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
556429,2 | Fix missing NoneType import, amended | tqtc/lts-6.5 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |