Update code generator to emit type hints on init methods

This commit is contained in:
Lonami Exo
2019-05-02 10:19:15 +02:00
parent 3a1496c205
commit fce5cfea0e
3 changed files with 11 additions and 16 deletions

View File

@@ -97,7 +97,7 @@ def parse_tl(file_path, layer, methods=None, ignored_ids=CORE_TYPES):
if not line:
continue
match = re.match('---(\w+)---', line)
match = re.match(r'---(\w+)---', line)
if match:
following_types = match.group(1)
is_function = following_types == 'functions'

View File

@@ -174,7 +174,7 @@ class TLArg:
'date': 'Optional[datetime]', # None date = 0 timestamp
'bytes': 'bytes',
'true': 'bool',
}.get(cls, "Type{}".format(cls))
}.get(cls, "'Type{}'".format(cls))
if self.is_vector:
result = 'List[{}]'.format(result)
if self.is_flag and cls != 'date':