Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.4.3
-
None
Description
Type checker like pyright return an error on function taking an os.PathLike argument
QtCore.QUrl.fromLocalFile("/tmp/testme") => Type of "fromLocalFile" is partially unknown Type of "fromLocalFile" is "(localfile: str | bytes | PathLike[Unknown]) -> QUrl"
This is because os.PathLike typing is defined with a generic class in typeshed
To fix the issue the Qt6 stubs should use os.PathLike[str].
Example in QtCore.pyi:
# replace this def fromLocalFile(localfile: Union[str, bytes, os.PathLike]) -> PySide6.QtCore.QUrl: ... # by this def fromLocalFile(localfile: Union[str, bytes, os.PathLike[str]]) -> PySide6.QtCore.QUrl: ...