Skip to content

Commit

Permalink
Add overloads for asyncio.sleep(). Closes python#7866
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed May 18, 2022
1 parent f2f72d6 commit 14abe02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stdlib/asyncio/tasks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ def run_coroutine_threadsafe(coro: _FutureT[_T], loop: AbstractEventLoop) -> con

if sys.version_info >= (3, 10):
def shield(arg: _FutureT[_T]) -> Future[_T]: ...
@overload
async def sleep(delay: float) -> None: ...
@overload
async def sleep(delay: float, result: _T = ...) -> _T: ...
@overload
async def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc]
Expand All @@ -281,6 +284,9 @@ if sys.version_info >= (3, 10):

else:
def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
@overload
async def sleep(delay: float, *, loop: AbstractEventLoop | None = ...) -> None: ...
@overload
async def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> _T: ...
@overload
async def wait( # type: ignore[misc]
Expand Down

0 comments on commit 14abe02

Please sign in to comment.