Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -12,10 +12,10 @@ from typing_extensions import Literal
# They are 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: IO[bytes], errors: str = ...) -> StreamReader: ...
@@ -63,8 +63,8 @@ def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = .
@overload
def decode(obj: bytes, encoding: str = ..., errors: str = ...) -> str: ...
def lookup(__encoding: str) -> CodecInfo: ...
def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> Tuple[str, int]: ... # undocumented
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... # undocumented
def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ... # undocumented
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... # undocumented
class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
@property
@@ -124,19 +124,19 @@ BOM_UTF32_LE: bytes
# It is expected that different actions be taken depending on which of the
# three subclasses of `UnicodeError` is actually ...ed. However, the Union
# is still needed for at least one of the cases.
def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[str | bytes, int]]) -> None: ...
def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[str | bytes, int]]: ...
def strict_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def replace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def ignore_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def backslashreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def register_error(__errors: str, __handler: Callable[[UnicodeError], tuple[str | bytes, int]]) -> None: ...
def lookup_error(__name: str) -> Callable[[UnicodeError], tuple[str | bytes, int]]: ...
def strict_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ...
def replace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ...
def ignore_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ...
def xmlcharrefreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ...
def backslashreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ...
class Codec:
# These are sort of @abstractmethod but sort of not.
# The StreamReader and StreamWriter subclasses only implement one.
def encode(self, input: str, errors: str = ...) -> Tuple[bytes, int]: ...
def decode(self, input: bytes, errors: str = ...) -> Tuple[str, int]: ...
def encode(self, input: str, errors: str = ...) -> tuple[bytes, int]: ...
def decode(self, input: bytes, errors: str = ...) -> tuple[str, int]: ...
class IncrementalEncoder:
errors: str
@@ -154,8 +154,8 @@ class IncrementalDecoder:
@abstractmethod
def decode(self, input: bytes, final: bool = ...) -> str: ...
def reset(self) -> None: ...
def getstate(self) -> Tuple[bytes, int]: ...
def setstate(self, state: Tuple[bytes, int]) -> None: ...
def getstate(self) -> tuple[bytes, int]: ...
def setstate(self, state: tuple[bytes, int]) -> None: ...
# These are not documented but used in encodings/*.py implementations.
class BufferedIncrementalEncoder(IncrementalEncoder):
@@ -169,7 +169,7 @@ class BufferedIncrementalDecoder(IncrementalDecoder):
buffer: bytes
def __init__(self, errors: str = ...) -> None: ...
@abstractmethod
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[str, int]: ...
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> tuple[str, int]: ...
def decode(self, input: bytes, final: bool = ...) -> str: ...
# TODO: it is not possible to specify the requirement that all other