From 3c4141982e22aba6966daba5785d1ba959d7fc49 Mon Sep 17 00:00:00 2001 From: Nicklas Lindgren Date: Wed, 31 Jul 2019 19:53:23 +0200 Subject: [PATCH] Declare asyncio.as_completed() as taking an Iterable (#3164) The stub for asyncio.as_completed declared it as taking a Sequence of Futures. This was unnecessarily strict. Just like asyncio.wait, asyncio.as_completed can be declared to take an Iterable of Futures instead. Both these functions iterate over their argument only once to store its items in a set, so an Iterable is sufficiently strict. This has been true since the initial implementation of the functions. --- stdlib/3/asyncio/tasks.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/asyncio/tasks.pyi b/stdlib/3/asyncio/tasks.pyi index ef657aab1..d100605d9 100644 --- a/stdlib/3/asyncio/tasks.pyi +++ b/stdlib/3/asyncio/tasks.pyi @@ -21,7 +21,7 @@ FIRST_EXCEPTION: str FIRST_COMPLETED: str ALL_COMPLETED: str -def as_completed(fs: Sequence[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., +def as_completed(fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... def ensure_future(coro_or_future: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...