aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-01-21 13:09:52 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-22 11:38:23 +0000
commitcc7504e0b9090f9d0782ef27a9a8ce74fc5df552 (patch)
tree2d902131c984324560ba9e8cbd429dd7a199dd8e /sources/pyside6/PySide6
parentfadc307586f2f762bb9d0907d2f458b39c5b5770 (diff)
signature: Provide fixes and improvements, Part 1
The signature module is modified again to be more correct when using the mypy application. This part splits some changes which occurred when working on Shiboken.Enum inheritance. There will be a number of follow-ups: - signatures for all shiboken types - test cases for signatures - signature support for different __feature__ selections Change-Id: Ifb0d92bf7641f2909ab950e3458b3c3c68c20dad Task-number: PYSIDE-510 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 123e27090e0ec4f8d32f301700c9ff9d1b49ba2a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources/pyside6/PySide6')
-rw-r--r--sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp6
-rw-r--r--sources/pyside6/PySide6/support/generate_pyi.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp
index 32be83334..29fd8be77 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp
+++ b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp
@@ -616,13 +616,13 @@ PyTypeObject *QtQml_VolatileBoolTypeF(void)
}
static const char *PropertyList_SignatureStrings[] = {
- "PySide6.QtQml.ListProperty(type:type,append:typing.Callable,"
+ "PySide6.QtQml.ListProperty(self,type:type,append:typing.Callable,"
"at:typing.Callable=None,clear:typing.Callable=None,count:typing.Callable=None)",
nullptr}; // Sentinel
static const char *VolatileBool_SignatureStrings[] = {
- "PySide6.QtQml.VolatileBool.get()->bool",
- "PySide6.QtQml.VolatileBool.set(a:object)",
+ "PySide6.QtQml.VolatileBool.get(self)->bool",
+ "PySide6.QtQml.VolatileBool.set(self,a:object)",
nullptr}; // Sentinel
void PySide::initQmlSupport(PyObject *module)
diff --git a/sources/pyside6/PySide6/support/generate_pyi.py b/sources/pyside6/PySide6/support/generate_pyi.py
index 627e8efc1..32f43d804 100644
--- a/sources/pyside6/PySide6/support/generate_pyi.py
+++ b/sources/pyside6/PySide6/support/generate_pyi.py
@@ -128,6 +128,7 @@ class Formatter(Writer):
self.optional_replacer = optional_replacer
# self.level is maintained by enum_sig.py
# self.after_enum() is a one-shot set by enum_sig.py .
+ # self.is_method() is true for non-plain functions.
@contextmanager
def module(self, mod_name):
@@ -184,7 +185,7 @@ class Formatter(Writer):
yield key
def _function(self, func_name, signature, spaces):
- if "self" not in tuple(signature.parameters.keys()):
+ if self.is_method() and "self" not in tuple(signature.parameters.keys()):
self.print(f'{spaces}@staticmethod')
signature = self.optional_replacer(signature)
self.print(f'{spaces}def {func_name}{signature}: ...')