Skip to content

Commit

Permalink
Merge pull request #18 from icgood/fix-mypy
Browse files Browse the repository at this point in the history
Fix some typing issues using partial()
  • Loading branch information
icgood committed Jul 27, 2022
2 parents 7da7756 + dbbbb2c commit 056bfd2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions swimprotocol/demo/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import string
from contextlib import AsyncExitStack
from curses import wrapper
from functools import partial
from threading import Event, Condition
from typing import Final, Any

Expand Down Expand Up @@ -113,14 +114,14 @@ def main(self, stdscr: Any) -> None:
self._set_typed(typed)

async def run_thread(self) -> None:
await asyncio.to_thread(wrapper, self.main)
await asyncio.to_thread(partial(wrapper, self.main))


def run_screen(members: Members) -> AsyncExitStack:
exit_stack = AsyncExitStack()
screen = Screen(members)
main_task = asyncio.create_task(screen.run_thread())
exit_stack.push_async_callback(asyncio.wait_for, main_task, None)
exit_stack.push_async_callback(partial(asyncio.wait_for, main_task, None))
exit_stack.enter_context(members.listener.on_notify(screen.update))
exit_stack.callback(screen.cancel)
return exit_stack

0 comments on commit 056bfd2

Please sign in to comment.