Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,9 +1,9 @@
import datetime
import socket
import ssl
from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, TypeVar, Union
from _typeshed import Self
from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, Union
_SelfT = TypeVar("_SelfT", bound=_NNTPBase)
_File = Union[IO[bytes], bytes, str, None]
class NNTPError(Exception):
@@ -45,7 +45,7 @@ class _NNTPBase:
nntp_implementation: str
nntp_version: int
def __init__(self, file: IO[bytes], host: str, readermode: bool | None = ..., timeout: float = ...) -> None: ...
def __enter__(self: _SelfT) -> _SelfT: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: Any) -> None: ...
def getwelcome(self) -> str: ...
def getcapabilities(self) -> Dict[str, List[str]]: ...