-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
stdlib: audit more callback annotations #8209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
9962629
c7c9f59
a26d53e
f579a28
a3444f6
8ed6d20
9e3fb51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,23 +1,26 @@ | ||||||
import sys | ||||||
from collections.abc import Callable | ||||||
from typing import Any, NamedTuple | ||||||
from typing_extensions import TypeAlias | ||||||
|
||||||
__all__ = ["scheduler"] | ||||||
|
||||||
_ActionCallback: TypeAlias = Callable[..., Any] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Looks like the return value is ignored There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used as an attribute annotation as well, though, and I wanted to avoid unexpected false positives on code like e: Event
x = e.action()
x.foo() I'm not sure if it makes sense to do that, but I didn't want to accidentally cause a regression. Same for |
||||||
|
||||||
if sys.version_info >= (3, 10): | ||||||
class Event(NamedTuple): | ||||||
time: float | ||||||
priority: Any | ||||||
sequence: int | ||||||
action: Callable[..., Any] | ||||||
action: _ActionCallback | ||||||
argument: tuple[Any, ...] | ||||||
kwargs: dict[str, Any] | ||||||
|
||||||
else: | ||||||
class Event(NamedTuple): | ||||||
time: float | ||||||
priority: Any | ||||||
action: Callable[..., Any] | ||||||
action: _ActionCallback | ||||||
argument: tuple[Any, ...] | ||||||
kwargs: dict[str, Any] | ||||||
|
||||||
|
@@ -27,20 +30,10 @@ class scheduler: | |||||
|
||||||
def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], object] = ...) -> None: ... | ||||||
def enterabs( | ||||||
self, | ||||||
time: float, | ||||||
priority: Any, | ||||||
action: Callable[..., Any], | ||||||
argument: tuple[Any, ...] = ..., | ||||||
kwargs: dict[str, Any] = ..., | ||||||
self, time: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ... | ||||||
) -> Event: ... | ||||||
def enter( | ||||||
self, | ||||||
delay: float, | ||||||
priority: Any, | ||||||
action: Callable[..., Any], | ||||||
argument: tuple[Any, ...] = ..., | ||||||
kwargs: dict[str, Any] = ..., | ||||||
self, delay: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ... | ||||||
) -> Event: ... | ||||||
def run(self, blocking: bool = ...) -> float | None: ... | ||||||
def cancel(self, event: Event) -> None: ... | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.