-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correct the type annotation of
create_timer()
(#61)
Backported-from: main Backported-to: 1.x
- Loading branch information
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Correct the type annotation of the callback argument in `create_timer()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import ( | ||
Any, | ||
Awaitable, | ||
Coroutine, | ||
Generator, | ||
TypeVar, | ||
) | ||
from typing_extensions import TypeAlias | ||
|
||
_T = TypeVar("_T") | ||
|
||
# taken from the typeshed | ||
if sys.version_info >= (3, 12): | ||
AwaitableLike: TypeAlias = Awaitable[_T] # noqa: Y047 | ||
CoroutineLike: TypeAlias = Coroutine[Any, Any, _T] # noqa: Y047 | ||
else: | ||
AwaitableLike: TypeAlias = Generator[Any, None, _T] | Awaitable[_T] | ||
CoroutineLike: TypeAlias = Generator[Any, None, _T] | Coroutine[Any, Any, _T] |