PageRenderTime 38ms CodeModel.GetById 31ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Lib/encodings/euc_jis_2004.py

http://unladen-swallow.googlecode.com/
Python | 39 lines | 26 code | 8 blank | 5 comment | 0 complexity | 7635677c8dd55cce9592264ff207094e MD5 | raw file
 1#
 2# euc_jis_2004.py: Python Unicode Codec for EUC_JIS_2004
 3#
 4# Written by Hye-Shik Chang <perky@FreeBSD.org>
 5#
 6
 7import _codecs_jp, codecs
 8import _multibytecodec as mbc
 9
10codec = _codecs_jp.getcodec('euc_jis_2004')
11
12class Codec(codecs.Codec):
13    encode = codec.encode
14    decode = codec.decode
15
16class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
17                         codecs.IncrementalEncoder):
18    codec = codec
19
20class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
21                         codecs.IncrementalDecoder):
22    codec = codec
23
24class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
25    codec = codec
26
27class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
28    codec = codec
29
30def getregentry():
31    return codecs.CodecInfo(
32        name='euc_jis_2004',
33        encode=Codec().encode,
34        decode=Codec().decode,
35        incrementalencoder=IncrementalEncoder,
36        incrementaldecoder=IncrementalDecoder,
37        streamreader=StreamReader,
38        streamwriter=StreamWriter,
39    )