aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2023-08-03 14:47:22 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-26 08:03:48 +0000
commit4ccf122a4bddc5f81cd5b4da76c55fe30960eda3 (patch)
tree0b455fb05914088771ac8c18821c41b6e1283d73
parent5a3d464bed72a5647eb7c1ff6f850838a0356cc2 (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 Change-Id: Ib63bfe8636fbf6cbf1e393d29ef3caf9af0fb4c7 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> (cherry picked from commit 0e62a3d9903dd22391b769e0df0d37fdb9110d88) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py6
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,