mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Fix return annotations of several methods that return self at runtime (#7070)
This commit is contained in:
@@ -86,7 +86,7 @@ class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
def incrementaldecoder(self) -> _IncrementalDecoder: ...
|
||||
name: str
|
||||
def __new__(
|
||||
cls,
|
||||
cls: type[Self],
|
||||
encode: _Encoder,
|
||||
decode: _Decoder,
|
||||
streamreader: _StreamReader | None = ...,
|
||||
@@ -96,7 +96,7 @@ class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
name: str | None = ...,
|
||||
*,
|
||||
_is_text_encoding: bool | None = ...,
|
||||
) -> CodecInfo: ...
|
||||
) -> Self: ...
|
||||
|
||||
def getencoder(encoding: str) -> _Encoder: ...
|
||||
def getdecoder(encoding: str) -> _Decoder: ...
|
||||
@@ -189,7 +189,7 @@ class StreamWriter(Codec):
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
class StreamReader(Codec):
|
||||
class StreamReader(Codec, Iterator[str]):
|
||||
errors: str
|
||||
def __init__(self, stream: IO[bytes], errors: str = ...) -> None: ...
|
||||
def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> str: ...
|
||||
@@ -198,7 +198,8 @@ class StreamReader(Codec):
|
||||
def reset(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def __next__(self) -> str: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
# Doesn't actually inherit from TextIO, but wraps a BinaryIO to provide text reading and writing
|
||||
|
||||
Reference in New Issue
Block a user