-
-
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
Use _typeshed.Self with __enter__ #5712
Conversation
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. 🤖🎉 |
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.
Thanks! I double-checked all these except the Python 2 stuff.
@@ -82,7 +82,7 @@ def open( | |||
) -> TextIO: ... | |||
|
|||
class BZ2File(BaseStream, IO[bytes]): | |||
def __enter__(self: _T) -> _T: ... | |||
def __enter__(self: Self) -> Self: ... |
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.
This method doesn't actually exist at runtime; I guess it is inherited from an IO-related base class.
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.
You are correct, I think it is IOBase, but I would need to check.
Probably needs a scan for |
Relates to #5676
I also removed
TypeVar
usage, where it became obsolete. IncProfile
it also made sense to replace the_SelfT
references withSelf
.