mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
@@ -81,7 +81,7 @@ def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> b
|
||||
def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> Text: ...
|
||||
@overload
|
||||
def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: ...
|
||||
def lookup(encoding: str) -> CodecInfo: ...
|
||||
def lookup(__encoding: str) -> CodecInfo: ...
|
||||
def utf_16_be_decode(__obj: _Encoded, __errors: str = ..., __final: bool = ...) -> Tuple[_Decoded, int]: ... # undocumented
|
||||
def utf_16_be_encode(__obj: _Decoded, __errors: str = ...) -> Tuple[_Encoded, int]: ... # undocumented
|
||||
|
||||
@@ -99,16 +99,18 @@ class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
@property
|
||||
def incrementaldecoder(self) -> _IncrementalDecoder: ...
|
||||
name: str
|
||||
def __init__(
|
||||
def __new__(
|
||||
self,
|
||||
encode: _Encoder,
|
||||
decode: _Decoder,
|
||||
streamreader: _StreamReader = ...,
|
||||
streamwriter: _StreamWriter = ...,
|
||||
incrementalencoder: _IncrementalEncoder = ...,
|
||||
incrementaldecoder: _IncrementalDecoder = ...,
|
||||
name: str = ...,
|
||||
) -> None: ...
|
||||
streamreader: Optional[_StreamReader] = ...,
|
||||
streamwriter: Optional[_StreamWriter] = ...,
|
||||
incrementalencoder: Optional[_IncrementalEncoder] = ...,
|
||||
incrementaldecoder: Optional[_IncrementalDecoder] = ...,
|
||||
name: Optional[str] = ...,
|
||||
*,
|
||||
_is_text_encoding: Optional[bool] = ...,
|
||||
) -> CodecInfo: ...
|
||||
|
||||
def getencoder(encoding: str) -> _Encoder: ...
|
||||
def getdecoder(encoding: str) -> _Decoder: ...
|
||||
@@ -116,9 +118,13 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ...
|
||||
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
|
||||
def getreader(encoding: str) -> _StreamReader: ...
|
||||
def getwriter(encoding: str) -> _StreamWriter: ...
|
||||
def register(search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
|
||||
def open(filename: str, mode: str = ..., encoding: str = ..., errors: str = ..., buffering: int = ...) -> StreamReaderWriter: ...
|
||||
def EncodedFile(file: IO[_Encoded], data_encoding: str, file_encoding: str = ..., errors: str = ...) -> StreamRecoder: ...
|
||||
def register(__search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
|
||||
def open(
|
||||
filename: str, mode: str = ..., encoding: Optional[str] = ..., errors: str = ..., buffering: int = ...
|
||||
) -> StreamReaderWriter: ...
|
||||
def EncodedFile(
|
||||
file: IO[_Encoded], data_encoding: str, file_encoding: Optional[str] = ..., errors: str = ...
|
||||
) -> StreamRecoder: ...
|
||||
def iterencode(iterator: Iterable[_Decoded], encoding: str, errors: str = ...) -> Generator[_Encoded, None, None]: ...
|
||||
def iterdecode(iterator: Iterable[_Encoded], encoding: str, errors: str = ...) -> Generator[_Decoded, None, None]: ...
|
||||
|
||||
@@ -136,8 +142,8 @@ 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(name: str, error_handler: Callable[[UnicodeError], Tuple[Union[str, bytes], int]]) -> None: ...
|
||||
def lookup_error(name: str) -> Callable[[UnicodeError], Tuple[Union[str, bytes], int]]: ...
|
||||
def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[Union[str, bytes], int]]) -> None: ...
|
||||
def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[Union[str, bytes], int]]: ...
|
||||
def strict_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
|
||||
def replace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
|
||||
def ignore_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
|
||||
@@ -164,7 +170,7 @@ class IncrementalDecoder:
|
||||
errors: str
|
||||
def __init__(self, errors: str = ...) -> None: ...
|
||||
@abstractmethod
|
||||
def decode(self, object: _Encoded, final: bool = ...) -> _Decoded: ...
|
||||
def decode(self, input: _Encoded, final: bool = ...) -> _Decoded: ...
|
||||
def reset(self) -> None: ...
|
||||
def getstate(self) -> Tuple[_Encoded, int]: ...
|
||||
def setstate(self, state: Tuple[_Encoded, int]) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user