{
    "content": [
        {
            "type": "text",
            "text": "# _io (pydoc)\n\n**Summary:** io\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (34 lines)\n- **CLASSES** (14 lines) — 9 subsections\n  - class BufferedRWPair (183 lines)\n  - class BufferedRandom (188 lines)\n  - class BufferedReader (187 lines)\n  - class BufferedWriter (189 lines)\n  - class BytesIO (158 lines)\n  - class FileIO (164 lines)\n  - class IncrementalNewlineDecoder (35 lines)\n  - class StringIO (168 lines)\n  - class TextIOWrapper (199 lines)\n- **FUNCTIONS** (1 lines) — 3 subsections\n  - open (119 lines)\n  - open_code (5 lines)\n  - text_encoding (11 lines)\n- **DATA** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nio\n\n### DESCRIPTION\n\nThe io module provides the Python interfaces to stream handling. The\nbuiltin open function is defined in this module.\n\nAt the top of the I/O hierarchy is the abstract base class IOBase. It\ndefines the basic interface to a stream. Note, however, that there is no\nseparation between reading and writing to streams; implementations are\nallowed to raise an OSError if they do not support a given operation.\n\nExtending IOBase is RawIOBase which deals simply with the reading and\nwriting of raw bytes to a stream. FileIO subclasses RawIOBase to provide\nan interface to OS files.\n\nBufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\nsubclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\nstreams that are readable, writable, and both respectively.\nBufferedRandom provides a buffered interface to random access\nstreams. BytesIO is a simple stream of in-memory bytes.\n\nAnother IOBase subclass, TextIOBase, deals with the encoding and decoding\nof streams into text. TextIOWrapper, which extends it, is a buffered text\ninterface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\nis an in-memory stream for text.\n\nArgument names are not part of the specification, and only the arguments\nof open() are intended to be used as keyword arguments.\n\ndata:\n\nDEFAULTBUFFERSIZE\n\nAn int containing the default buffer size used by the module's buffered\nI/O classes. open() uses the file's blksize (as obtained by os.stat) if\npossible.\n\n### CLASSES\n\nio.BufferedIOBase(io.IOBase)\nio.BufferedRWPair\nio.BufferedRandom\nio.BufferedReader\nio.BufferedWriter\nio.BytesIO\nio.RawIOBase(io.IOBase)\nio.FileIO\nio.TextIOBase(io.IOBase)\nio.StringIO\nio.TextIOWrapper\nbuiltins.object\nio.IncrementalNewlineDecoder\n\n#### class BufferedRWPair\n\n|  BufferedRWPair(reader, writer, buffersize=8192, /)\n|\n|  A buffered reader and writer object together.\n|\n|  A buffered reader object and buffered writer object put together to\n|  form a sequential IO object that can read and write. This is typically\n|  used with a socket or two-way pipe.\n|\n|  reader and writer are RawIOBase objects that are readable and\n|  writeable respectively. If the buffersize is omitted it defaults to\n|  DEFAULTBUFFERSIZE.\n|\n|  Method resolution order:\n|      BufferedRWPair\n|      BufferedIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  close(...)\n|      Flush and close the IO object.\n|\n|      This method has no effect if the file is already closed.\n|\n|  flush(...)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(...)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  peek(...)\n|\n|  read(...)\n|      Read and return up to n bytes.\n|\n|      If the argument is omitted, None, or negative, reads and\n|      returns all data until EOF.\n|\n|      If the argument is positive, and the underlying raw stream is\n|      not 'interactive', multiple raw reads may be issued to satisfy\n|      the byte count (unless EOF is reached first).  But for\n|      interactive raw streams (as well as sockets and pipes), at most\n|      one raw read will be issued, and a short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|      Returns None if the underlying raw stream was open in non-blocking\n|      mode and no data is available at the moment.\n|\n|  read1(...)\n|      Read and return up to n bytes, with at most one read() call\n|      to the underlying raw stream. A short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|  readable(...)\n|      Return whether object was opened for reading.\n|\n|      If False, read() will raise OSError.\n|\n|  readinto(...)\n|\n|  readinto1(...)\n|\n|  writable(...)\n|      Return whether object was opened for writing.\n|\n|      If False, write() will raise OSError.\n|\n|  write(...)\n|      Write the given buffer to the IO stream.\n|\n|      Returns the number of bytes written, which is always the length of b\n|      in bytes.\n|\n|      Raises BlockingIOError if the buffer is full and the\n|      underlying raw stream cannot accept more data at the moment.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from BufferedIOBase:\n|\n|  detach(self, /)\n|      Disconnect this buffer from its underlying raw stream and return it.\n|\n|      After the raw stream has been detached, the buffer is in an unusable\n|      state.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  fileno(self, /)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  readline(self, size=-1, /)\n|      Read and return a line from the stream.\n|\n|      If size is specified, at most size bytes will be read.\n|\n|      The line terminator is always b'\\n' for binary files; for text\n|      files, the newlines argument to open can be used to select the line\n|      terminator(s) recognized.\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  seek(...)\n|      Change stream position.\n|\n|      Change the stream position to the given byte offset. The offset is\n|      interpreted relative to the position indicated by whence.  Values\n|      for whence are:\n|\n|      * 0 -- start of stream (the default); offset should be zero or positive\n|      * 1 -- current stream position; offset may be negative\n|      * 2 -- end of stream; offset is usually negative\n|\n|      Return the new absolute position.\n|\n|  seekable(self, /)\n|      Return whether object supports random access.\n|\n|      If False, seek(), tell() and truncate() will raise OSError.\n|      This method may need to do a test seek().\n|\n|  tell(self, /)\n|      Return current stream position.\n|\n|  truncate(...)\n|      Truncate file to size bytes.\n|\n|      File pointer is left unchanged.  Size defaults to the current IO\n|      position as reported by tell().  Returns the new size.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class BufferedRandom\n\n|  BufferedRandom(raw, buffersize=8192)\n|\n|  A buffered interface to random access streams.\n|\n|  The constructor creates a reader and writer for a seekable stream,\n|  raw, given in the first argument. If the buffersize is omitted it\n|  defaults to DEFAULTBUFFERSIZE.\n|\n|  Method resolution order:\n|      BufferedRandom\n|      BufferedIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  sizeof(...)\n|      Size of object in memory, in bytes.\n|\n|  close(...)\n|      Flush and close the IO object.\n|\n|      This method has no effect if the file is already closed.\n|\n|  detach(...)\n|      Disconnect this buffer from its underlying raw stream and return it.\n|\n|      After the raw stream has been detached, the buffer is in an unusable\n|      state.\n|\n|  fileno(...)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  flush(...)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(...)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  peek(self, size=0, /)\n|\n|  read(self, size=-1, /)\n|      Read and return up to n bytes.\n|\n|      If the argument is omitted, None, or negative, reads and\n|      returns all data until EOF.\n|\n|      If the argument is positive, and the underlying raw stream is\n|      not 'interactive', multiple raw reads may be issued to satisfy\n|      the byte count (unless EOF is reached first).  But for\n|      interactive raw streams (as well as sockets and pipes), at most\n|      one raw read will be issued, and a short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|      Returns None if the underlying raw stream was open in non-blocking\n|      mode and no data is available at the moment.\n|\n|  read1(self, size=-1, /)\n|      Read and return up to n bytes, with at most one read() call\n|      to the underlying raw stream. A short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|  readable(...)\n|      Return whether object was opened for reading.\n|\n|      If False, read() will raise OSError.\n|\n|  readinto(self, buffer, /)\n|\n|  readinto1(self, buffer, /)\n|\n|  readline(self, size=-1, /)\n|      Read and return a line from the stream.\n|\n|      If size is specified, at most size bytes will be read.\n|\n|      The line terminator is always b'\\n' for binary files; for text\n|      files, the newlines argument to open can be used to select the line\n|      terminator(s) recognized.\n|\n|  seek(self, target, whence=0, /)\n|      Change stream position.\n|\n|      Change the stream position to the given byte offset. The offset is\n|      interpreted relative to the position indicated by whence.  Values\n|      for whence are:\n|\n|      * 0 -- start of stream (the default); offset should be zero or positive\n|      * 1 -- current stream position; offset may be negative\n|      * 2 -- end of stream; offset is usually negative\n|\n|      Return the new absolute position.\n|\n|  seekable(...)\n|      Return whether object supports random access.\n|\n|      If False, seek(), tell() and truncate() will raise OSError.\n|      This method may need to do a test seek().\n|\n|  tell(...)\n|      Return current stream position.\n|\n|  truncate(self, pos=None, /)\n|      Truncate file to size bytes.\n|\n|      File pointer is left unchanged.  Size defaults to the current IO\n|      position as reported by tell().  Returns the new size.\n|\n|  writable(...)\n|      Return whether object was opened for writing.\n|\n|      If False, write() will raise OSError.\n|\n|  write(self, buffer, /)\n|      Write the given buffer to the IO stream.\n|\n|      Returns the number of bytes written, which is always the length of b\n|      in bytes.\n|\n|      Raises BlockingIOError if the buffer is full and the\n|      underlying raw stream cannot accept more data at the moment.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|\n|  mode\n|\n|  name\n|\n|  raw\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class BufferedReader\n\n|  BufferedReader(raw, buffersize=8192)\n|\n|  Create a new buffered reader using the given readable raw IO object.\n|\n|  Method resolution order:\n|      BufferedReader\n|      BufferedIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  sizeof(...)\n|      Size of object in memory, in bytes.\n|\n|  close(...)\n|      Flush and close the IO object.\n|\n|      This method has no effect if the file is already closed.\n|\n|  detach(...)\n|      Disconnect this buffer from its underlying raw stream and return it.\n|\n|      After the raw stream has been detached, the buffer is in an unusable\n|      state.\n|\n|  fileno(...)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  flush(...)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(...)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  peek(self, size=0, /)\n|\n|  read(self, size=-1, /)\n|      Read and return up to n bytes.\n|\n|      If the argument is omitted, None, or negative, reads and\n|      returns all data until EOF.\n|\n|      If the argument is positive, and the underlying raw stream is\n|      not 'interactive', multiple raw reads may be issued to satisfy\n|      the byte count (unless EOF is reached first).  But for\n|      interactive raw streams (as well as sockets and pipes), at most\n|      one raw read will be issued, and a short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|      Returns None if the underlying raw stream was open in non-blocking\n|      mode and no data is available at the moment.\n|\n|  read1(self, size=-1, /)\n|      Read and return up to n bytes, with at most one read() call\n|      to the underlying raw stream. A short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|  readable(...)\n|      Return whether object was opened for reading.\n|\n|      If False, read() will raise OSError.\n|\n|  readinto(self, buffer, /)\n|\n|  readinto1(self, buffer, /)\n|\n|  readline(self, size=-1, /)\n|      Read and return a line from the stream.\n|\n|      If size is specified, at most size bytes will be read.\n|\n|      The line terminator is always b'\\n' for binary files; for text\n|      files, the newlines argument to open can be used to select the line\n|      terminator(s) recognized.\n|\n|  seek(self, target, whence=0, /)\n|      Change stream position.\n|\n|      Change the stream position to the given byte offset. The offset is\n|      interpreted relative to the position indicated by whence.  Values\n|      for whence are:\n|\n|      * 0 -- start of stream (the default); offset should be zero or positive\n|      * 1 -- current stream position; offset may be negative\n|      * 2 -- end of stream; offset is usually negative\n|\n|      Return the new absolute position.\n|\n|  seekable(...)\n|      Return whether object supports random access.\n|\n|      If False, seek(), tell() and truncate() will raise OSError.\n|      This method may need to do a test seek().\n|\n|  tell(...)\n|      Return current stream position.\n|\n|  truncate(self, pos=None, /)\n|      Truncate file to size bytes.\n|\n|      File pointer is left unchanged.  Size defaults to the current IO\n|      position as reported by tell().  Returns the new size.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|\n|  mode\n|\n|  name\n|\n|  raw\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from BufferedIOBase:\n|\n|  write(...)\n|      Write the given buffer to the IO stream.\n|\n|      Returns the number of bytes written, which is always the length of b\n|      in bytes.\n|\n|      Raises BlockingIOError if the buffer is full and the\n|      underlying raw stream cannot accept more data at the moment.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writable(self, /)\n|      Return whether object was opened for writing.\n|\n|      If False, write() will raise OSError.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class BufferedWriter\n\n|  BufferedWriter(raw, buffersize=8192)\n|\n|  A buffer for a writeable sequential RawIO object.\n|\n|  The constructor creates a BufferedWriter for the given writeable raw\n|  stream. If the buffersize is not given, it defaults to\n|  DEFAULTBUFFERSIZE.\n|\n|  Method resolution order:\n|      BufferedWriter\n|      BufferedIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  sizeof(...)\n|      Size of object in memory, in bytes.\n|\n|  close(...)\n|      Flush and close the IO object.\n|\n|      This method has no effect if the file is already closed.\n|\n|  detach(...)\n|      Disconnect this buffer from its underlying raw stream and return it.\n|\n|      After the raw stream has been detached, the buffer is in an unusable\n|      state.\n|\n|  fileno(...)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  flush(...)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(...)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  seek(self, target, whence=0, /)\n|      Change stream position.\n|\n|      Change the stream position to the given byte offset. The offset is\n|      interpreted relative to the position indicated by whence.  Values\n|      for whence are:\n|\n|      * 0 -- start of stream (the default); offset should be zero or positive\n|      * 1 -- current stream position; offset may be negative\n|      * 2 -- end of stream; offset is usually negative\n|\n|      Return the new absolute position.\n|\n|  seekable(...)\n|      Return whether object supports random access.\n|\n|      If False, seek(), tell() and truncate() will raise OSError.\n|      This method may need to do a test seek().\n|\n|  tell(...)\n|      Return current stream position.\n|\n|  truncate(self, pos=None, /)\n|      Truncate file to size bytes.\n|\n|      File pointer is left unchanged.  Size defaults to the current IO\n|      position as reported by tell().  Returns the new size.\n|\n|  writable(...)\n|      Return whether object was opened for writing.\n|\n|      If False, write() will raise OSError.\n|\n|  write(self, buffer, /)\n|      Write the given buffer to the IO stream.\n|\n|      Returns the number of bytes written, which is always the length of b\n|      in bytes.\n|\n|      Raises BlockingIOError if the buffer is full and the\n|      underlying raw stream cannot accept more data at the moment.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|\n|  mode\n|\n|  name\n|\n|  raw\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from BufferedIOBase:\n|\n|  read(...)\n|      Read and return up to n bytes.\n|\n|      If the argument is omitted, None, or negative, reads and\n|      returns all data until EOF.\n|\n|      If the argument is positive, and the underlying raw stream is\n|      not 'interactive', multiple raw reads may be issued to satisfy\n|      the byte count (unless EOF is reached first).  But for\n|      interactive raw streams (as well as sockets and pipes), at most\n|      one raw read will be issued, and a short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|      Returns None if the underlying raw stream was open in non-blocking\n|      mode and no data is available at the moment.\n|\n|  read1(...)\n|      Read and return up to n bytes, with at most one read() call\n|      to the underlying raw stream. A short result does not imply\n|      that EOF is imminent.\n|\n|      Returns an empty bytes object on EOF.\n|\n|  readinto(self, buffer, /)\n|\n|  readinto1(self, buffer, /)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  readable(self, /)\n|      Return whether object was opened for reading.\n|\n|      If False, read() will raise OSError.\n|\n|  readline(self, size=-1, /)\n|      Read and return a line from the stream.\n|\n|      If size is specified, at most size bytes will be read.\n|\n|      The line terminator is always b'\\n' for binary files; for text\n|      files, the newlines argument to open can be used to select the line\n|      terminator(s) recognized.\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class BytesIO\n\n|  BytesIO(initialbytes=b'')\n|\n|  Buffered I/O implementation using an in-memory bytes buffer.\n|\n|  Method resolution order:\n|      BytesIO\n|      BufferedIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  getstate(...)\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  setstate(...)\n|\n|  sizeof(...)\n|      Size of object in memory, in bytes.\n|\n|  close(self, /)\n|      Disable all I/O operations.\n|\n|  flush(self, /)\n|      Does nothing.\n|\n|  getbuffer(self, /)\n|      Get a read-write view over the contents of the BytesIO object.\n|\n|  getvalue(self, /)\n|      Retrieve the entire contents of the BytesIO object.\n|\n|  isatty(self, /)\n|      Always returns False.\n|\n|      BytesIO objects are not connected to a TTY-like device.\n|\n|  read(self, size=-1, /)\n|      Read at most size bytes, returned as a bytes object.\n|\n|      If the size argument is negative, read until EOF is reached.\n|      Return an empty bytes object at EOF.\n|\n|  read1(self, size=-1, /)\n|      Read at most size bytes, returned as a bytes object.\n|\n|      If the size argument is negative or omitted, read until EOF is reached.\n|      Return an empty bytes object at EOF.\n|\n|  readable(self, /)\n|      Returns True if the IO object can be read.\n|\n|  readinto(self, buffer, /)\n|      Read bytes into buffer.\n|\n|      Returns number of bytes read (0 for EOF), or None if the object\n|      is set not to block and has no data to read.\n|\n|  readline(self, size=-1, /)\n|      Next line from the file, as a bytes object.\n|\n|      Retain newline.  A non-negative size argument limits the maximum\n|      number of bytes to return (an incomplete line may be returned then).\n|      Return an empty bytes object at EOF.\n|\n|  readlines(self, size=None, /)\n|      List of bytes objects, each a line from the file.\n|\n|      Call readline() repeatedly and return a list of the lines so read.\n|      The optional size argument, if given, is an approximate bound on the\n|      total number of bytes in the lines returned.\n|\n|  seek(self, pos, whence=0, /)\n|      Change stream position.\n|\n|      Seek to byte offset pos relative to position indicated by whence:\n|           0  Start of stream (the default).  pos should be >= 0;\n|           1  Current position - pos may be negative;\n|           2  End of stream - pos usually negative.\n|      Returns the new absolute position.\n|\n|  seekable(self, /)\n|      Returns True if the IO object can be seeked.\n|\n|  tell(self, /)\n|      Current file position, an integer.\n|\n|  truncate(self, size=None, /)\n|      Truncate the file to at most size bytes.\n|\n|      Size defaults to the current file position, as returned by tell().\n|      The current file position is unchanged.  Returns the new size.\n|\n|  writable(self, /)\n|      Returns True if the IO object can be written.\n|\n|  write(self, b, /)\n|      Write bytes to file.\n|\n|      Return the number of bytes written.\n|\n|  writelines(self, lines, /)\n|      Write lines to the file.\n|\n|      Note that newlines are not added.  lines can be any iterable object\n|      producing bytes-like objects. This is equivalent to calling write() for\n|      each element.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|      True if the file is closed.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from BufferedIOBase:\n|\n|  detach(self, /)\n|      Disconnect this buffer from its underlying raw stream and return it.\n|\n|      After the raw stream has been detached, the buffer is in an unusable\n|      state.\n|\n|  readinto1(self, buffer, /)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  fileno(self, /)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class FileIO\n\n|  FileIO(file, mode='r', closefd=True, opener=None)\n|\n|  Open a file.\n|\n|  The mode can be 'r' (default), 'w', 'x' or 'a' for reading,\n|  writing, exclusive creation or appending.  The file will be created if it\n|  doesn't exist when opened for writing or appending; it will be truncated\n|  when opened for writing.  A FileExistsError will be raised if it already\n|  exists when opened for creating. Opening a file for creating implies\n|  writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode\n|  to allow simultaneous reading and writing. A custom opener can be used by\n|  passing a callable as *opener*. The underlying file descriptor for the file\n|  object is then obtained by calling opener with (*name*, *flags*).\n|  *opener* must return an open file descriptor (passing os.open as *opener*\n|  results in functionality similar to passing None).\n|\n|  Method resolution order:\n|      FileIO\n|      RawIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  close(self, /)\n|      Close the file.\n|\n|      A closed file cannot be used for further I/O operations.  close() may be\n|      called more than once without error.\n|\n|  fileno(self, /)\n|      Return the underlying file descriptor (an integer).\n|\n|  isatty(self, /)\n|      True if the file is connected to a TTY device.\n|\n|  read(self, size=-1, /)\n|      Read at most size bytes, returned as bytes.\n|\n|      Only makes one system call, so less data may be returned than requested.\n|      In non-blocking mode, returns None if no data is available.\n|      Return an empty bytes object at EOF.\n|\n|  readable(self, /)\n|      True if file was opened in a read mode.\n|\n|  readall(self, /)\n|      Read all data from the file, returned as bytes.\n|\n|      In non-blocking mode, returns as much as is immediately available,\n|      or None if no data is available.  Return an empty bytes object at EOF.\n|\n|  readinto(self, buffer, /)\n|      Same as RawIOBase.readinto().\n|\n|  seek(self, pos, whence=0, /)\n|      Move to new file position and return the file position.\n|\n|      Argument offset is a byte count.  Optional argument whence defaults to\n|      SEEKSET or 0 (offset from start of file, offset should be >= 0); other values\n|      are SEEKCUR or 1 (move relative to current position, positive or negative),\n|      and SEEKEND or 2 (move relative to end of file, usually negative, although\n|      many platforms allow seeking beyond the end of a file).\n|\n|      Note that not all file objects are seekable.\n|\n|  seekable(self, /)\n|      True if file supports random-access.\n|\n|  tell(self, /)\n|      Current file position.\n|\n|      Can raise OSError for non seekable files.\n|\n|  truncate(self, size=None, /)\n|      Truncate the file to at most size bytes and return the truncated size.\n|\n|      Size defaults to the current file position, as returned by tell().\n|      The current file position is changed to the value of size.\n|\n|  writable(self, /)\n|      True if file was opened in a write mode.\n|\n|  write(self, b, /)\n|      Write buffer b to file, return number of bytes written.\n|\n|      Only makes one system call, so not all of the data may be written.\n|      The number of bytes actually written is returned.  In non-blocking mode,\n|      returns None if the write would block.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|      True if the file is closed\n|\n|  closefd\n|      True if the file descriptor will be closed by close().\n|\n|  mode\n|      String giving the file mode\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  flush(self, /)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  readline(self, size=-1, /)\n|      Read and return a line from the stream.\n|\n|      If size is specified, at most size bytes will be read.\n|\n|      The line terminator is always b'\\n' for binary files; for text\n|      files, the newlines argument to open can be used to select the line\n|      terminator(s) recognized.\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class IncrementalNewlineDecoder\n\n|  IncrementalNewlineDecoder(decoder, translate, errors='strict')\n|\n|  Codec used when reading a file in universal newlines mode.\n|\n|  It wraps another incremental decoder, translating \\r\\n and \\r into \\n.\n|  It also records the types of newlines encountered.  When used with\n|  translate=False, it ensures that the newline sequence is returned in\n|  one piece. When used with decoder=None, it expects unicode strings as\n|  decode input and translates newlines without first invoking an external\n|  decoder.\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  decode(self, /, input, final=False)\n|\n|  getstate(self, /)\n|\n|  reset(self, /)\n|\n|  setstate(self, state, /)\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  newlines\n\n#### class StringIO\n\n|  StringIO(initialvalue='', newline='\\n')\n|\n|  Text I/O implementation using an in-memory buffer.\n|\n|  The initialvalue argument sets the value of object.  The newline\n|  argument is like the one of TextIOWrapper's constructor.\n|\n|  Method resolution order:\n|      StringIO\n|      TextIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  getstate(...)\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  setstate(...)\n|\n|  close(self, /)\n|      Close the IO object.\n|\n|      Attempting any further operation after the object is closed\n|      will raise a ValueError.\n|\n|      This method has no effect if the file is already closed.\n|\n|  getvalue(self, /)\n|      Retrieve the entire contents of the object.\n|\n|  read(self, size=-1, /)\n|      Read at most size characters, returned as a string.\n|\n|      If the argument is negative or omitted, read until EOF\n|      is reached. Return an empty string at EOF.\n|\n|  readable(self, /)\n|      Returns True if the IO object can be read.\n|\n|  readline(self, size=-1, /)\n|      Read until newline or EOF.\n|\n|      Returns an empty string if EOF is hit immediately.\n|\n|  seek(self, pos, whence=0, /)\n|      Change stream position.\n|\n|      Seek to character offset pos relative to position indicated by whence:\n|          0  Start of stream (the default).  pos should be >= 0;\n|          1  Current position - pos must be 0;\n|          2  End of stream - pos must be 0.\n|      Returns the new absolute position.\n|\n|  seekable(self, /)\n|      Returns True if the IO object can be seeked.\n|\n|  tell(self, /)\n|      Tell the current file position.\n|\n|  truncate(self, pos=None, /)\n|      Truncate size to pos.\n|\n|      The pos argument defaults to the current file position, as\n|      returned by tell().  The current file position is unchanged.\n|      Returns the new absolute position.\n|\n|  writable(self, /)\n|      Returns True if the IO object can be written.\n|\n|  write(self, s, /)\n|      Write string to file.\n|\n|      Returns the number of characters written, which is always equal to\n|      the length of the string.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|\n|  linebuffering\n|\n|  newlines\n|      Line endings translated so far.\n|\n|      Only line endings translated during reading are considered.\n|\n|      Subclasses should override.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from TextIOBase:\n|\n|  detach(...)\n|      Separate the underlying buffer from the TextIOBase and return it.\n|\n|      After the underlying buffer has been detached, the TextIO is in an\n|      unusable state.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from TextIOBase:\n|\n|  encoding\n|      Encoding of the text stream.\n|\n|      Subclasses should override.\n|\n|  errors\n|      The error setting of the decoder or encoder.\n|\n|      Subclasses should override.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  fileno(self, /)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  flush(self, /)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(self, /)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n#### class TextIOWrapper\n\n|  TextIOWrapper(buffer, encoding=None, errors=None, newline=None, linebuffering=False, writethrough=False)\n|\n|  Character and line based layer over a BufferedIOBase object, buffer.\n|\n|  encoding gives the name of the encoding that the stream will be\n|  decoded or encoded with. It defaults to locale.getpreferredencoding(False).\n|\n|  errors determines the strictness of encoding and decoding (see\n|  help(codecs.Codec) or the documentation for codecs.register) and\n|  defaults to \"strict\".\n|\n|  newline controls how line endings are handled. It can be None, '',\n|  '\\n', '\\r', and '\\r\\n'.  It works as follows:\n|\n|  * On input, if newline is None, universal newlines mode is\n|    enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n|    these are translated into '\\n' before being returned to the\n|    caller. If it is '', universal newline mode is enabled, but line\n|    endings are returned to the caller untranslated. If it has any of\n|    the other legal values, input lines are only terminated by the given\n|    string, and the line ending is returned to the caller untranslated.\n|\n|  * On output, if newline is None, any '\\n' characters written are\n|    translated to the system default line separator, os.linesep. If\n|    newline is '' or '\\n', no translation takes place. If newline is any\n|    of the other legal values, any '\\n' characters written are translated\n|    to the given string.\n|\n|  If linebuffering is True, a call to flush is implied when a call to\n|  write contains a newline character.\n|\n|  Method resolution order:\n|      TextIOWrapper\n|      TextIOBase\n|      IOBase\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  close(self, /)\n|      Flush and close the IO object.\n|\n|      This method has no effect if the file is already closed.\n|\n|  detach(self, /)\n|      Separate the underlying buffer from the TextIOBase and return it.\n|\n|      After the underlying buffer has been detached, the TextIO is in an\n|      unusable state.\n|\n|  fileno(self, /)\n|      Returns underlying file descriptor if one exists.\n|\n|      OSError is raised if the IO object does not use a file descriptor.\n|\n|  flush(self, /)\n|      Flush write buffers, if applicable.\n|\n|      This is not implemented for read-only and non-blocking streams.\n|\n|  isatty(self, /)\n|      Return whether this is an 'interactive' stream.\n|\n|      Return False if it can't be determined.\n|\n|  read(self, size=-1, /)\n|      Read at most n characters from stream.\n|\n|      Read from underlying buffer until we have n characters or we hit EOF.\n|      If n is negative or omitted, read until EOF.\n|\n|  readable(self, /)\n|      Return whether object was opened for reading.\n|\n|      If False, read() will raise OSError.\n|\n|  readline(self, size=-1, /)\n|      Read until newline or EOF.\n|\n|      Returns an empty string if EOF is hit immediately.\n|\n|  reconfigure(self, /, *, encoding=None, errors=None, newline=None, linebuffering=None, writethrough=None)\n|      Reconfigure the text stream with new parameters.\n|\n|      This also does an implicit stream flush.\n|\n|  seek(self, cookie, whence=0, /)\n|      Change stream position.\n|\n|      Change the stream position to the given byte offset. The offset is\n|      interpreted relative to the position indicated by whence.  Values\n|      for whence are:\n|\n|      * 0 -- start of stream (the default); offset should be zero or positive\n|      * 1 -- current stream position; offset may be negative\n|      * 2 -- end of stream; offset is usually negative\n|\n|      Return the new absolute position.\n|\n|  seekable(self, /)\n|      Return whether object supports random access.\n|\n|      If False, seek(), tell() and truncate() will raise OSError.\n|      This method may need to do a test seek().\n|\n|  tell(self, /)\n|      Return current stream position.\n|\n|  truncate(self, pos=None, /)\n|      Truncate file to size bytes.\n|\n|      File pointer is left unchanged.  Size defaults to the current IO\n|      position as reported by tell().  Returns the new size.\n|\n|  writable(self, /)\n|      Return whether object was opened for writing.\n|\n|      If False, write() will raise OSError.\n|\n|  write(self, text, /)\n|      Write string to stream.\n|      Returns the number of characters written (which is always equal to\n|      the length of the string).\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  buffer\n|\n|  closed\n|\n|  encoding\n|      Encoding of the text stream.\n|\n|      Subclasses should override.\n|\n|  errors\n|      The error setting of the decoder or encoder.\n|\n|      Subclasses should override.\n|\n|  linebuffering\n|\n|  name\n|\n|  newlines\n|      Line endings translated so far.\n|\n|      Only line endings translated during reading are considered.\n|\n|      Subclasses should override.\n|\n|  writethrough\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from IOBase:\n|\n|  del(...)\n|\n|  enter(...)\n|\n|  exit(...)\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  readlines(self, hint=-1, /)\n|      Return a list of lines from the stream.\n|\n|      hint can be specified to control the number of lines read: no more\n|      lines will be read if the total size (in bytes/characters) of all\n|      lines so far exceeds hint.\n|\n|  writelines(self, lines, /)\n|      Write a list of lines to stream.\n|\n|      Line separators are not added, so it is usual for each of the\n|      lines provided to have a line separator at the end.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from IOBase:\n|\n|  dict\n\n### FUNCTIONS\n\n#### open\n\nOpen file and return a stream.  Raise OSError upon failure.\n\nfile is either a text or byte string giving the name (and the path\nif the file isn't in the current working directory) of the file to\nbe opened or an integer file descriptor of the file to be\nwrapped. (If a file descriptor is given, it is closed when the\nreturned I/O object is closed, unless closefd is set to False.)\n\nmode is an optional string that specifies the mode in which the file\nis opened. It defaults to 'r' which means open for reading in text\nmode.  Other common values are 'w' for writing (truncating the file if\nit already exists), 'x' for creating and writing to a new file, and\n'a' for appending (which on some Unix systems, means that all writes\nappend to the end of the file regardless of the current seek position).\nIn text mode, if encoding is not specified the encoding used is platform\ndependent: locale.getpreferredencoding(False) is called to get the\ncurrent locale encoding. (For reading and writing raw bytes use binary\nmode and leave encoding unspecified.) The available modes are:\n\n========= ===============================================================\nCharacter Meaning\n--------- ---------------------------------------------------------------\n'r'       open for reading (default)\n'w'       open for writing, truncating the file first\n'x'       create a new file and open it for writing\n'a'       open for writing, appending to the end of the file if it exists\n'b'       binary mode\n't'       text mode (default)\n'+'       open a disk file for updating (reading and writing)\n'U'       universal newline mode (deprecated)\n========= ===============================================================\n\nThe default mode is 'rt' (open for reading text). For binary random\naccess, the mode 'w+b' opens and truncates the file to 0 bytes, while\n'r+b' opens the file without truncation. The 'x' mode implies 'w' and\nraises an `FileExistsError` if the file already exists.\n\nPython distinguishes between files opened in binary and text modes,\neven when the underlying operating system doesn't. Files opened in\nbinary mode (appending 'b' to the mode argument) return contents as\nbytes objects without any decoding. In text mode (the default, or when\n't' is appended to the mode argument), the contents of the file are\nreturned as strings, the bytes having been first decoded using a\nplatform-dependent encoding or using the specified encoding if given.\n\n'U' mode is deprecated and will raise an exception in future versions\nof Python.  It has no effect in Python 3.  Use newline to control\nuniversal newlines mode.\n\nbuffering is an optional integer used to set the buffering policy.\nPass 0 to switch buffering off (only allowed in binary mode), 1 to select\nline buffering (only usable in text mode), and an integer > 1 to indicate\nthe size of a fixed-size chunk buffer.  When no buffering argument is\ngiven, the default buffering policy works as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of the buffer\nis chosen using a heuristic trying to determine the underlying device's\n\"block size\" and falling back on `io.DEFAULTBUFFERSIZE`.\nOn many systems, the buffer will typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which isatty() returns True)\nuse line buffering.  Other text files use the policy described above\nfor binary files.\n\nencoding is the name of the encoding used to decode or encode the\nfile. This should only be used in text mode. The default encoding is\nplatform dependent, but any encoding supported by Python can be\npassed.  See the codecs module for the list of supported encodings.\n\nerrors is an optional string that specifies how encoding errors are to\nbe handled---this argument should not be used in binary mode. Pass\n'strict' to raise a ValueError exception if there is an encoding error\n(the default of None has the same effect), or pass 'ignore' to ignore\nerrors. (Note that ignoring encoding errors can lead to data loss.)\nSee the documentation for codecs.register or run 'help(codecs.Codec)'\nfor a list of the permitted encoding error strings.\n\nnewline controls how universal newlines works (it only applies to text\nmode). It can be None, '', '\\n', '\\r', and '\\r\\n'.  It works as\nfollows:\n\n* On input, if newline is None, universal newlines mode is\nenabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\nthese are translated into '\\n' before being returned to the\ncaller. If it is '', universal newline mode is enabled, but line\nendings are returned to the caller untranslated. If it has any of\nthe other legal values, input lines are only terminated by the given\nstring, and the line ending is returned to the caller untranslated.\n\n* On output, if newline is None, any '\\n' characters written are\ntranslated to the system default line separator, os.linesep. If\nnewline is '' or '\\n', no translation takes place. If newline is any\nof the other legal values, any '\\n' characters written are translated\nto the given string.\n\nIf closefd is False, the underlying file descriptor will be kept open\nwhen the file is closed. This does not work when a file name is given\nand must be True in that case.\n\nA custom opener can be used by passing a callable as *opener*. The\nunderlying file descriptor for the file object is then obtained by\ncalling *opener* with (*file*, *flags*). *opener* must return an open\nfile descriptor (passing os.open as *opener* results in functionality\nsimilar to passing None).\n\nopen() returns a file object whose type depends on the mode, and\nthrough which the standard file operations such as reading and writing\nare performed. When open() is used to open a file in a text mode ('w',\n'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\na file in a binary mode, the returned class varies: in read binary\nmode, it returns a BufferedReader; in write binary and append binary\nmodes, it returns a BufferedWriter, and in read/write mode, it returns\na BufferedRandom.\n\nIt is also possible to use a string or bytearray as a file for both\nreading and writing. For strings StringIO can be used like a file\nopened in a text mode, and for bytes a BytesIO can be used like a file\nopened in a binary mode.\n\n#### open_code\n\nOpens the provided file with the intent to import the contents.\n\nThis may perform extra validation beyond open(), but is otherwise interchangeable\nwith calling open(path, 'rb').\n\n#### text_encoding\n\nA helper function to choose the text encoding.\n\nWhen encoding is not None, just return it.\nOtherwise, return the default text encoding (i.e. \"locale\").\n\nThis function emits an EncodingWarning if encoding is None and\nsys.flags.warndefaultencoding is true.\n\nThis can be used in APIs with an encoding=None parameter.\nHowever, please consider using encoding=\"utf-8\" for new APIs.\n\n### DATA\n\nDEFAULTBUFFERSIZE = 8192\n\n### FILE\n\n(built-in)\n\n"
        }
    ],
    "structuredContent": {
        "command": "_io",
        "section": "",
        "mode": "pydoc",
        "summary": "io",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 14,
                "subsections": [
                    {
                        "name": "class BufferedRWPair",
                        "lines": 183
                    },
                    {
                        "name": "class BufferedRandom",
                        "lines": 188
                    },
                    {
                        "name": "class BufferedReader",
                        "lines": 187
                    },
                    {
                        "name": "class BufferedWriter",
                        "lines": 189
                    },
                    {
                        "name": "class BytesIO",
                        "lines": 158
                    },
                    {
                        "name": "class FileIO",
                        "lines": 164
                    },
                    {
                        "name": "class IncrementalNewlineDecoder",
                        "lines": 35
                    },
                    {
                        "name": "class StringIO",
                        "lines": 168
                    },
                    {
                        "name": "class TextIOWrapper",
                        "lines": 199
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "open",
                        "lines": 119
                    },
                    {
                        "name": "open_code",
                        "lines": 5
                    },
                    {
                        "name": "text_encoding",
                        "lines": 11
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}