asyncio_slow: Rename "async()" to "ensure_future()".

"async()" was deprecated in CPython due to introduction of the similar
keyword, and causes SyntaxError in MicroPython.
pull/121/merge
Paul Sokolovsky 2017-09-10 00:08:32 +03:00
rodzic 9a5f94b807
commit cad77291d5
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -47,7 +47,7 @@ class EventLoop:
self.call_soon(_cb)
def run_until_complete(self, coro):
t = async(coro)
t = ensure_future(coro)
t.add_done_callback(lambda a: self.stop())
self.run_forever()
@ -109,7 +109,7 @@ def coroutine(f):
return f
def async(coro):
def ensure_future(coro):
if isinstance(coro, Future):
return coro
return Task(coro)
@ -136,7 +136,7 @@ def wait(coro_list, loop=_def_event_loop):
w = _Wait(len(coro_list))
for c in coro_list:
t = async(c)
t = ensure_future(c)
t.add_done_callback(lambda val: w._done())
return w