Back to index

python3.2  3.2.2
iso2022_jp_1.py
Go to the documentation of this file.
00001 #
00002 # iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1
00003 #
00004 # Written by Hye-Shik Chang <perky@FreeBSD.org>
00005 #
00006 
00007 import _codecs_iso2022, codecs
00008 import _multibytecodec as mbc
00009 
00010 codec = _codecs_iso2022.getcodec('iso2022_jp_1')
00011 
00012 class Codec(codecs.Codec):
00013     encode = codec.encode
00014     decode = codec.decode
00015 
00016 class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
00017                          codecs.IncrementalEncoder):
00018     codec = codec
00019 
00020 class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
00021                          codecs.IncrementalDecoder):
00022     codec = codec
00023 
00024 class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
00025     codec = codec
00026 
00027 class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
00028     codec = codec
00029 
00030 def getregentry():
00031     return codecs.CodecInfo(
00032         name='iso2022_jp_1',
00033         encode=Codec().encode,
00034         decode=Codec().decode,
00035         incrementalencoder=IncrementalEncoder,
00036         incrementaldecoder=IncrementalDecoder,
00037         streamreader=StreamReader,
00038         streamwriter=StreamWriter,
00039     )