Back to index

python3.2  3.2.2
Functions | Variables
gencjkcodecs Namespace Reference

Functions

def gencodecs

Variables

dictionary codecs
tuple TEMPLATE

Function Documentation

def gencjkcodecs.gencodecs (   prefix)

Definition at line 57 of file gencjkcodecs.py.

00057 
00058 def gencodecs(prefix):
00059     for loc, encodings in codecs.items():
00060         for enc in encodings:
00061             code = TEMPLATE.substitute(ENCODING=enc.upper(),
00062                                        encoding=enc.lower(),
00063                                        owner=loc)
00064             codecpath = os.path.join(prefix, enc + '.py')
00065             open(codecpath, 'w').write(code)

Here is the call graph for this function:


Variable Documentation

Initial value:
00001 {
00002     'cn': ('gb2312', 'gbk', 'gb18030', 'hz'),
00003     'tw': ('big5', 'cp950'),
00004     'hk': ('big5hkscs',),
00005     'jp': ('cp932', 'shift_jis', 'euc_jp', 'euc_jisx0213', 'shift_jisx0213',
00006            'euc_jis_2004', 'shift_jis_2004'),
00007     'kr': ('cp949', 'euc_kr', 'johab'),
00008     'iso2022': ('iso2022_jp', 'iso2022_jp_1', 'iso2022_jp_2',
00009                 'iso2022_jp_2004', 'iso2022_jp_3', 'iso2022_jp_ext',
00010                 'iso2022_kr'),
00011 }

Definition at line 3 of file gencjkcodecs.py.

Initial value:
00001 string.Template("""\
00002 ## $encoding.py: Python Unicode Codec for $ENCODING## Written by Hye-Shik Chang <perky@FreeBSD.org>#import _codecs_$owner, codecsimport _multibytecodec as mbccodec = _codecs_$owner.getcodec('$encoding')class Codec(codecs.Codec):    encode = codec.encode    decode = codec.decodeclass IncrementalEncoder(mbc.MultibyteIncrementalEncoder,                         codecs.IncrementalEncoder):    codec = codecclass IncrementalDecoder(mbc.MultibyteIncrementalDecoder,                         codecs.IncrementalDecoder):    codec = codecclass StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):    codec = codecclass StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):    codec = codecdef getregentry():    return codecs.CodecInfo(        name='$encoding',        encode=Codec().encode,        decode=Codec().decode,        incrementalencoder=IncrementalEncoder,        incrementaldecoder=IncrementalDecoder,        streamreader=StreamReader,        streamwriter=StreamWriter,    )""")

Definition at line 15 of file gencjkcodecs.py.