-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
stdlib: audit more callback annotations #8209
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
||
__all__ = ["scheduler"] | ||
|
||
_ActionCallback: TypeAlias = Callable[..., Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ActionCallback: TypeAlias = Callable[..., Any] | |
_ActionCallback: TypeAlias = Callable[..., object] |
Looks like the return value is ignored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 _WriterCallback
in wsgiref.validate
.
@@ -25,9 +26,11 @@ class ErrorWrapper: | |||
def writelines(self, seq: Iterable[str]) -> None: ... | |||
def close(self) -> NoReturn: ... | |||
|
|||
_WriterCallback: TypeAlias = Callable[[bytes], Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_WriterCallback: TypeAlias = Callable[[bytes], Any] | |
_WriterCallback: TypeAlias = Callable[[bytes], object] |
Return value is ignored
Co-authored-by: Jelle Zijlstra <[email protected]>
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Relevant to PyCQA/flake8-pyi/issues/237