-
-
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
Always use _typeshed.Self
, where applicable
#6880
Conversation
This comment has been minimized.
This comment has been minimized.
The third-party stubtest failure for |
Here's a fix for the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -30,7 +31,7 @@ class Markdown: | |||
def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, Mapping[str, Any]]) -> Markdown: ... | |||
def build_extension(self, ext_name: Text, configs: Mapping[str, str]) -> Extension: ... | |||
def registerExtension(self, extension: Extension) -> Markdown: ... | |||
def reset(self: Markdown) -> Markdown: ... | |||
def reset(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 is semantically different to the stub as it is currently, but looks more correct to me. https://github.com/Python-Markdown/markdown/blob/1d41f13c774696d651921601c827ed500e2aa285/markdown/core.py#L190
@@ -44,7 +44,7 @@ def retry_on_signal(function: Callable[[], _T]) -> _T: ... | |||
def constant_time_bytes_eq(a: AnyStr, b: AnyStr) -> bool: ... | |||
|
|||
class ClosingContextManager: | |||
def __enter__(self: _TC) -> _TC: ... | |||
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 is also semantically different to the existing stub, but looks more correct to me. https://github.com/paramiko/paramiko/blob/88f35a537428e430f7f26eee8026715e357b55d6/paramiko/util.py#L300
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.
This comment has been minimized.
This comment has been minimized.
The last 5 commits were prepared manually by grepping for |
This comment has been minimized.
This comment has been minimized.
1 similar comment
Diff from mypy_primer, showing the effect of this PR on open source code: steam.py (https://github.com/Gobot1234/steam.py)
- steam/enums.py:172: note: def [_TT <: type] __new__(cls, cls: Type[_TT], str, Tuple[type, ...], Dict[str, Any], **kwds: Any) -> _TT
+ steam/enums.py:172: note: def [Self] __new__(cls, cls: Type[Self], str, Tuple[type, ...], Dict[str, Any], **kwds: Any) -> Self
- steam/channel.py:162: note: def [_TT <: type] __new__(cls, cls: Type[_TT], str, Tuple[type, ...], Dict[str, Any], **kwds: Any) -> _TT
+ steam/channel.py:162: note: def [Self] __new__(cls, cls: Type[Self], str, Tuple[type, ...], Dict[str, Any], **kwds: Any) -> Self
|
This PR was prepared using the following script: