aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py')
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py82
1 files changed, 31 insertions, 51 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
index 2110ebe7a..6fadd19d5 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
@@ -73,45 +73,6 @@ NoneType = type(None)
_S = TypeVar("_S")
-# Building our own Char type, which is much nicer than
-# Char = typing.Union[str, int] # how do I model the limitation to 1 char?
-
-class _CharMeta(type):
- def __repr__(self):
- return '%s.%s' % (self.__module__, self.__name__)
-
-
-class Char(with_metaclass(_CharMeta)):
- """
- From http://doc.qt.io/qt-5/qchar.html :
-
- In Qt, Unicode characters are 16-bit entities without any markup or
- structure. This class represents such an entity. It is lightweight,
- so it can be used everywhere. Most compilers treat it like an
- unsigned short.
-
- Here, we provide a simple implementation just to avoid long aliases.
- """
- __module__ = "typing"
-
- def __init__(self, code):
- if isinstance(code, int):
- self.code = code & 0xffff
- else:
- self.code = ord(code)
-
- def __add__(self, other):
- return chr(self.code) + other
-
- def __radd__(self, other):
- return other + chr(self.code)
-
- def __repr__(self):
- return "typing.Char({})".format(self.code)
-
-typing.Char = Char
-
-
MultiMap = typing.DefaultDict[str, typing.List[str]]
# ulong_max is only 32 bit on windows.
@@ -266,7 +227,7 @@ namespace = globals() # our module's __dict__
type_map.update({
"...": ellipsis,
"bool": bool,
- "char": Char,
+ "char": int,
"char*": str,
"char*const": str,
"double": float,
@@ -278,7 +239,7 @@ type_map.update({
"PyObject": object,
"PySequence": typing.Iterable, # important for numpy
"PyTypeObject": type,
- "QChar": Char,
+ "QChar": str,
"QHash": typing.Dict,
"qint16": int,
"qint32": int,
@@ -303,9 +264,10 @@ type_map.update({
"qulonglong": int,
"QVariant": Variant,
"QVector": typing.List,
+ "QSharedPointer": typing.Tuple,
"real": float,
"short": int,
- "signed char": Char,
+ "signed char": int,
"signed long": int,
"std.list": typing.List,
"std.map": typing.Dict,
@@ -314,12 +276,12 @@ type_map.update({
"str": str,
"true": True,
"Tuple": typing.Tuple,
- "uchar": Char,
+ "uchar": int,
"uchar*": str,
"uint": int,
"ulong": int,
"ULONG_MAX": ulong_max,
- "unsigned char": Char, # 5.9
+ "unsigned char": int, # 5.9
"unsigned char*": str,
"unsigned int": int,
"unsigned long int": int, # 5.6, RHEL 6.6
@@ -384,6 +346,11 @@ type_map.update({
"QStringList*" : ResultVariable(StringList),
})
+# PYSIDE-1328: We need to handle "self" explicitly.
+type_map.update({
+ "self" : "self",
+ })
+
# The Shiboken Part
def init_Shiboken():
@@ -405,7 +372,7 @@ def init_minimal():
def init_sample():
import datetime
type_map.update({
- "char": Char,
+ "char": int,
"char**": typing.List[str],
"Complex": complex,
"double": float,
@@ -418,7 +385,7 @@ def init_sample():
"PStr": str,
"PyDate": datetime.date,
"sample.bool": bool,
- "sample.char": Char,
+ "sample.char": int,
"sample.double": float,
"sample.int": int,
"sample.ObjectType": object,
@@ -427,7 +394,7 @@ def init_sample():
"sample.Photon.TemplateBase[Photon.IdentityType]": sample.Photon.ValueIdentity,
"sample.Point": Point,
"sample.PStr": str,
- "sample.unsigned char": Char,
+ "sample.unsigned char": int,
"std.size_t": int,
"std.string": str,
"ZeroIn": 0,
@@ -477,6 +444,7 @@ def init_PySide2_QtCore():
"4294967295UL": 4294967295, # 5.6, RHEL 6.6
"CheckIndexOption.NoOption": Instance(
"PySide2.QtCore.QAbstractItemModel.CheckIndexOptions.NoOption"), # 5.11
+ "DescriptorType(-1)": int, # Native handle of QSocketDescriptor
"false": False,
"list of QAbstractAnimation": typing.List[PySide2.QtCore.QAbstractAnimation],
"list of QAbstractState": typing.List[PySide2.QtCore.QAbstractState],
@@ -485,10 +453,7 @@ def init_PySide2_QtCore():
"nullptr": None, # 5.9
"PyByteArray": bytearray,
"PyBytes": bytes,
- "PySide2.QtCore.QCborStreamReader.StringResult[PySide2.QtCore.QByteArray]":
- PySide2.QtCore.QCborStringResultByteArray,
- "PySide2.QtCore.QCborStreamReader.StringResult[QString]":
- PySide2.QtCore.QCborStringResultString,
+ "QDeadlineTimer(QDeadlineTimer.Forever)": Instance("PySide2.QtCore.QDeadlineTimer"),
"PySide2.QtCore.QUrl.ComponentFormattingOptions":
PySide2.QtCore.QUrl.ComponentFormattingOption, # mismatch option/enum, why???
"PyUnicode": typing.Text,
@@ -529,6 +494,16 @@ def init_PySide2_QtCore():
return locals()
+def init_PySide2_QtConcurrent():
+ type_map.update({
+ "PySide2.QtCore.QFuture[QString]":
+ PySide2.QtConcurrent.QFutureQString,
+ "PySide2.QtCore.QFuture[void]":
+ PySide2.QtConcurrent.QFutureVoid,
+ })
+ return locals()
+
+
def init_PySide2_QtGui():
from PySide2.QtGui import QPageLayout, QPageSize # 5.12 macOS
type_map.update({
@@ -575,10 +550,15 @@ def init_PySide2_QtSql():
def init_PySide2_QtNetwork():
+ from PySide2.QtNetwork import QNetworkRequest
best_structure = typing.OrderedDict if getattr(typing, "OrderedDict", None) else typing.Dict
type_map.update({
"QMultiMap[PySide2.QtNetwork.QSsl.AlternativeNameEntryType, QString]":
best_structure[PySide2.QtNetwork.QSsl.AlternativeNameEntryType, typing.List[str]],
+ "DefaultTransferTimeoutConstant":
+ QNetworkRequest.TransferTimeoutConstant,
+ "QNetworkRequest.DefaultTransferTimeoutConstant":
+ QNetworkRequest.TransferTimeoutConstant,
})
del best_structure
return locals()