From 698951c515af5d794ca91da66da86e9381af7839 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 15 Jan 2020 19:48:37 -0500 Subject: [PATCH] More mypy apeasement on 3.7 --- .travis.yml | 2 +- requirements-test.txt | 1 + setup.py | 1 - tractor/_actor.py | 8 ++++---- tractor/_portal.py | 2 +- tractor/_spawn.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 956a5bf..d8f58be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,5 +31,5 @@ install: - pip install -U . -r requirements-test.txt --upgrade-strategy eager script: - - mypy tractor/ --ignore-missing-imports + - mypy tractor/ --ignore-missing-imports - pytest tests/ --no-print-logs diff --git a/requirements-test.txt b/requirements-test.txt index 447b18c..e9dae32 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,3 +2,4 @@ pytest pytest-trio pdbpp mypy +trio_typing diff --git a/setup.py b/setup.py index 4f56472..cb44d1c 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,6 @@ setup( ], install_requires=[ 'msgpack', 'trio>0.8', 'async_generator', 'colorlog', 'wrapt', - 'trio_typing', ], tests_require=['pytest'], python_requires=">=3.7", diff --git a/tractor/_actor.py b/tractor/_actor.py index 6755b0b..22e2253 100644 --- a/tractor/_actor.py +++ b/tractor/_actor.py @@ -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() diff --git a/tractor/_portal.py b/tractor/_portal.py index bd49170..8f5899b 100644 --- a/tractor/_portal.py +++ b/tractor/_portal.py @@ -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, diff --git a/tractor/_spawn.py b/tractor/_spawn.py index a759946..f299b9d 100644 --- a/tractor/_spawn.py +++ b/tractor/_spawn.py @@ -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,