Fix None datetime being type hinted as invalid

This commit is contained in:
Lonami Exo 2017-09-23 20:07:40 +02:00
parent 0f10e1419f
commit 1593a4415e

View File

@ -249,13 +249,13 @@ class TLArg:
'int': 'int', 'int': 'int',
'long': 'int', 'long': 'int',
'string': 'str', 'string': 'str',
'date': 'datetime.datetime', 'date': 'datetime.datetime | None', # None date = 0 timestamp
'bytes': 'bytes', 'bytes': 'bytes',
'true': 'bool', 'true': 'bool',
}.get(self.type, 'TLObject') }.get(self.type, 'TLObject')
if self.is_vector: if self.is_vector:
result = 'list[{}]'.format(result) result = 'list[{}]'.format(result)
if self.is_flag: if self.is_flag and self.type != 'date':
result += ' | None' result += ' | None'
return result return result