Use classes when type hinting primitives

This commit is contained in:
Lonami Exo 2019-05-02 19:12:11 +02:00
parent cb56c54351
commit 63ef7284f7
2 changed files with 4 additions and 2 deletions

View File

@ -120,8 +120,8 @@ def _write_modules(
for c in constructors)))
imports = {}
primitives = ('int', 'long', 'int128', 'int256', 'string',
'date', 'bytes', 'true')
primitives = {'int', 'long', 'int128', 'int256', 'double',
'string', 'date', 'bytes', 'Bool', 'true'}
# Find all the types in other files that are used in this file
# and generate the information required to import those types.
for t in tlobjects:

View File

@ -170,9 +170,11 @@ class TLArg:
'long': 'int',
'int128': 'int',
'int256': 'int',
'double': 'float',
'string': 'str',
'date': 'Optional[datetime]', # None date = 0 timestamp
'bytes': 'bytes',
'Bool': 'bool',
'true': 'bool',
}.get(cls, "'Type{}'".format(cls))
if self.is_vector: