Mention Giampolo R's new FTP TLS support in the what's new file
[python.git] / Lib / encodings / raw_unicode_escape.py
blob2b919b40d3788a7bd7dab3a983af091deb48a235
1 """ Python 'raw-unicode-escape' Codec
4 Written by Marc-Andre Lemburg (mal@lemburg.com).
6 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
8 """
9 import codecs
11 ### Codec APIs
13 class Codec(codecs.Codec):
15 # Note: Binding these as C functions will result in the class not
16 # converting them to methods. This is intended.
17 encode = codecs.raw_unicode_escape_encode
18 decode = codecs.raw_unicode_escape_decode
20 class IncrementalEncoder(codecs.IncrementalEncoder):
21 def encode(self, input, final=False):
22 return codecs.raw_unicode_escape_encode(input, self.errors)[0]
24 class IncrementalDecoder(codecs.IncrementalDecoder):
25 def decode(self, input, final=False):
26 return codecs.raw_unicode_escape_decode(input, self.errors)[0]
28 class StreamWriter(Codec,codecs.StreamWriter):
29 pass
31 class StreamReader(Codec,codecs.StreamReader):
32 pass
34 ### encodings module API
36 def getregentry():
37 return codecs.CodecInfo(
38 name='raw-unicode-escape',
39 encode=Codec.encode,
40 decode=Codec.decode,
41 incrementalencoder=IncrementalEncoder,
42 incrementaldecoder=IncrementalDecoder,
43 streamwriter=StreamWriter,
44 streamreader=StreamReader,