]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 4/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Lib / encodings / raw_unicode_escape.py
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py
new file mode 100644 (file)
index 0000000..cb0abfb
--- /dev/null
@@ -0,0 +1,45 @@
+""" 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