More mypy apeasement on 3.7

log_task_context
Tyler Goodlet 2020-01-15 19:48:37 -05:00
parent e2c9477122
commit 698951c515
6 changed files with 9 additions and 9 deletions

View File

@ -2,3 +2,4 @@ pytest
pytest-trio
pdbpp
mypy
trio_typing

View File

@ -39,7 +39,6 @@ setup(
],
install_requires=[
'msgpack', 'trio>0.8', 'async_generator', 'colorlog', 'wrapt',
'trio_typing',
],
tests_require=['pytest'],
python_requires=">=3.7",

View File

@ -445,8 +445,8 @@ class Actor:
# spin up a task for the requested function
log.debug(f"Spawning task for {func}")
cs = await self._root_nursery.start(
_invoke, self, cid, chan, func, kwargs,
name=funcname
partial(_invoke, self, cid, chan, func, kwargs),
name=funcname,
)
# never allow cancelling cancel requests (results in
# deadlock and other weird behaviour)
@ -639,7 +639,7 @@ class Actor:
# TODO: might want to consider having a separate nursery
# for the stream handler such that the server can be cancelled
# whilst leaving existing channels up
listeners = await nursery.start(
listeners: List[trio.abc.Listener] = await nursery.start(
partial(
trio.serve_tcp,
self._stream_handler,
@ -650,7 +650,7 @@ class Actor:
)
)
log.debug(
f"Started tcp server(s) on {[l.socket for l in listeners]}")
f"Started tcp server(s) on {[l.socket for l in listeners]}") # type: ignore
self._listeners.extend(listeners)
task_status.started()

View File

@ -331,7 +331,7 @@ async def open_portal(
if channel.uid is None:
await actor._do_handshake(channel)
msg_loop_cs = await nursery.start(
msg_loop_cs: trio.CancelScope = await nursery.start(
partial(
actor._process_messages,
channel,

View File

@ -21,7 +21,7 @@ from ._state import current_actor
from ._actor import Actor
_ctx: mp.context.BaseContext = mp.get_context("spawn")
_ctx: mp.context.BaseContext = mp.get_context("spawn") # type: ignore
def try_set_start_method(name: str) -> mp.context.BaseContext:
@ -95,7 +95,7 @@ def new_proc(
else:
fs_info = (None, None, None, None, None)
return _ctx.Process(
return _ctx.Process( # type: ignore
target=actor._fork_main,
args=(
bind_addr,