]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Lib/io.py
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 4/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Lib / io.py
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py
new file mode 100644 (file)
index 0000000..e047147
--- /dev/null
@@ -0,0 +1,90 @@
+"""The io module provides the Python interfaces to stream handling. The\r
+builtin open function is defined in this module.\r
+\r
+At the top of the I/O hierarchy is the abstract base class IOBase. It\r
+defines the basic interface to a stream. Note, however, that there is no\r
+separation between reading and writing to streams; implementations are\r
+allowed to raise an IOError if they do not support a given operation.\r
+\r
+Extending IOBase is RawIOBase which deals simply with the reading and\r
+writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\r
+an interface to OS files.\r
+\r
+BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\r
+subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\r
+streams that are readable, writable, and both respectively.\r
+BufferedRandom provides a buffered interface to random access\r
+streams. BytesIO is a simple stream of in-memory bytes.\r
+\r
+Another IOBase subclass, TextIOBase, deals with the encoding and decoding\r
+of streams into text. TextIOWrapper, which extends it, is a buffered text\r
+interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\r
+is a in-memory stream for text.\r
+\r
+Argument names are not part of the specification, and only the arguments\r
+of open() are intended to be used as keyword arguments.\r
+\r
+data:\r
+\r
+DEFAULT_BUFFER_SIZE\r
+\r
+   An int containing the default buffer size used by the module's buffered\r
+   I/O classes. open() uses the file's blksize (as obtained by os.stat) if\r
+   possible.\r
+"""\r
+# New I/O library conforming to PEP 3116.\r
+\r
+__author__ = ("Guido van Rossum <guido@python.org>, "\r
+              "Mike Verdone <mike.verdone@gmail.com>, "\r
+              "Mark Russell <mark.russell@zen.co.uk>, "\r
+              "Antoine Pitrou <solipsis@pitrou.net>, "\r
+              "Amaury Forgeot d'Arc <amauryfa@gmail.com>, "\r
+              "Benjamin Peterson <benjamin@python.org>")\r
+\r
+__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",\r
+           "BytesIO", "StringIO", "BufferedIOBase",\r
+           "BufferedReader", "BufferedWriter", "BufferedRWPair",\r
+           "BufferedRandom", "TextIOBase", "TextIOWrapper",\r
+           "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"]\r
+\r
+\r
+import _io\r
+import abc\r
+\r
+from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,\r
+                 open, FileIO, BytesIO, StringIO, BufferedReader,\r
+                 BufferedWriter, BufferedRWPair, BufferedRandom,\r
+                 IncrementalNewlineDecoder, TextIOWrapper)\r
+\r
+OpenWrapper = _io.open # for compatibility with _pyio\r
+\r
+# for seek()\r
+SEEK_SET = 0\r
+SEEK_CUR = 1\r
+SEEK_END = 2\r
+\r
+# Declaring ABCs in C is tricky so we do it here.\r
+# Method descriptions and default implementations are inherited from the C\r
+# version however.\r
+class IOBase(_io._IOBase):\r
+    __metaclass__ = abc.ABCMeta\r
+    __doc__ = _io._IOBase.__doc__\r
+\r
+class RawIOBase(_io._RawIOBase, IOBase):\r
+    __doc__ = _io._RawIOBase.__doc__\r
+\r
+class BufferedIOBase(_io._BufferedIOBase, IOBase):\r
+    __doc__ = _io._BufferedIOBase.__doc__\r
+\r
+class TextIOBase(_io._TextIOBase, IOBase):\r
+    __doc__ = _io._TextIOBase.__doc__\r
+\r
+RawIOBase.register(FileIO)\r
+\r
+for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,\r
+              BufferedRWPair):\r
+    BufferedIOBase.register(klass)\r
+\r
+for klass in (StringIO, TextIOWrapper):\r
+    TextIOBase.register(klass)\r
+del klass\r