PyXR

c:\python24\lib \ encodings \ charmap.py



0001 """ Generic Python Character Mapping Codec.
0002 
0003     Use this codec directly rather than through the automatic
0004     conversion mechanisms supplied by unicode() and .encode().
0005 
0006 
0007 Written by Marc-Andre Lemburg (mal@lemburg.com).
0008 
0009 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
0010 
0011 """#"
0012 
0013 import codecs
0014 
0015 ### Codec APIs
0016 
0017 class Codec(codecs.Codec):
0018 
0019     # Note: Binding these as C functions will result in the class not
0020     # converting them to methods. This is intended.
0021     encode = codecs.charmap_encode
0022     decode = codecs.charmap_decode
0023 
0024 class StreamWriter(Codec,codecs.StreamWriter):
0025 
0026     def __init__(self,stream,errors='strict',mapping=None):
0027 
0028         codecs.StreamWriter.__init__(self,stream,errors)
0029         self.mapping = mapping
0030 
0031     def encode(self,input,errors='strict'):
0032 
0033         return Codec.encode(input,errors,self.mapping)
0034 
0035 class StreamReader(Codec,codecs.StreamReader):
0036 
0037     def __init__(self,stream,errors='strict',mapping=None):
0038 
0039         codecs.StreamReader.__init__(self,strict,errors)
0040         self.mapping = mapping
0041 
0042     def decode(self,input,errors='strict'):
0043 
0044         return Codec.decode(input,errors,self.mapping)
0045 
0046 ### encodings module API
0047 
0048 def getregentry():
0049 
0050     return (Codec.encode,Codec.decode,StreamReader,StreamWriter)
0051 

Generated by PyXR 0.9.4
SourceForge.net Logo