Propagate exceptions from shutdown() if raiseExceptions is not set.
[python.git] / Lib / encodings / charmap.py
blob9bd93ecc334fd7c1f42595d9bdb655aae7c51ebd
1 """ Generic Python Character Mapping Codec.
3 Use this codec directly rather than through the automatic
4 conversion mechanisms supplied by unicode() and .encode().
7 Written by Marc-Andre Lemburg (mal@lemburg.com).
9 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
11 """#"
13 import codecs
15 ### Codec APIs
17 class Codec(codecs.Codec):
19 # Note: Binding these as C functions will result in the class not
20 # converting them to methods. This is intended.
21 encode = codecs.charmap_encode
22 decode = codecs.charmap_decode
24 class StreamWriter(Codec,codecs.StreamWriter):
26 def __init__(self,stream,errors='strict',mapping=None):
28 codecs.StreamWriter.__init__(self,stream,errors)
29 self.mapping = mapping
31 def encode(self,input,errors='strict'):
33 return Codec.encode(input,errors,self.mapping)
35 class StreamReader(Codec,codecs.StreamReader):
37 def __init__(self,stream,errors='strict',mapping=None):
39 codecs.StreamReader.__init__(self,stream,errors)
40 self.mapping = mapping
42 def decode(self,input,errors='strict'):
44 return Codec.decode(input,errors,self.mapping)
46 ### encodings module API
48 def getregentry():
50 return (Codec.encode,Codec.decode,StreamReader,StreamWriter)