8000 gh-114281: Improve type hints in `asyncio/stagged.py` · sobolevn/cpython@4b387c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4b387c4

Browse files
committed
pythongh-114281: Improve type hints in asyncio/stagged.py
1 parent a34e4db commit 4b387c4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Lib/asyncio/staggered.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
__all__ = 'staggered_race',
44

55
import contextlib
6-
import typing
6+
from collections.abc import Awaitable, Callable, Iterable
7+
from typing import Any
78

89
from . import events
910
from . import exceptions as exceptions_mod
@@ -12,14 +13,14 @@
1213

1314

1415
async def staggered_race(
15-
coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]],
16-
delay: typing.Optional[float],
16+
coro_fns: Iterable[Callable[[], Awaitable[Any]]],
17+
delay: float | None,
1718
*,
18-
loop: events.AbstractEventLoop = None,
19-
) -> typing.Tuple[
20-
typing.Any,
21-
typing.Optional[int],
22-
typing.List[typing.Optional[Exception]]
19+
loop: events.AbstractEventLoop | None = None,
20+
) -> tuple[
21+
Any,
22+
int | None,
23+
list[Exception | None]
2324
]:
2425
"""Run coroutines with staggered start times and take the first to finish.
2526

0 commit comments

Comments
 (0)
0