--- /dev/null
+""" Python 'raw-unicode-escape' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+ # Note: Binding these as C functions will result in the class not\r
+ # converting them to methods. This is intended.\r
+ encode = codecs.raw_unicode_escape_encode\r
+ decode = codecs.raw_unicode_escape_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+ def encode(self, input, final=False):\r
+ return codecs.raw_unicode_escape_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+ def decode(self, input, final=False):\r
+ return codecs.raw_unicode_escape_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+ pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+ pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+ return codecs.CodecInfo(\r
+ name='raw-unicode-escape',\r
+ encode=Codec.encode,\r
+ decode=Codec.decode,\r
+ incrementalencoder=IncrementalEncoder,\r
+ incrementaldecoder=IncrementalDecoder,\r
+ streamwriter=StreamWriter,\r
+ streamreader=StreamReader,\r
+ )\r