diff options
| author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2023-08-03 14:47:22 +0200 |
|---|---|---|
| committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2024-03-26 06:55:54 +0000 |
| commit | 0e62a3d9903dd22391b769e0df0d37fdb9110d88 (patch) | |
| tree | ca604b50fefb536d9c77890dff7bc9d35236ecf9 | |
| parent | 46b6a610fddb32660e17fdb8d8f2242e0f283c96 (diff) | |
stubs: add type for os.PathLike type hints
Specifying 'str' for os.PathLike solves
the issues found with tools like pyright.
For example, for QUrl.fromLocalFile:
error: Type of "fromLocalFile" is partially unknown
Type of "fromLocalFile" is "(localfile: str | bytes | PathLike[Unknown]) -> QUrl" (reportUnknownMemberType)
Using the string of the annotation to avoid an issue
when Python tries to evaluate it at Runtime (see mypy issue #5667)
Fixes: PYSIDE-2280
Pick-to: 6.7
Change-Id: Ib63bfe8636fbf6cbf1e393d29ef3caf9af0fb4c7
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
| -rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 3b550b478..944a928e6 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -212,9 +212,9 @@ type_map.update({ "PyCallable": typing.Callable, "PyObject": object, "PyObject*": object, - "PyArrayObject": ArrayLikeVariable, # numpy - "PyPathLike": typing.Union[str, bytes, os.PathLike], - "PySequence": typing.Iterable, # important for numpy + "PyArrayObject": ArrayLikeVariable, # numpy + "PyPathLike": typing.Union[str, bytes, os.PathLike[str]], + "PySequence": typing.Iterable, # important for numpy "PyTypeObject": type, "QChar": str, "QHash": typing.Dict, |
