mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
Use _typeshed.Self where __enter__ returns self (#5698)
This commit is contained in:
committed by
GitHub
parent
1fb100dca4
commit
58559e56b3
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, List, NamedTuple, Optional, Tuple, Type, Union, overload
|
||||
from typing_extensions import Literal
|
||||
@@ -18,7 +19,7 @@ _Marker = Tuple[int, int, bytes]
|
||||
|
||||
class Aifc_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __enter__(self) -> Aifc_read: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
@@ -42,7 +43,7 @@ class Aifc_read:
|
||||
class Aifc_write:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> Aifc_write: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Callable, Optional, Protocol, Tuple, Type
|
||||
|
||||
@@ -18,7 +19,7 @@ class PipeHandle:
|
||||
def __del__(self, _warn: _WarnFunction = ...) -> None: ...
|
||||
else:
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> PipeHandle: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, t: Optional[type], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
|
||||
@property
|
||||
def handle(self) -> int: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from _typeshed import Self
|
||||
from socket import socket as _socket
|
||||
from ssl import SSLContext, SSLSocket
|
||||
from types import TracebackType
|
||||
@@ -59,7 +60,7 @@ class IMAP4:
|
||||
def delete(self, mailbox: str) -> _CommandResults: ...
|
||||
def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ...
|
||||
def enable(self, capability: str) -> _CommandResults: ...
|
||||
def __enter__(self) -> IMAP4: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
|
||||
def expunge(self) -> _CommandResults: ...
|
||||
def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import socket
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -48,7 +49,7 @@ class Listener:
|
||||
def address(self) -> _Address: ...
|
||||
@property
|
||||
def last_accepted(self) -> Optional[_Address]: ...
|
||||
def __enter__(self) -> Listener: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import collections.abc
|
||||
from _typeshed import Self
|
||||
from typing import Any, Dict, Iterator, Optional, Tuple
|
||||
|
||||
class Shelf(collections.abc.MutableMapping[Any, Any]):
|
||||
@@ -12,7 +13,7 @@ class Shelf(collections.abc.MutableMapping[Any, Any]):
|
||||
def __getitem__(self, key: str) -> Any: ...
|
||||
def __setitem__(self, key: str, value: Any) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __enter__(self) -> Shelf: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Self
|
||||
from email.message import Message as _Message
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
@@ -75,7 +76,7 @@ class SMTP:
|
||||
timeout: float = ...,
|
||||
source_address: Optional[_SourceAddress] = ...,
|
||||
) -> None: ...
|
||||
def __enter__(self) -> SMTP: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, Optional, Union
|
||||
|
||||
_File = Union[str, IO[bytes]]
|
||||
@@ -17,7 +18,7 @@ class _wave_params(NamedTuple):
|
||||
|
||||
class Wave_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __enter__(self) -> Wave_read: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
def getfp(self) -> Optional[BinaryIO]: ...
|
||||
def rewind(self) -> None: ...
|
||||
@@ -37,7 +38,7 @@ class Wave_read:
|
||||
|
||||
class Wave_write:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __enter__(self) -> Wave_write: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
def setnchannels(self, nchannels: int) -> None: ...
|
||||
def getnchannels(self) -> int: ...
|
||||
|
||||
Reference in New Issue
Block a user