Coding style.

- asyncio.async -> asyncio.ensure_future
This commit is contained in:
Andrew Hamilton 2017-10-28 08:29:27 +10:00
parent 4935c585aa
commit 257eae4e73
2 changed files with 4 additions and 2 deletions

View file

@ -570,7 +570,8 @@ class Screen:
future = worker_.job_runner(
self._summary, self._log, self._summary._jobs_added_event,
self._appearance_changed_event)
worker_.future = asyncio.async(future, loop=self._main_loop)
worker_.future = asyncio.ensure_future(future,
loop=self._main_loop)
self.workers = workers
def stop_workers(self):

View file

@ -464,7 +464,8 @@ def main(loop, appearance_changed_event, screen_widget, exit_loop=None):
loop.add_signal_handler(signal.SIGWINCH, appearance_changed_event.set)
loop.add_signal_handler(signal.SIGINT, exit_loop)
loop.add_signal_handler(signal.SIGTERM, exit_loop)
asyncio.async(_update_screen(screen_widget, appearance_changed_event))
asyncio.ensure_future(
_update_screen(screen_widget, appearance_changed_event))
with terminal.hidden_cursor(), terminal.fullscreen(), \
_urwid_screen() as urwid_screen:
loop.add_reader(sys.stdin, on_input, urwid_screen, screen_widget)