Skip to content

Commit

Permalink
Appease 3.8 mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Dec 11, 2020
1 parent fdbe989 commit 900654e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions tractor/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ async def _serve_forever(
self._server_down = trio.Event()
try:
async with trio.open_nursery() as server_n:
listeners: List[trio.abc.Listener] = await server_n.start(
l: List[trio.abc.Listener] = await server_n.start(
partial(
trio.serve_tcp,
self._stream_handler,
Expand All @@ -839,9 +839,10 @@ async def _serve_forever(
host=accept_host,
)
)
log.debug("Started tcp server(s) on" # type: ignore
f" {[l.socket for l in listeners]}")
self._listeners.extend(listeners)
log.debug(
"Started tcp server(s) on"
f" {[getattr(l, 'socket', 'unknown socket') for l in l]}")
self._listeners.extend(l)
task_status.started(server_n)
finally:
# signal the server is down since nursery above terminated
Expand All @@ -853,6 +854,7 @@ def cancel_soon(self) -> None:
Schedules `.cancel()` to be run immediately just like when
cancelled by the parent.
"""
assert self._service_n
self._service_n.start_soon(self.cancel)

async def cancel(self) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions tractor/_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def _mp_main(
actor: 'Actor', # noqa
actor: 'Actor', # type: ignore
accept_addr: Tuple[str, int],
forkserver_info: Tuple[Any, Any, Any, Any, Any],
start_method: str,
Expand Down Expand Up @@ -60,7 +60,7 @@ def _mp_main(


def _trio_main(
actor: 'Actor', # noqa
actor: 'Actor', # type: ignore
*,
parent_addr: Tuple[str, int] = None,
infect_asyncio: bool = False,
Expand Down

0 comments on commit 900654e

Please sign in to comment.