ยปCore Development>Code coverage>Lib/encodings/cp65001.py

Python code coverage for Lib/encodings/cp65001.py

#countcontent
1n/a"""
2n/aCode page 65001: Windows UTF-8 (CP_UTF8).
3n/a"""
4n/a
5n/aimport codecs
6n/aimport functools
7n/a
8n/aif not hasattr(codecs, 'code_page_encode'):
9n/a raise LookupError("cp65001 encoding is only available on Windows")
10n/a
11n/a### Codec APIs
12n/a
13n/aencode = functools.partial(codecs.code_page_encode, 65001)
14n/a_decode = functools.partial(codecs.code_page_decode, 65001)
15n/a
16n/adef decode(input, errors='strict'):
17n/a return codecs.code_page_decode(65001, input, errors, True)
18n/a
19n/aclass IncrementalEncoder(codecs.IncrementalEncoder):
20n/a def encode(self, input, final=False):
21n/a return encode(input, self.errors)[0]
22n/a
23n/aclass IncrementalDecoder(codecs.BufferedIncrementalDecoder):
24n/a _buffer_decode = _decode
25n/a
26n/aclass StreamWriter(codecs.StreamWriter):
27n/a encode = encode
28n/a
29n/aclass StreamReader(codecs.StreamReader):
30n/a decode = _decode
31n/a
32n/a### encodings module API
33n/a
34n/adef getregentry():
35n/a return codecs.CodecInfo(
36n/a name='cp65001',
37n/a encode=encode,
38n/a decode=decode,
39n/a incrementalencoder=IncrementalEncoder,
40n/a incrementaldecoder=IncrementalDecoder,
41n/a streamreader=StreamReader,
42n/a streamwriter=StreamWriter,
43n/a )