From 445a86f4c98bba752d119bae9245d388ad638986 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sat, 1 May 2021 21:10:30 -0700 Subject: [PATCH] builtins: add aiter, anext (#5289) --- stdlib/builtins.pyi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index de4813a5d..6e75c5ef7 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -22,6 +22,8 @@ from typing import ( IO, AbstractSet, Any, + AsyncIterable, + AsyncIterator, BinaryIO, ByteString, Callable, @@ -959,6 +961,13 @@ _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) class _PathLike(Protocol[_AnyStr_co]): def __fspath__(self) -> _AnyStr_co: ... +if sys.version_info >= (3, 10): + def aiter(__iterable: AsyncIterable[_T]) -> AsyncIterator[_T]: ... + @overload + async def anext(__i: AsyncIterator[_T]) -> _T: ... + @overload + async def anext(__i: AsyncIterator[_T], default: _VT) -> Union[_T, _VT]: ... + if sys.version_info >= (3, 8): def compile( source: Union[str, bytes, mod, AST],