1 """Stub file for the '_codecs' module."""
\r
4 from typing import Any, Callable, Tuple, Optional, Dict, Text, Union
\r
9 _Handler = Callable[[Exception], Tuple[Text, int]]
\r
10 _String = Union[bytes, str]
\r
11 _Errors = Union[str, Text, None]
\r
12 if sys.version_info < (3, 0):
\r
13 _Decodable = Union[bytes, Text]
\r
14 _Encodable = Union[bytes, Text]
\r
19 # This type is not exposed; it is defined in unicodeobject.c
\r
20 class _EncodingMap(object):
\r
21 def size(self) -> int: ...
\r
22 _MapT = Union[Dict[int, int], _EncodingMap]
\r
24 def register(search_function: Callable[[str], Any]) -> None: ...
\r
25 def register_error(errors: Union[str, Text], handler: _Handler) -> None: ...
\r
26 def lookup(encoding: Union[str, Text]) -> codecs.CodecInfo: ...
\r
27 def lookup_error(name: Union[str, Text]) -> _Handler: ...
\r
28 def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
\r
29 def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
\r
30 def charmap_build(map: Text) -> _MapT: ...
\r
32 def ascii_decode(data: _Decodable, errors: _Errors = ...) -> Tuple[Text, int]: ...
\r
33 def ascii_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
34 def charbuffer_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
35 def charmap_decode(data: _Decodable, errors: _Errors = ..., mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ...
\r
36 def charmap_encode(data: _Encodable, errors: _Errors, mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
\r
37 def escape_decode(data: _String, errors: _Errors = ...) -> Tuple[str, int]: ...
\r
38 def escape_encode(data: bytes, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
39 def latin_1_decode(data: _Decodable, errors: _Errors = ...) -> Tuple[Text, int]: ...
\r
40 def latin_1_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
41 def raw_unicode_escape_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
\r
42 def raw_unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
43 def readbuffer_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
44 def unicode_escape_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
\r
45 def unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
46 def unicode_internal_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
\r
47 def unicode_internal_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
48 def utf_16_be_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
49 def utf_16_be_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
50 def utf_16_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
51 def utf_16_encode(data: _Encodable, errors: _Errors = ..., byteorder: int = ...) -> Tuple[bytes, int]: ...
\r
52 def utf_16_ex_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int, int]: ...
\r
53 def utf_16_le_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
54 def utf_16_le_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
55 def utf_32_be_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
56 def utf_32_be_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
57 def utf_32_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
58 def utf_32_encode(data: _Encodable, errors: _Errors = ..., byteorder: int = ...) -> Tuple[bytes, int]: ...
\r
59 def utf_32_ex_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int, int]: ...
\r
60 def utf_32_le_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
61 def utf_32_le_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
62 def utf_7_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
63 def utf_7_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
64 def utf_8_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
65 def utf_8_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
67 if sys.platform == 'win32':
\r
68 def mbcs_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
69 def mbcs_encode(str: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
70 if sys.version_info >= (3, 0):
\r
71 def oem_decode(data: bytes, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
72 def code_page_decode(codepage: int, data: bytes, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
\r
73 def oem_encode(str: Text, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r
74 def code_page_encode(code_page: int, str: Text, errors: _Errors = ...) -> Tuple[bytes, int]: ...
\r