-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Sample program:
import asyncio
from typing import Any, Dict
async def message_reader(socket: Any) -> Any:
return await socket.recv()
def do_work() -> Dict[str, Any]:
return {}
async def foo(socket: Any) -> None:
loop = asyncio.get_event_loop()
work_task = loop.run_in_executor(None, do_work)
recv_task = asyncio.ensure_future(message_reader(socket))
pending = {work_task, recv_task}
done, pending = await asyncio.wait(pending)
Error:
$ mypy --strict wait_mypy.py
wait_mypy.py:19: error: Incompatible types in assignment (expression has type "Set[Future[Any]]", variable has type "Set[Iterable[Any]]")
wait_mypy.py:19: error: Argument 1 to "wait" has incompatible type "Set[Iterable[Any]]"; expected "Iterable[Union[Generator[Any, None, <nothing>], Awaitable[<nothing>]]]"
wait_mypy.py:19: error: Argument 1 to "wait" has incompatible type "Set[Iterable[Any]]"; expected "Iterable[Union[Generator[Any, None, Any], Awaitable[Any]]]"
$ mypy --version
mypy 0.570
Metadata
Metadata
Assignees
Labels
No labels