mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 04:00:18 +03:00
Fix unsupported async list comprehension in py3.5
This commit is contained in:
parent
52042d4a1b
commit
ae5a265ca1
|
@ -239,14 +239,25 @@ def _write_resolve(tlobject, builder):
|
|||
ac = AUTO_CASTS.get(arg.type, None)
|
||||
if not ac:
|
||||
continue
|
||||
if arg.is_vector:
|
||||
builder.write('self.{0} = [{1} for _x in self.{0}]',
|
||||
arg.name, ac.format('_x'))
|
||||
else:
|
||||
builder.write('self.{} = {}', arg.name,
|
||||
|
||||
if arg.is_flag:
|
||||
builder.writeln('if self.{}:', arg.name)
|
||||
|
||||
if not arg.is_vector:
|
||||
builder.writeln('self.{} = {}', arg.name,
|
||||
ac.format('self.' + arg.name))
|
||||
builder.writeln(' if self.{} else None'.format(arg.name)
|
||||
if arg.is_flag else '')
|
||||
else:
|
||||
# Since the auto-cast might have await, we can't use that in
|
||||
# Python 3.5's list comprehensions. Build the list manually.
|
||||
builder.writeln('_tmp = []')
|
||||
builder.writeln('for _x in self.{}:', arg.name)
|
||||
builder.writeln('_tmp.append({})', ac.format('_x'))
|
||||
builder.end_block()
|
||||
builder.writeln('self.{} = _tmp', arg.name)
|
||||
|
||||
if arg.is_flag:
|
||||
builder.end_block()
|
||||
|
||||
builder.end_block()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user