blob: 3940894bc0121a94d6b4ff2d41fdf48b84145df1 [file] [log] [blame]
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00001#
2# hz.py: Python Unicode Codec for HZ
3#
4# Written by Hye-Shik Chang <perky@FreeBSD.org>
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00005# $CJKCodecs: hz.py,v 1.8 2004/06/28 18:16:03 perky Exp $
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00006#
7
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00008import _codecs_cn, codecs
9
10codec = _codecs_cn.getcodec('hz')
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +000011
12class Codec(codecs.Codec):
13 encode = codec.encode
14 decode = codec.decode
15
16class StreamReader(Codec, codecs.StreamReader):
17 def __init__(self, stream, errors='strict'):
18 codecs.StreamReader.__init__(self, stream, errors)
19 __codec = codec.StreamReader(stream, errors)
20 self.read = __codec.read
21 self.readline = __codec.readline
22 self.readlines = __codec.readlines
23 self.reset = __codec.reset
24
25class StreamWriter(Codec, codecs.StreamWriter):
26 def __init__(self, stream, errors='strict'):
27 codecs.StreamWriter.__init__(self, stream, errors)
28 __codec = codec.StreamWriter(stream, errors)
29 self.write = __codec.write
30 self.writelines = __codec.writelines
31 self.reset = __codec.reset
32
33def getregentry():
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +000034 return (codec.encode, codec.decode, StreamReader, StreamWriter)