diff options
| author | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2024-10-22 13:34:17 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2024-10-22 15:03:46 +0200 |
| commit | d99a314f7cfe7a4572e90aa96e48a86cb4637360 (patch) | |
| tree | 67da07f0d0ca038a8a2be68b26a373e2c73b6194 | |
| parent | 22ee18a691816e9d5453913db9085eedb6d2dee5 (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.
Pick-to: 6.8 6.8.0
Task-number: PYSIDE-2846
Fixes: PYSIDE-2903
Change-Id: I2251878123924082de7aea19f31f45a95ffac178
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| -rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py | 5 |
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 3ca92f47a..c72946f7c 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 @@ -203,8 +203,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 |
