diff options
Diffstat (limited to 'sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py')
-rw-r--r-- | sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py | 64 |
1 files changed, 16 insertions, 48 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index d77d34f97..0571b11bd 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. @@ -197,7 +158,7 @@ class _Parameterized(object): class ResultVariable(_Parameterized): pass -# Mark the primitive variables to become Sequence, Iterator or List +# Mark the primitive variables to become Sequence, Iterable or List # (decided in the parser). class ArrayLikeVariable(_Parameterized): pass @@ -264,8 +225,9 @@ type_map = {} namespace = globals() # our module's __dict__ type_map.update({ + "...": ellipsis, "bool": bool, - "char": Char, + "char": int, "char*": str, "char*const": str, "double": float, @@ -277,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, @@ -304,7 +266,7 @@ type_map.update({ "QVector": typing.List, "real": float, "short": int, - "signed char": Char, + "signed char": int, "signed long": int, "std.list": typing.List, "std.map": typing.Dict, @@ -313,12 +275,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 @@ -326,6 +288,7 @@ type_map.update({ "unsigned long": int, "unsigned short int": int, # 5.6, RHEL 6.6 "unsigned short": int, + "Unspecified": None, "ushort": int, "void": int, # be more specific? "WId": WId, @@ -346,6 +309,7 @@ type_map.update({ "array GLuint*" : ArrayLikeVariable(int), "array int*" : ArrayLikeVariable(int), "array long long*" : ArrayLikeVariable(int), + "array long*" : ArrayLikeVariable(int), "array short*" : ArrayLikeVariable(int), "array signed char*" : bytes, "array unsigned char*" : bytes, @@ -402,7 +366,7 @@ def init_minimal(): def init_sample(): import datetime type_map.update({ - "char": Char, + "char": int, "char**": typing.List[str], "Complex": complex, "double": float, @@ -415,7 +379,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, @@ -424,7 +388,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, @@ -486,6 +450,10 @@ def init_PySide2_QtCore(): PySide2.QtCore.QCborStringResultByteArray, "PySide2.QtCore.QCborStreamReader.StringResult[QString]": PySide2.QtCore.QCborStringResultString, + "PySide2.QtCore.QCborStreamReader.QCborStringResultByteArray": + PySide2.QtCore.QCborStringResultByteArray, # 5.14, why? + "PySide2.QtCore.QCborStreamReader.QCborStringResultString": + PySide2.QtCore.QCborStringResultString, # 5.14, why? "PySide2.QtCore.QUrl.ComponentFormattingOptions": PySide2.QtCore.QUrl.ComponentFormattingOption, # mismatch option/enum, why??? "PyUnicode": typing.Text, |