mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -59,13 +59,13 @@ BOM64_BE: Literal[b"\x00\x00\xfe\xff"]
|
||||
BOM64_LE: Literal[b"\xff\xfe\x00\x00"]
|
||||
|
||||
class _WritableStream(Protocol):
|
||||
def write(self, __data: bytes) -> object: ...
|
||||
def seek(self, __offset: int, __whence: int) -> object: ...
|
||||
def write(self, data: bytes, /) -> object: ...
|
||||
def seek(self, offset: int, whence: int, /) -> object: ...
|
||||
def close(self) -> object: ...
|
||||
|
||||
class _ReadableStream(Protocol):
|
||||
def read(self, __size: int = ...) -> bytes: ...
|
||||
def seek(self, __offset: int, __whence: int) -> object: ...
|
||||
def read(self, size: int = ..., /) -> bytes: ...
|
||||
def seek(self, offset: int, whence: int, /) -> object: ...
|
||||
def close(self) -> object: ...
|
||||
|
||||
class _Stream(_WritableStream, _ReadableStream, Protocol): ...
|
||||
@@ -77,16 +77,16 @@ class _Stream(_WritableStream, _ReadableStream, Protocol): ...
|
||||
# They were much more common in Python 2 than in Python 3.
|
||||
|
||||
class _Encoder(Protocol):
|
||||
def __call__(self, __input: str, __errors: str = ...) -> tuple[bytes, int]: ... # signature of Codec().encode
|
||||
def __call__(self, input: str, errors: str = ..., /) -> tuple[bytes, int]: ... # signature of Codec().encode
|
||||
|
||||
class _Decoder(Protocol):
|
||||
def __call__(self, __input: bytes, __errors: str = ...) -> tuple[str, int]: ... # signature of Codec().decode
|
||||
def __call__(self, input: bytes, errors: str = ..., /) -> tuple[str, int]: ... # signature of Codec().decode
|
||||
|
||||
class _StreamReader(Protocol):
|
||||
def __call__(self, __stream: _ReadableStream, __errors: str = ...) -> StreamReader: ...
|
||||
def __call__(self, stream: _ReadableStream, errors: str = ..., /) -> StreamReader: ...
|
||||
|
||||
class _StreamWriter(Protocol):
|
||||
def __call__(self, __stream: _WritableStream, __errors: str = ...) -> StreamWriter: ...
|
||||
def __call__(self, stream: _WritableStream, errors: str = ..., /) -> StreamWriter: ...
|
||||
|
||||
class _IncrementalEncoder(Protocol):
|
||||
def __call__(self, errors: str = ...) -> IncrementalEncoder: ...
|
||||
|
||||
Reference in New Issue
Block a user