mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Use typing_extensions.Self in the stdlib (#9694)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import sys
|
||||
import types
|
||||
from _codecs import *
|
||||
from _typeshed import ReadableBuffer, Self
|
||||
from _typeshed import ReadableBuffer
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
from typing import Any, BinaryIO, Protocol, TextIO
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, Self
|
||||
|
||||
__all__ = [
|
||||
"register",
|
||||
@@ -110,7 +110,7 @@ class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
def incrementaldecoder(self) -> _IncrementalDecoder: ...
|
||||
name: str
|
||||
def __new__(
|
||||
cls: type[Self],
|
||||
cls,
|
||||
encode: _Encoder,
|
||||
decode: _Decoder,
|
||||
streamreader: _StreamReader | None = None,
|
||||
@@ -210,7 +210,7 @@ class StreamWriter(Codec):
|
||||
def write(self, object: str) -> None: ...
|
||||
def writelines(self, list: Iterable[str]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
@@ -222,9 +222,9 @@ class StreamReader(Codec):
|
||||
def readline(self, size: int | None = None, keepends: bool = True) -> str: ...
|
||||
def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ...
|
||||
def reset(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> str: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
@@ -237,12 +237,12 @@ class StreamReaderWriter(TextIO):
|
||||
def readline(self, size: int | None = None) -> str: ...
|
||||
def readlines(self, sizehint: int | None = None) -> list[str]: ...
|
||||
def __next__(self) -> str: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def write(self, data: str) -> None: ... # type: ignore[override]
|
||||
def writelines(self, list: Iterable[str]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ... # type: ignore[override]
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
|
||||
@@ -271,12 +271,12 @@ class StreamRecoder(BinaryIO):
|
||||
def readline(self, size: int | None = None) -> bytes: ...
|
||||
def readlines(self, sizehint: int | None = None) -> list[bytes]: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def write(self, data: bytes) -> None: ... # type: ignore[override]
|
||||
def writelines(self, list: Iterable[bytes]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ... # type: ignore[override]
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
|
||||
|
||||
Reference in New Issue
Block a user