Skip to content
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

Merged
merged 7 commits into from
Jul 19, 2022
Merged

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood marked this pull request as ready for review June 29, 2022 22:49
@github-actions

This comment has been minimized.

stdlib/shutil.pyi Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

stdlib/shutil.pyi Outdated Show resolved Hide resolved
stdlib/shutil.pyi Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

stdlib/concurrent/futures/process.pyi Outdated Show resolved Hide resolved

__all__ = ["scheduler"]

_ActionCallback: TypeAlias = Callable[..., Any]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ActionCallback: TypeAlias = Callable[..., Any]
_ActionCallback: TypeAlias = Callable[..., object]

Looks like the return value is ignored

Copy link
Member Author

@AlexWaygood AlexWaygood Jul 19, 2022

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.

stdlib/shutil.pyi Outdated Show resolved Hide resolved
@@ -25,9 +26,11 @@ class ErrorWrapper:
def writelines(self, seq: Iterable[str]) -> None: ...
def close(self) -> NoReturn: ...

_WriterCallback: TypeAlias = Callable[[bytes], Any]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_WriterCallback: TypeAlias = Callable[[bytes], Any]
_WriterCallback: TypeAlias = Callable[[bytes], object]

Return value is ignored

Co-authored-by: Jelle Zijlstra <[email protected]>
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit e2ce7c6 into master Jul 19, 2022
@JelleZijlstra JelleZijlstra deleted the stdlib-callables branch July 19, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants