|
1 | 1 | import codecs |
2 | | -from _codecs import _CharMap |
| 2 | +from _codecs import _DecodeCharMap, _EncodeCharMap |
3 | 3 | from _typeshed import ReadableBuffer |
4 | 4 |
|
5 | 5 | class Codec(codecs.Codec): |
6 | 6 | # At runtime, this is codecs.charmap_encode |
7 | 7 | @staticmethod |
8 | | - def encode(str: str, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[bytes, int]: ... |
| 8 | + def encode(str: str, errors: str | None = None, mapping: _EncodeCharMap | None = None, /) -> tuple[bytes, int]: ... |
9 | 9 | # At runtime, this is codecs.charmap_decode |
10 | 10 | @staticmethod |
11 | | - def decode(data: ReadableBuffer, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[str, int]: ... |
| 11 | + def decode(data: ReadableBuffer, errors: str | None = None, mapping: _DecodeCharMap | None = None, /) -> tuple[str, int]: ... |
12 | 12 |
|
13 | 13 | class IncrementalEncoder(codecs.IncrementalEncoder): |
14 | | - mapping: _CharMap | None |
15 | | - def __init__(self, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... |
| 14 | + mapping: _EncodeCharMap | None |
| 15 | + def __init__(self, errors: str = "strict", mapping: _EncodeCharMap | None = None) -> None: ... |
16 | 16 | def encode(self, input: str, final: bool = False) -> bytes: ... |
17 | 17 |
|
18 | 18 | class IncrementalDecoder(codecs.IncrementalDecoder): |
19 | | - mapping: _CharMap | None |
20 | | - def __init__(self, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... |
| 19 | + mapping: _DecodeCharMap | None |
| 20 | + def __init__(self, errors: str = "strict", mapping: _DecodeCharMap | None = None) -> None: ... |
21 | 21 | def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... |
22 | 22 |
|
23 | 23 | class StreamWriter(Codec, codecs.StreamWriter): |
24 | | - mapping: _CharMap | None |
25 | | - def __init__(self, stream: codecs._WritableStream, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... |
| 24 | + mapping: _EncodeCharMap | None |
| 25 | + def __init__(self, stream: codecs._WritableStream, errors: str = "strict", mapping: _EncodeCharMap | None = None) -> None: ... |
26 | 26 | def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] |
27 | 27 |
|
28 | 28 | class StreamReader(Codec, codecs.StreamReader): |
29 | | - mapping: _CharMap | None |
30 | | - def __init__(self, stream: codecs._ReadableStream, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... |
| 29 | + mapping: _DecodeCharMap | None |
| 30 | + def __init__(self, stream: codecs._ReadableStream, errors: str = "strict", mapping: _DecodeCharMap | None = None) -> None: ... |
31 | 31 | def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] |
32 | 32 |
|
33 | 33 | def getregentry() -> codecs.CodecInfo: ... |
0 commit comments