tornado: add some types - #5742
Merged
Merged
Conversation
Member
Author
|
The stubtest failure seems to be due to an issue with PIL. I'll just push a fix. |
Akuli
reviewed
Jul 9, 2021
| def release(self) -> None: ... | ||
| def acquire(self, timeout: Optional[Any] = ...): ... | ||
| def __enter__(self): ... | ||
| def __enter__(self) -> NoReturn: ... |
Collaborator
There was a problem hiding this comment.
The implementation is:
def __enter__(self) -> None:
raise RuntimeError("Use 'async with' instead of 'with' for Semaphore")It might be better to delete this, so that you get an error when type-checking, not at runtime.
Comment on lines
+43
to
+48
| def __enter__(self) -> NoReturn: ... | ||
| __exit__: Any | ||
| def __aenter__(self): ... | ||
| def __aexit__(self, typ, value, tb): ... | ||
| def __aenter__(self) -> None: ... | ||
| def __aexit__( | ||
| self, typ: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType] | ||
| ) -> None: ... |
Collaborator
There was a problem hiding this comment.
My comments for class Semaphore apply here too.
Merged
Collaborator
|
Could you also update the version field in |
Member
Author
|
I set the version to 5.1, the last that actually supported Python 2. |
srittau
approved these changes
Jul 11, 2021
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://github.com/tornadoweb/tornado/blob/master/tornado/locks.py
These stubs are for Python 2 only but include Python 3 annotations. See #5220 for context.
These were the only
__aenter__stubs I could find that didn't already have correct annotations. I was auditing those as part of #5676.