the io module provides the python interfaces to stream handling the builtin open function is defined in this module at the top of the io hierarchy is the abstract base class iobase it defines the basic interface to a stream note however that there is no separation between reading and writing to streams implementations are allowed to raise an oserror if they do not support a given operation extending iobase is rawiobase which deals simply with the reading and writing of raw bytes to a stream fileio subclasses rawiobase to provide an interface to os files bufferediobase deals with buffering on a raw byte stream rawiobase its subclasses bufferedwriter bufferedreader and bufferedrwpair buffer streams that are readable writable and both respectively bufferedrandom provides a buffered interface to random access streams bytesio is a simple stream of inmemory bytes another iobase subclass textiobase deals with the encoding and decoding of streams into text textiowrapper which extends it is a buffered text interface to a buffered raw stream bufferediobase finally stringio is an inmemory stream for text argument names are not part of the specification and only the arguments of open are intended to be used as keyword arguments data defaultbuffersize an int containing the default buffer size used by the module s buffered io classes open uses the file s blksize as obtained by os stat if possible new io library conforming to pep 3116 pretend this exception was created here for seek declaring abcs in c is tricky so we do it here method descriptions and default implementations are inherited from the c version however new i o library conforming to pep 3116 pretend this exception was created here for seek declaring abcs in c is tricky so we do it here method descriptions and default implementations are inherited from the c version however
__author__ = ("Guido van Rossum <guido@python.org>, "
              "Mike Verdone <mike.verdone@gmail.com>, "
              "Mark Russell <mark.russell@zen.co.uk>, "
              "Antoine Pitrou <solipsis@pitrou.net>, "
              "Amaury Forgeot d'Arc <amauryfa@gmail.com>, "
              "Benjamin Peterson <benjamin@python.org>")

__all__ = ["BlockingIOError", "open", "open_code", "IOBase", "RawIOBase",
           "FileIO", "BytesIO", "StringIO", "BufferedIOBase",
           "BufferedReader", "BufferedWriter", "BufferedRWPair",
           "BufferedRandom", "TextIOBase", "TextIOWrapper",
           "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END",
           "DEFAULT_BUFFER_SIZE", "text_encoding", "IncrementalNewlineDecoder"]


import _io
import abc

from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
                 open, open_code, FileIO, BytesIO, StringIO, BufferedReader,
                 BufferedWriter, BufferedRWPair, BufferedRandom,
                 IncrementalNewlineDecoder, text_encoding, TextIOWrapper)



UnsupportedOperation.__module__ = "io"


SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2




class IOBase(_io._IOBase, metaclass=abc.ABCMeta):
    __doc__ = _io._IOBase.__doc__

class RawIOBase(_io._RawIOBase, IOBase):
    __doc__ = _io._RawIOBase.__doc__

class BufferedIOBase(_io._BufferedIOBase, IOBase):
    __doc__ = _io._BufferedIOBase.__doc__

class TextIOBase(_io._TextIOBase, IOBase):
    __doc__ = _io._TextIOBase.__doc__

RawIOBase.register(FileIO)

for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,
              BufferedRWPair):
    BufferedIOBase.register(klass)

for klass in (StringIO, TextIOWrapper):
    TextIOBase.register(klass)
del klass

try:
    from _io import _WindowsConsoleIO
except ImportError:
    pass
else:
    RawIOBase.register(_WindowsConsoleIO)