| 120 | # `encodings.cp1252` for comparison; this is almost exactly the same, |
| 121 | # except I made it follow pep8. |
| 122 | class Codec(codecs.Codec): |
| 123 | def encode(self, input: str, errors: str | None = "strict") -> tuple[bytes, int]: |
| 124 | return codecs.charmap_encode(input, errors, encoding_table) |
| 125 | |
| 126 | def decode(self, input: bytes, errors: str | None = "strict") -> tuple[str, int]: |
| 127 | return codecs.charmap_decode(input, errors, decoding_table) # type: ignore[arg-type] |
| 128 | |
| 129 | class IncrementalEncoder(codecs.IncrementalEncoder): |
| 130 | def encode(self, input: str, final: bool = False) -> bytes: |