diff options
author | Christian Tismer <tismer@stackless.com> | 2018-09-23 10:04:14 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2018-10-11 11:31:26 +0000 |
commit | c6c9f057cddc0e0b885a648489264538eba0a158 (patch) | |
tree | c09dc15ad3948b4eef04d87e3b48d33d474f6c1b /sources/pyside2/PySide2/support/signature/loader.py | |
parent | 66615a89ef66c39d62a502df3eb1ff629aa39154 (diff) |
Implement Different Signature Layouts
With the extended signature API, it is now possible to create
different layouts, depending on the usecase.
The "layout" module defines the layouts which we will need
and also implements the variable signature generation.
Task-number: PYSIDE-510
Task-number: PYSIDE-795
Change-Id: I5b9f88d9feb92cc4c8dc0e212860b6eb4fc16484
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/support/signature/loader.py')
-rw-r--r-- | sources/pyside2/PySide2/support/signature/loader.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/sources/pyside2/PySide2/support/signature/loader.py b/sources/pyside2/PySide2/support/signature/loader.py index a055337bf..21ecebcc8 100644 --- a/sources/pyside2/PySide2/support/signature/loader.py +++ b/sources/pyside2/PySide2/support/signature/loader.py @@ -80,35 +80,10 @@ from PySide2.support.signature.parser import pyside_type_init sys.path.pop(0) # Note also that during the tests we have a different encoding that would # break the Python license decorated files without an encoding line. +from PySide2.support.signature import layout # name used in signature.cpp def create_signature(props, key): - if not props: - # empty signatures string - return - if isinstance(props["multi"], list): - return list(create_signature(elem, key) - for elem in props["multi"]) - if type(key) is tuple: - sig_kind, modifier = key - else: - sig_kind, modifier = key, None - varnames = props["varnames"] - if sig_kind == "method": - varnames = ("self",) + varnames - elif sig_kind == "staticmethod": - pass - elif sig_kind == "classmethod": - varnames = ("klass",) + varnames - else: - raise SystemError("Methods must be normal, staticmethod or " - "classmethod") - argstr = ", ".join(varnames) - fakefunc = eval("lambda {}: None".format(argstr)) - fakefunc.__name__ = props["name"] - fakefunc.__defaults__ = props["defaults"] - fakefunc.__kwdefaults__ = props["kwdefaults"] - fakefunc.__annotations__ = props["annotations"] - return inspect._signature_from_function(inspect.Signature, fakefunc) + return layout.create_signature(props, key) # end of file |