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