aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2024-10-22 13:34:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-10-22 22:00:12 +0000
commit6bc526d4fe45d68674d4d52131d79ed35cd7df4a (patch)
tree51b49832979bba4f6024dc1af2f2e029e3bca0bb
parent61ff82cf91b2822ef8928004f199c610f88c7bc0 (diff)
type hints: Avoid double # for pyi type specification
This was a misunderstanding. Instead of invalidating the comment by "##", it should be fully qualified with module name because it gets really resolved. Task-number: PYSIDE-2846 Fixes: PYSIDE-2903 Change-Id: I2251878123924082de7aea19f31f45a95ffac178 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit d99a314f7cfe7a4572e90aa96e48a86cb4637360) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit a529e73270a46066f99edc6d080d8db3b8ea7d4f)
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
index 8d6879eb3..8a609e727 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
@@ -198,8 +198,9 @@ class Formatter(Writer):
@contextmanager
def attribute(self, attr_name, attr_value):
spaces = indent * self.level
- # PYSIDE-2846: The comment "# type:" is reserved for mypy.
- self.print(f"{spaces}{attr_name:25} = ... ## type: {type(attr_value).__qualname__}")
+ # PYSIDE-2903: Use a fully qualified name in the type comment.
+ full_name = f"{type(attr_value).__module__}.{type(attr_value).__qualname__}"
+ self.print(f"{spaces}{attr_name:25} = ... # type: {full_name}")
yield
@contextmanager