diff options
| author | Christian Tismer <tismer@stackless.com> | 2024-09-07 16:23:11 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2024-09-10 06:28:14 +0000 |
| commit | ffea69fcf1a158213feed2a3ce049b78c49f4aa5 (patch) | |
| tree | 4455466130cf3fd72523adc94aa31ddecfb29a8f /sources | |
| parent | bb8ff9b742a662d84c09073bbf0e670330467993 (diff) | |
type hints: Fix some more exotic problems
* QtStateMachine had the wrong return type in __init__ since
a very long time (2010).
* __dir__ has always the wrong annotation. Correction is needed
because it inherits __dir__ from object.
* the comment "#type:" is now reserved for mypy
Errors before: 350
Errors after: 333
Task-number: PYSIDE-2846
Change-Id: I26c4a931ec9b612f15f173e559d0306dc36b3c32
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
3 files changed, 7 insertions, 2 deletions
diff --git a/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml b/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml index 0e29f240f..4b1e5c695 100644 --- a/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml +++ b/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml @@ -108,7 +108,7 @@ s1.addTransition(button.clicked, s1h)</code> </object-type> <object-type name="QSignalTransition"> - <add-function signature="QSignalTransition(PyObject*,QState*)" return-type="QSignalTransition*"> + <add-function signature="QSignalTransition(PyObject*,QState*)"> <modify-argument index="2"> <replace-default-expression with="0"/> </modify-argument> diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py index 15996f713..5c95e72e3 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py @@ -15,6 +15,7 @@ by producing a lot of clarity. import inspect import sys import types +import typing from shibokensupport.signature import get_signature as get_sig from enum import Enum @@ -237,6 +238,9 @@ class ExactEnumerator(object): if decorator in self.collision_track: decorator = f"builtins.{decorator}" signature = self.get_signature(func, decorator) + # PYSIDE-2846: Special cases of signatures which inherit from object. + if func_name == "__dir__": + signature = inspect.Signature([], return_annotation=typing.Iterable[str]) if signature is not None: with self.fmt.function(func_name, signature, decorator) as key: ret[key] = signature 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 e51a9cb6b..ff9f48861 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 @@ -199,7 +199,8 @@ class Formatter(Writer): @contextmanager def attribute(self, attr_name, attr_value): spaces = indent * self.level - self.print(f"{spaces}{attr_name:25} = ... # type: {type(attr_value).__qualname__}") + # PYSIDE-2846: The comment "# type:" is reserved for mypy. + self.print(f"{spaces}{attr_name:25} = ... ## type: {type(attr_value).__qualname__}") yield @contextmanager |
