mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 12:10:21 +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)
|
ac = AUTO_CASTS.get(arg.type, None)
|
||||||
if not ac:
|
if not ac:
|
||||||
continue
|
continue
|
||||||
if arg.is_vector:
|
|
||||||
builder.write('self.{0} = [{1} for _x in self.{0}]',
|
if arg.is_flag:
|
||||||
arg.name, ac.format('_x'))
|
builder.writeln('if self.{}:', arg.name)
|
||||||
else:
|
|
||||||
builder.write('self.{} = {}', arg.name,
|
if not arg.is_vector:
|
||||||
|
builder.writeln('self.{} = {}', arg.name,
|
||||||
ac.format('self.' + arg.name))
|
ac.format('self.' + arg.name))
|
||||||
builder.writeln(' if self.{} else None'.format(arg.name)
|
else:
|
||||||
if arg.is_flag 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()
|
builder.end_block()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user