]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.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 / undefined.py
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py
new file mode 100644 (file)
index 0000000..a077fd6
--- /dev/null
@@ -0,0 +1,49 @@
+""" Python 'undefined' Codec\r
+\r
+    This codec will always raise a ValueError exception when being\r
+    used. It is intended for use by the site.py file to switch off\r
+    automatic string to Unicode coercion.\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
+    def encode(self,input,errors='strict'):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+    def decode(self,input,errors='strict'):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        raise UnicodeError("undefined encoding")\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='undefined',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r