|
| 1 | +import codecs |
| 2 | +import sys |
| 3 | +from typing import Any, Callable, Dict, Optional, Text, Tuple, Union |
| 4 | + |
| 5 | +# For convenience: |
| 6 | +_Handler = Callable[[Exception], Tuple[Text, int]] |
| 7 | +_String = Union[bytes, str] |
| 8 | +_Errors = Union[str, Text, None] |
| 9 | +_Decodable = Union[bytes, Text] |
| 10 | +_Encodable = Union[bytes, Text] |
| 11 | + |
| 12 | +# This type is not exposed; it is defined in unicodeobject.c |
| 13 | +class _EncodingMap(object): |
| 14 | + def size(self) -> int: ... |
| 15 | + |
| 16 | +_MapT = Union[Dict[int, int], _EncodingMap] |
| 17 | + |
| 18 | +def register(__search_function: Callable[[str], Any]) -> None: ... |
| 19 | +def register_error(__errors: Union[str, Text], __handler: _Handler) -> None: ... |
| 20 | +def lookup(__encoding: Union[str, Text]) -> codecs.CodecInfo: ... |
| 21 | +def lookup_error(__name: Union[str, Text]) -> _Handler: ... |
| 22 | +def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ... |
| 23 | +def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ... |
| 24 | +def charmap_build(__map: Text) -> _MapT: ... |
| 25 | +def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... |
| 26 | +def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 27 | +def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 28 | +def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ... |
| 29 | +def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ... |
| 30 | +def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ... |
| 31 | +def escape_encode(__data: bytes, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 32 | +def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... |
| 33 | +def latin_1_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 34 | +def raw_unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... |
| 35 | +def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 36 | +def readbuffer_encode(__data: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 37 | +def unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... |
| 38 | +def unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 39 | +def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... |
| 40 | +def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 41 | +def utf_16_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 42 | +def utf_16_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 43 | +def utf_16_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 44 | +def utf_16_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... |
| 45 | +def utf_16_ex_decode( |
| 46 | + __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... |
| 47 | +) -> Tuple[Text, int, int]: ... |
| 48 | +def utf_16_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 49 | +def utf_16_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 50 | +def utf_32_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 51 | +def utf_32_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 52 | +def utf_32_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 53 | +def utf_32_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... |
| 54 | +def utf_32_ex_decode( |
| 55 | + __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... |
| 56 | +) -> Tuple[Text, int, int]: ... |
| 57 | +def utf_32_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 58 | +def utf_32_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 59 | +def utf_7_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 60 | +def utf_7_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 61 | +def utf_8_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 62 | +def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
| 63 | + |
| 64 | +if sys.platform == "win32": |
| 65 | + def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... |
| 66 | + def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... |
0 commit comments