Your IP : 3.135.186.233


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/_pyio.cpython-311.opt-1.pyc

�

c��f�o���dZddlZddlZddlZddlZddlZddlZddlmZ	ej
dvrddlmZ
ndZ
ddlZddlmZmZmZmZhd�Zeed��r4e�ej��e�ej��d	ZeZeed
��pejjZeZd3d�Ze		d4d���Z d�Z!	ej"Z"n
#e#$re!Z"YnwxYwd�Z$	ej%Z%n#e#$rGd�de&e'��Z%YnwxYwGd�dej(���Z)ej)�*e)��Gd�de)��Z+ej+�*e+��ddl,m-Z-e+�*e-��Gd�de)��Z.ej.�*e.��Gd�de.��Z/Gd�d e.��Z0Gd!�d"e/��Z1Gd#�d$e/��Z2Gd%�d&e.��Z3Gd'�d(e2e1��Z4Gd)�d*e+��Z-Gd+�d,e)��Z5ej5�*e5��Gd-�d.ej6��Z7Gd/�d0e5��Z8Gd1�d2e8��Z9dS)5z)
Python implementation of the io module.
�N)�
allocate_lock>�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END>r���	SEEK_HOLEi �gettotalrefcountrc��|�Jtjjrd}nd}tjjr#ddl}|�dt|dz��|S)a
    A helper function to choose the text encoding.

    When encoding is not None, this function returns it.
    Otherwise, this function returns the default text encoding
    (i.e. "locale" or "utf-8" depends on UTF-8 mode).

    This function emits an EncodingWarning if *encoding* is None and
    sys.flags.warn_default_encoding is true.

    This can be used in APIs with an encoding=None parameter
    that pass it to TextIOWrapper or open.
    However, please consider using encoding="utf-8" for new APIs.
    N�utf-8�localerz"'encoding' argument not specified.r)�sys�flags�	utf8_mode�warn_default_encoding�warnings�warn�EncodingWarning)�encoding�
stacklevelrs   �,/opt/alt/python311/lib64/python3.11/_pyio.py�
text_encodingr+s`�����9��	 ��H�H��H��9�*�	;��O�O�O��M�M�>�)�:��>�
;�
;�
;��O��r���Tc�*�t|t��stj|��}t|tt
tf��st
d|z���t|t��st
d|z���t|t��st
d|z���|�'t|t��st
d|z���|�'t|t��st
d|z���t|��}|td��z
s t|��t|��krtd|z���d|v}	d	|v}
d
|v}d|v}d|v}
d
|v}d|v}|r|rtd���|	|
z|z|zdkrtd���|	s|
s|s|std���|r|�td���|r|�td���|r|�td���|r&|dkr ddl
}|�dtd��t||	rdpd|
rd	pdz|rd
pdz|rdpdz|
rdpdz||���}|}	d}|dks|dkr|���rd}d}|dkrSt}	tj|�����j}|dkr|}n#t&t(f$rYnwxYw|dkrtd���|dkr|r|Std���|
rt+||��}n<|	s|s|rt-||��}n%|
rt/||��}ntd |z���|}|r|St1|��}t3|||||��}|}||_|S#|����xYw)!a�Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)

    mode is an optional string that specifies the mode in which the file is
    opened. It defaults to 'r' which means open for reading in text mode. Other
    common values are 'w' for writing (truncating the file if it already
    exists), 'x' for exclusive creation of a new file, and 'a' for appending
    (which on some Unix systems, means that all writes append to the end of the
    file regardless of the current seek position). In text mode, if encoding is
    not specified the encoding used is platform dependent. (For reading and
    writing raw bytes use binary mode and leave encoding unspecified.) The
    available modes are:

    ========= ===============================================================
    Character Meaning
    --------- ---------------------------------------------------------------
    'r'       open for reading (default)
    'w'       open for writing, truncating the file first
    'x'       create a new file and open it for writing
    'a'       open for writing, appending to the end of the file if it exists
    'b'       binary mode
    't'       text mode (default)
    '+'       open a disk file for updating (reading and writing)
    ========= ===============================================================

    The default mode is 'rt' (open for reading text). For binary random
    access, the mode 'w+b' opens and truncates the file to 0 bytes, while
    'r+b' opens the file without truncation. The 'x' mode implies 'w' and
    raises an `FileExistsError` if the file already exists.

    Python distinguishes between files opened in binary and text modes,
    even when the underlying operating system doesn't. Files opened in
    binary mode (appending 'b' to the mode argument) return contents as
    bytes objects without any decoding. In text mode (the default, or when
    't' is appended to the mode argument), the contents of the file are
    returned as strings, the bytes having been first decoded using a
    platform-dependent encoding or using the specified encoding if given.

    buffering is an optional integer used to set the buffering policy.
    Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
    line buffering (only usable in text mode), and an integer > 1 to indicate
    the size of a fixed-size chunk buffer.  When no buffering argument is
    given, the default buffering policy works as follows:

    * Binary files are buffered in fixed-size chunks; the size of the buffer
      is chosen using a heuristic trying to determine the underlying device's
      "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
      On many systems, the buffer will typically be 4096 or 8192 bytes long.

    * "Interactive" text files (files for which isatty() returns True)
      use line buffering.  Other text files use the policy described above
      for binary files.

    encoding is the str name of the encoding used to decode or encode the
    file. This should only be used in text mode. The default encoding is
    platform dependent, but any encoding supported by Python can be
    passed.  See the codecs module for the list of supported encodings.

    errors is an optional string that specifies how encoding errors are to
    be handled---this argument should not be used in binary mode. Pass
    'strict' to raise a ValueError exception if there is an encoding error
    (the default of None has the same effect), or pass 'ignore' to ignore
    errors. (Note that ignoring encoding errors can lead to data loss.)
    See the documentation for codecs.register for a list of the permitted
    encoding error strings.

    newline is a string controlling how universal newlines works (it only
    applies to text mode). It can be None, '', '\n', '\r', and '\r\n'.  It works
    as follows:

    * On input, if newline is None, universal newlines mode is
      enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
      these are translated into '\n' before being returned to the
      caller. If it is '', universal newline mode is enabled, but line
      endings are returned to the caller untranslated. If it has any of
      the other legal values, input lines are only terminated by the given
      string, and the line ending is returned to the caller untranslated.

    * On output, if newline is None, any '\n' characters written are
      translated to the system default line separator, os.linesep. If
      newline is '', no translation takes place. If newline is any of the
      other legal values, any '\n' characters written are translated to
      the given string.

    closedfd is a bool. If closefd is False, the underlying file descriptor will
    be kept open when the file is closed. This does not work when a file name is
    given and must be True in that case.

    The newly created file is non-inheritable.

    A custom opener can be used by passing a callable as *opener*. The
    underlying file descriptor for the file object is then obtained by calling
    *opener* with (*file*, *flags*). *opener* must return an open file
    descriptor (passing os.open as *opener* results in functionality similar to
    passing None).

    open() returns a file object whose type depends on the mode, and
    through which the standard file operations such as reading and writing
    are performed. When open() is used to open a file in a text mode ('w',
    'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
    a file in a binary mode, the returned class varies: in read binary
    mode, it returns a BufferedReader; in write binary and append binary
    modes, it returns a BufferedWriter, and in read/write mode, it returns
    a BufferedRandom.

    It is also possible to use a string or bytearray as a file for both
    reading and writing. For strings StringIO can be used like a file
    opened in a text mode, and for bytes a BytesIO can be used like a file
    opened in a binary mode.
    zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rN�invalid encoding: %r�invalid errors: %rzaxrwb+t�xr�w�a�+�t�bz'can't have text and binary mode at oncerz)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argumentrzaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be usedr�)�openerFrTzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueErrorrr�RuntimeWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReaderr�
TextIOWrapper�mode�close)�filerB�	bufferingr�errors�newline�closefdr*�modes�creating�reading�writing�	appending�updating�text�binaryr�raw�result�line_buffering�bs�buffers                      r�openrVLs���n�d�C� � ���y������d�S�%��-�.�.�3��*�T�1�2�2�2��d�C� � �3��*�T�1�2�2�2��i��%�%�=��/�)�;�<�<�<���J�x��$=�$=���.��9�:�:�:�
��*�V�S�"9�"9���,�v�5�6�6�6���I�I�E��s�9�~�~��4��T���S��Z�Z�!7�!7��+�d�2�3�3�3��e�|�H��U�l�G��U�l�G��u��I��e�|�H��%�<�D�
�E�\�F��D��D��B�C�C�C��'��G�#�i�/�!�3�3��D�E�E�E��L��L�7�L�i�L��J�K�K�K�
�J�(�&��H�I�I�I�
�H�&�$��F�G�G�G�
�H�'�%��F�G�G�G�
�)�)�q�.�.������
�
�C�$�a�	)�	)�	)����"�s�(�b��/�c�'�R�)��/�c�'�R�)��#��)�r�+��"�s�(�b�	*�
��
)�)�)�C��F�&�����>�>�Y��]�]�s�z�z�|�|�]��I�!�N��q�=�=�+�I�
#��X�c�j�j�l�l�+�+�6����6�6� "�I���	�^�,�
�
�
���
����
�q�=�=��5�6�6�6���>�>��
��
��=�>�>�>��	8�#�C��3�3�F�F�
�	8��	8�I�	8�#�C��3�3�F�F�
�	8�#�C��3�3�F�F��/�$�6�7�7�7����	��M� ��*�*���V�X�v�w��O�O������	��
���������
���s=�3M;�+J4�+	M;�4K�M;�K�!M;�*A#M;�,M;�;Nc�b�ddl}|�dtd��t|d��S)azOpens the provided file with mode ``'rb'``. This function
    should be used when the intent is to treat the contents as
    executable code.

    ``path`` should be an absolute path.

    When supported by the runtime, this function can be hooked
    in order to allow embedders more control over code files.
    This functionality is not supported on the current runtime.
    rNz(_pyio.open_code() may not be using hooksr�rb)rrr5rV)�pathrs  r�_open_code_with_warningrZs;���O�O�O��M�M�<� �!�%�%�%���d���rc��|dkr/ddl}|�dtd���tatStdt�d|�����)N�OpenWrapperrz+OpenWrapper is deprecated, use open insteadr)rzmodule z has no attribute )rr�DeprecationWarningrVr\r=�__name__)�namers  r�__getattr__r`2sg���}���	�����
�
�C�(�Q�	�	8�	8�	8�����
�I�8�I�I��I�I�
J�
J�Jrc��eZdZdS)�UnsupportedOperationN)r^�
__module__�__qualname__�rrrbrbGs�������rrbc���eZdZdZd�Zdd�Zd�Zdd�Zd�Zd	Z	d
�Z
d�Zd�Zdd
�Z
d�Zdd�Zd�Zdd�Zed���Zdd�Zd�Zd�Zd�Zd�Zd d�Zd�Zd�Zdd�Zd�ZdS)!�IOBasea�The abstract base class for all I/O classes.

    This class provides dummy implementations for many methods that
    derived classes can override selectively; the default implementations
    represent a file that cannot be read, written or seeked.

    Even though IOBase does not declare read or write because
    their signatures will vary, implementations and clients should
    consider those methods part of the interface. Also, implementations
    may raise UnsupportedOperation when operations they do not support are
    called.

    The basic type used for binary data read from or written to a file is
    bytes. Other bytes-like objects are accepted as method arguments too.
    Text I/O classes work with str data.

    Note that calling any method (even inquiries) on a closed stream is
    undefined. Implementations may raise OSError in this case.

    IOBase (and its subclasses) support the iterator protocol, meaning
    that an IOBase object can be iterated over yielding the lines in a
    stream.

    IOBase also supports the :keyword:`with` statement. In this example,
    fp is closed after the suite of the with statement is complete:

    with open('spam.txt', 'r') as fp:
        fp.write('Spam and eggs!')
    c�@�t|jj�d|�d����)z@Internal: raise an OSError exception for unsupported operations.�.z() not supported)rb�	__class__r^)�selfr_s  r�_unsupportedzIOBase._unsupportedms1��"�$(�N�$;�$;�$;�T�T�T�$C�D�D�	Drrc�0�|�d��dS)a$Change stream position.

        Change the stream position to byte offset pos. Argument pos is
        interpreted relative to the position indicated by whence.  Values
        for whence are ints:

        * 0 -- start of stream (the default); offset should be zero or positive
        * 1 -- current stream position; offset may be negative
        * 2 -- end of stream; offset is usually negative
        Some operating systems / file systems could provide additional values.

        Return an int indicating the new absolute position.
        �seekN�rl�rk�pos�whences   rrnzIOBase.seekts��	
���&�!�!�!�!�!rc�.�|�dd��S)z5Return an int indicating the current stream position.rr)rn�rks r�tellzIOBase.tell�s���y�y��A���rNc�0�|�d��dS)z�Truncate file to size bytes.

        Size defaults to the current IO position as reported by tell().  Return
        the new size.
        �truncateNro�rkrqs  rrwzIOBase.truncate����	
���*�%�%�%�%�%rc�.�|���dS)zuFlush write buffers, if applicable.

        This is not implemented for read-only and non-blocking streams.
        N��_checkClosedrts r�flushzIOBase.flush�s��
	
�������rFc�h�|js*	|���d|_dS#d|_wxYwdS)ziFlush and close the IO object.

        This method has no effect if the file is already closed.
        TN)�_IOBase__closedr}rts rrCzIOBase.close�sH��
�}�	%�
%��
�
���� $��
�
�
����
�$�$�$�$�		%�	%s�&�	/c��	|j}n#t$rYdSwxYw|rdStr|���dS	|���dS#YdSxYw)zDestructor.  Calls close().N)�closedr=�_IOBASE_EMITS_UNRAISABLErC)rkr�s  r�__del__zIOBase.__del__�s���	��[�F�F���	�	�	�
�F�F�	����
�	��F�#�	��J�J�L�L�L�L�L�
��
�
�������
������s�
�
��A�Ac��dS)z�Return a bool indicating whether object supports random access.

        If False, seek(), tell() and truncate() will raise OSError.
        This method may need to do a test seek().
        Frerts r�seekablezIOBase.seekable�s	���urc�T�|���st|�dn|���dS)zEInternal: raise UnsupportedOperation if file is not seekable
        NzFile or stream is not seekable.)r�rb�rk�msgs  r�_checkSeekablezIOBase._checkSeekable��G���}�}���	@�&�*-�+�(I�'H�;>�@�@�
@�	@�	@rc��dS)zvReturn a bool indicating whether object was opened for reading.

        If False, read() will raise OSError.
        Frerts r�readablezIOBase.readable��	��
�urc�T�|���st|�dn|���dS)zEInternal: raise UnsupportedOperation if file is not readable
        NzFile or stream is not readable.)r�rbr�s  r�_checkReadablezIOBase._checkReadable�r�rc��dS)z�Return a bool indicating whether object was opened for writing.

        If False, write() and truncate() will raise OSError.
        Frerts r�writablezIOBase.writable�r�rc�T�|���st|�dn|���dS)zEInternal: raise UnsupportedOperation if file is not writable
        NzFile or stream is not writable.)r�rbr�s  r�_checkWritablezIOBase._checkWritable�r�rc��|jS)z�closed: bool.  True iff the file has been closed.

        For backwards compatibility, this is a property, not a predicate.
        )rrts rr�z
IOBase.closed�s���}�rc�:�|jrt|�dn|���dS)z7Internal: raise a ValueError if file is closed
        N�I/O operation on closed file.�r�r4r�s  rr|zIOBase._checkClosed�s:���;�	6�� #��=�<�14�6�6�
6�	6�	6rc�.�|���|S)zCContext management protocol.  Returns self (an instance of IOBase).r{rts r�	__enter__zIOBase.__enter__�s���������rc�.�|���dS)z+Context management protocol.  Calls close()N)rC)rk�argss  r�__exit__zIOBase.__exit__s���
�
�����rc�0�|�d��dS)z�Returns underlying file descriptor (an int) if one exists.

        An OSError is raised if the IO object does not use a file descriptor.
        r:Nrorts rr:z
IOBase.filenos��
	
���(�#�#�#�#�#rc�.�|���dS)z{Return a bool indicating whether this is an 'interactive' stream.

        Return False if it can't be determined.
        Fr{rts rr7z
IOBase.isattys��
	
�������urrc����t�d��r��fd�}nd�}��d�n3	�j}|���n #t$rt��d����wxYwt	��}�dkst|���krT��|����}|sn4||z
}|�d��rn�dk�At|���k�Tt|��S)	aNRead and return a line of bytes from the stream.

        If size is specified, at most size bytes will be read.
        Size should be an int.

        The line terminator is always b'\n' for binary files; for text
        files, the newlines argument to open can be used to select the line
        terminator(s) recognized.
        �peekc�����d��}|sdS|�d��dzpt|��}�dkrt|���}|S)Nr�
r)r��findr3�min)�	readahead�nrk�sizes  ��r�
nreadaheadz#IOBase.readline.<locals>.nreadahead(s[��� �I�I�a�L�L�	� ���1��^�^�E�*�*�Q�.�A�3�y�>�>���1�9�9��A�t���A��rc��dS�Nrrererrr�z#IOBase.readline.<locals>.nreadahead1s���qrNr� is not an integerrr�)	�hasattr�	__index__r=r1�	bytearrayr3�read�endswithr0)rkr�r��
size_index�resr(s``    r�readlinezIOBase.readlines0�����4�� � �	�
�
�
�
�
�
�
�
�
�
��<��D�D�
$�!�^�
�"�z�|�|����"�
?�
?�
?��4� =� =� =�>�>�>�
?�����k�k���Q�h�h�#�c�(�(�T�/�/��	�	�*�*�,�,�'�'�A��
���1�H�C��|�|�E�"�"�
��
�Q�h�h�#�c�(�(�T�/�/��S�z�z�s	�5�Ac�.�|���|S�Nr{rts r�__iter__zIOBase.__iter__Fs���������rc�@�|���}|st�|Sr�)r��
StopIteration�rk�lines  r�__next__zIOBase.__next__Js"���}�}�����	 ����rc��|�|dkrt|��Sd}g}|D]1}|�|��|t|��z
}||krn�2|S)z�Return a list of lines from the stream.

        hint can be specified to control the number of lines read: no more
        lines will be read if the total size (in bytes/characters) of all
        lines so far exceeds hint.
        Nr)�list�appendr3)rk�hintr��linesr�s     r�	readlineszIOBase.readlinesPso���<�4�1�9�9���:�:��
�����	�	�D��L�L�����
��T���N�A��D�y�y�����rc�b�|���|D]}|�|���dS)z�Write a list of lines to the stream.

        Line separators are not added, so it is usual for each of the lines
        provided to have a line separator at the end.
        N)r|�write)rkr�r�s   r�
writelineszIOBase.writelinesbsD��	
�������	�	�D��J�J�t�����	�	r�rr��r)r^rcrd�__doc__rlrnrurwr}rrCr�r�r�r�r�r�r��propertyr�r|r�r�r:r7r�r�r�r�r�rerrrgrgKs���������@D�D�D�"�"�"�"� ���&�&�&�&�����H�	%�	%�	%����6���@�@�@�@����@�@�@�@����@�@�@�@�����X��6�6�6�6����
���$�$�$����(�(�(�(�T����������$����rrg)�	metaclassc�,�eZdZdZdd�Zd�Zd�Zd�ZdS)	�	RawIOBasezBase class for raw binary I/O.rc���|�d}|dkr|���St|�����}|�|��}|�dS||d�=t	|��S)z�Read and return up to size bytes, where size is an int.

        Returns an empty bytes object on EOF, or None if the object is
        set not to block and has no data to read.
        Nrr)�readallr�r��readintor0)rkr�r(r�s    rr�zRawIOBase.read}sm���<��D��!�8�8��<�<�>�>�!��d�n�n�&�&�'�'���M�M�!�����9��4�
�a�b�b�E��Q�x�x�rc��t��}	|�t��}|sn||z
}�#|rt|��S|S)z+Read until EOF, using multiple read() call.)r�r�r8r0)rkr��datas   rr�zRawIOBase.readall�sX���k�k��	��9�9�0�1�1�D��
���4�K�C�		�
�	���:�:���Krc�0�|�d��dS)z�Read bytes into a pre-allocated bytes-like object b.

        Returns an int representing the number of bytes read (0 for EOF), or
        None if the object is set not to block and has no data to read.
        r�Nro�rkr(s  rr�zRawIOBase.readinto�ryrc�0�|�d��dS)z�Write the given buffer to the IO stream.

        Returns the number of bytes written, which may be less than the
        length of b in bytes.
        r�Nror�s  rr�zRawIOBase.write�s��	
���'�"�"�"�"�"rNr�)r^rcrdr�r�r�r�r�rerrr�r�os[������(�(�����"���&�&�&�#�#�#�#�#rr�)r6c�@�eZdZdZdd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
S)�BufferedIOBaseaBase class for buffered IO objects.

    The main difference with RawIOBase is that the read() method
    supports omitting the size argument, and does not have a default
    implementation that defers to readinto().

    In addition, read(), readinto() and write() may raise
    BlockingIOError if the underlying raw stream is in non-blocking
    mode and not ready; unlike their raw counterparts, they will never
    return None.

    A typical implementation should not inherit from a RawIOBase
    implementation, but wrap one.
    rc�0�|�d��dS)a�Read and return up to size bytes, where size is an int.

        If the argument is omitted, None, or negative, reads and
        returns all data until EOF.

        If the argument is positive, and the underlying raw stream is
        not 'interactive', multiple raw reads may be issued to satisfy
        the byte count (unless EOF is reached first).  But for
        interactive raw streams (XXX and for pipes?), at most one raw
        read will be issued, and a short result does not imply that
        EOF is imminent.

        Returns an empty bytes array on EOF.

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        r�Nro�rkr�s  rr�zBufferedIOBase.read�s��$	
���&�!�!�!�!�!rc�0�|�d��dS)zaRead up to size bytes with at most one read() system call,
        where size is an int.
        �read1Nror�s  rr�zBufferedIOBase.read1�s��	
���'�"�"�"�"�"rc�0�|�|d���S)afRead bytes into a pre-allocated bytes-like object b.

        Like read(), this may issue multiple reads to the underlying raw
        stream, unless the latter is 'interactive'.

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        F�r���	_readintor�s  rr�zBufferedIOBase.readinto�s���~�~�a�u�~�-�-�-rc�0�|�|d���S)z�Read bytes into buffer *b*, using at most one system call

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        Tr�r�r�s  r�	readinto1zBufferedIOBase.readinto1�s���~�~�a�t�~�,�,�,rc�2�t|t��st|��}|�d��}|r#|�t	|����}n"|�t	|����}t	|��}||d|�<|S)N�B)r+�
memoryview�castr�r3r�)rkr(r�r�r�s     rr�zBufferedIOBase._readinto�s����!�Z�(�(�	��1�
�
�A�
�F�F�3�K�K���	%��:�:�c�!�f�f�%�%�D�D��9�9�S��V�V�$�$�D���I�I����"�1�"���rc�0�|�d��dS)aWrite the given bytes buffer to the IO stream.

        Return the number of bytes written, which is always the length of b
        in bytes.

        Raises BlockingIOError if the buffer is full and the
        underlying raw stream cannot accept more data at the moment.
        r�Nror�s  rr�zBufferedIOBase.writes��	
���'�"�"�"�"�"rc�0�|�d��dS)z�
        Separate the underlying raw stream from the buffer and return it.

        After the raw stream has been detached, the buffer is in an unusable
        state.
        �detachNrorts rr�zBufferedIOBase.detach���	
���(�#�#�#�#�#rNr�)r^rcrdr�r�r�r�r�r�r�r�rerrr�r��s�������
�
�"�"�"�"�(#�#�#�#�.�.�.�	-�	-�	-�
�
�
�	#�	#�	#�$�$�$�$�$rr�c��eZdZdZd�Zdd�Zd�Zdd�Zd�Zd	�Z	d
�Z
d�Zed���Z
ed
���Zed���Zed���Zd�Zd�Zd�Zd�ZdS)�_BufferedIOMixinz�A mixin implementation of BufferedIOBase with an underlying raw stream.

    This passes most requests on to the underlying raw stream.  It
    does *not* provide implementations of read(), readinto() or
    write().
    c��||_dSr���_raw�rkrQs  r�__init__z_BufferedIOMixin.__init__$s
����	�	�	rrc�f�|j�||��}|dkrtd���|S)Nrz#seek() returned an invalid position)rQrnr<)rkrqrr�new_positions    rrnz_BufferedIOMixin.seek)s7���x�}�}�S�&�1�1���!����?�@�@�@��rc�b�|j���}|dkrtd���|S)Nrz#tell() returned an invalid position)rQrur<rxs  rruz_BufferedIOMixin.tell/s.���h�m�m�o�o����7�7��?�@�@�@��
rNc���|���|���|���|�|���}|j�|��Sr�)r|r�r}rurQrwrxs  rrwz_BufferedIOMixin.truncate5s_��������������
	
�
�
�����;��)�)�+�+�C��x� � ��%�%�%rc�d�|jrtd���|j���dS)N�flush on closed file)r�r4rQr}rts rr}z_BufferedIOMixin.flushFs3���;�	5��3�4�4�4���������rc���|j�U|jsP	|���|j���dS#|j���wxYwdSdSr�)rQr�r}rCrts rrCz_BufferedIOMixin.closeKsa���8�����
!��
�
�������� � � � � ������ � � � ���� ����	�?�Ac�v�|j�td���|���|j}d|_|S)Nzraw stream already detached)rQr4r}r�r�s  rr�z_BufferedIOMixin.detachSs9���8���:�;�;�;��
�
�����i����	��
rc�4�|j���Sr�)rQr�rts rr�z_BufferedIOMixin.seekable]����x� � �"�"�"rc��|jSr�r�rts rrQz_BufferedIOMixin.raw`s
���y�rc��|jjSr�)rQr�rts rr�z_BufferedIOMixin.closedds���x��rc��|jjSr�)rQr_rts rr_z_BufferedIOMixin.nameh����x�}�rc��|jjSr�)rQrBrts rrBz_BufferedIOMixin.modelr�rc�<�td|jj�d�����Nzcannot pickle z object�r1rjr^rts r�__getstate__z_BufferedIOMixin.__getstate__p�!���K���)@�K�K�K�L�L�Lrc��|jj}|jj}	|j}d�|||��S#t
$rd�||��cYSwxYw)Nz<{}.{} name={!r}>z<{}.{}>)rjrcrdr_�formatr=)rk�modname�clsnamer_s    r�__repr__z_BufferedIOMixin.__repr__ssv���.�+���.�-��	F��9�D�'�-�-�g�w��E�E�E���	6�	6�	6��#�#�G�W�5�5�5�5�5�	6���s�8� A�Ac�4�|j���Sr�)rQr:rts rr:z_BufferedIOMixin.fileno����x��� � � rc�4�|j���Sr�)rQr7rts rr7z_BufferedIOMixin.isatty�r
rr�r�)r^rcrdr�r�rnrurwr}rCr�r�r�rQr�r_rBrrr:r7rerrr�r�sN�����������
�������
&�
&�
&�
&�"���
!�!�!����#�#�#�����X������X������X������X��M�M�M�F�F�F�!�!�!�!�!�!�!�!rr�c�~��eZdZdZdZdd�Zd�Zd�Zd�Z�fd�Z	dd	�Z
dd
�Zd�Zdd
�Z
d�Zdd�Zd�Zd�Zd�Z�xZS)�BytesIOz<Buffered I/O implementation using an in-memory bytes buffer.Nc�L�t��}|�||z
}||_d|_dS�Nr)r��_buffer�_pos)rk�
initial_bytes�bufs   rr�zBytesIO.__init__�s-���k�k���$��=� �C������	�	�	rc�`�|jrtd���|j���S)Nz__getstate__ on closed file)r�r4�__dict__�copyrts rrzBytesIO.__getstate__�s/���;�	<��:�;�;�;��}�!�!�#�#�#rc�V�|jrtd���t|j��S)z8Return the bytes value (contents) of the buffer
        zgetvalue on closed file)r�r4r0rrts r�getvaluezBytesIO.getvalue�s-���;�	8��6�7�7�7��T�\�"�"�"rc�V�|jrtd���t|j��S)z;Return a readable and writable view of the buffer.
        zgetbuffer on closed file)r�r4r�rrts r�	getbufferzBytesIO.getbuffer�s-���;�	9��7�8�8�8��$�,�'�'�'rc���|j�|j���t�����dSr�)r�clear�superrC�rkrjs �rrCz
BytesIO.close�s4����<�#��L��� � � �
���
�
�����rrc��|jrtd���|�d}n3	|j}|��}n #t$rt	|�d����wxYw|dkrt|j��}t|j��|jkrdStt|j��|j|z��}|j|j|�}||_t|��S)N�read from closed filerr�rr)
r�r4r�r=r1r3rrr�r0)rkr�r��newposr(s     rr�zBytesIO.read�s����;�	6��4�5�5�5��<��D�D�
$�!�^�
�"�z�|�|����"�
?�
?�
?��4� =� =� =�>�>�>�
?�����!�8�8��t�|�$�$�D��t�|����	�)�)��3��S���&�&��	�D�(8�9�9���L���V�+�,����	��Q�x�x��	�/�Ac�,�|�|��S)z"This is the same as read.
        )r�r�s  rr�z
BytesIO.read1�s���y�y����rc��|jrtd���t|t��rt	d���t|��5}|j}ddd��n#1swxYwY|dkrdS|j}|t|j	��kr*d|t|j	��z
z}|xj	|z
c_	||j	|||z�<|xj|z
c_|S)N�write to closed file� can't write str to binary streamr�)
r�r4r+r/r1r��nbytesrr3r)rkr(�viewr�rq�paddings      rr�z
BytesIO.write�s���;�	5��3�4�4�4��a����	@��>�?�?�?�
��]�]�	�d���A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	���6�6��1��i����T�\�"�"�"�"���s�4�<�'8�'8�!8�9�G��L�L�G�#�L�L�$%���S��q��[�!��	�	�Q��	�	��s�
A�A"�%A"rc��|jrtd���	|j}|��}n #t$rt	|�d����wxYw|dkr |dkrtd|�����||_nd|dkrt
d|j|z��|_n@|dkr+t
dt|j��|z��|_ntd���|jS)Nzseek on closed filer�r�negative seek position rrzunsupported whence value)	r�r4r�r=r1r�maxr3r)rkrqrr�	pos_indexs    rrnzBytesIO.seek�s���;�	4��2�3�3�3�	��
�I��)�+�+�C�C���	:�	:�	:��s�8�8�8�9�9�9�	:�����Q�;�;��Q�w�w� �j���!E�F�F�F��D�I�I�
�q�[�[��A�t�y�3��/�/�D�I�I�
�q�[�[��A�s�4�<�0�0�3�6�7�7�D�I�I��7�8�8�8��y�s	�*�Ac�<�|jrtd���|jS)N�tell on closed file)r�r4rrts rruzBytesIO.tell�s#���;�	4��2�3�3�3��y�rc���|jrtd���|�|j}nK	|j}|��}n #t$rt|�d����wxYw|dkrtd|�����|j|d�=|S)Nztruncate on closed filer�rznegative truncate position )r�r4rr�r=r1r)rkrqr.s   rrwzBytesIO.truncate�s����;�	8��6�7�7�7��;��)�C�C�
"��M�	� �i�k�k����"�
>�
>�
>��3� <� <� <�=�=�=�
>�����Q�w�w� �j�C�C�!I�J�J�J��L������
s	�4�Ac�2�|jrtd���dS�Nr�Tr�rts rr�zBytesIO.readable� ���;�	>��<�=�=�=��trc�2�|jrtd���dSr3r�rts rr�zBytesIO.writable
r4rc�2�|jrtd���dSr3r�rts rr�zBytesIO.seekabler4rr�r�r�)r^rcrdr�rr�rrrrCr�r�r�rnrurwr�r�r��
__classcell__�rjs@rr
r
�s!�������F�F��G�����$�$�$�
#�#�#�(�(�(������
����*����
���&����*���
����"���
���
������rr
c�d�eZdZdZefd�Zd�Zd�Zdd�Zdd�Z	dd	�Z
dd
�Zdd�Zd
�Z
d�Zdd�ZdS)r@aBufferedReader(raw[, buffer_size])

    A buffer for a readable, sequential BaseRawIO object.

    The constructor creates a BufferedReader for the given readable raw
    stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE
    is used.
    c��|���std���t�||��|dkrt	d���||_|���t��|_dS)zMCreate a new buffered reader using the given readable raw IO object.
        z "raw" argument must be readable.r�invalid buffer sizeN)	r�r<r�r�r4�buffer_size�_reset_read_buf�Lock�
_read_lock�rkrQr<s   rr�zBufferedReader.__init__ s|���|�|�~�~�	>��<�=�=�=��!�!�$��,�,�,��!����2�3�3�3�&����������&�&����rc�4�|j���Sr�)rQr�rts rr�zBufferedReader.readable-r�rc�"�d|_d|_dS)Nrr)�	_read_buf�	_read_posrts rr=zBufferedReader._reset_read_buf0s���������rNc��|�|dkrtd���|j5|�|��cddd��S#1swxYwYdS)z�Read size bytes.

        Returns exactly size bytes of data unless the underlying raw IO
        stream reaches EOF or if the call would block in non-blocking
        mode. If size is negative, read until EOF or until read() would
        block.
        Nrzinvalid number of bytes to read)r4r?�_read_unlockedr�s  rr�zBufferedReader.read4s������r�	�	��>�?�?�?�
�_�	-�	-��&�&�t�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�A�A�Ac��d}d}|j}|j}|�|dkr�|���t|jd��r4|j���}|�||d�pdS||d�|zS||d�g}d}	|j���}||vr|}n(|t|��z
}|�|���Hd�	|��p|St|��|z
}	||	kr|xj|z
c_||||z�S||d�g}t|j|��}
|	|krN|j�|
��}||vr|}n-|	t|��z
}	|�|��|	|k�Nt||	��}d�	|��}||d�|_d|_|r
|d|�n|S)Nr)rNrr�r)
rCrDr=r�rQr�r�r3r��joinr-r<r�)rkr��
nodata_val�empty_valuesrrq�chunk�chunks�current_size�avail�wanted�outs            rrFzBufferedReader._read_unlockedAs���
�"���n���n��
�9��R���� � �"�"�"��t�x��+�+�
-���(�(�*�*���=��s�t�t�9�,��,��s�t�t�9�u�,�,��#�$�$�i�[�F��L�
%���
�
�����L�(�(�!&�J����E�
�
�*���
�
�e�$�$�$�
%��8�8�F�#�#�1�z�1��C���3�����:�:��N�N�a��N�N��s�3�q�5�y�>�!��c�d�d�)����T�%�q�)�)���a�i�i��H�M�M�&�)�)�E���$�$�"�
���S��Z�Z��E��M�M�%� � � �
�a�i�i�
��5�M�M���h�h�v�����Q�R�R��������-�s�2�A�2�w�w�:�-rrc�n�|j5|�|��cddd��S#1swxYwYdS)z�Returns buffered bytes without advancing the position.

        The argument indicates a desired minimal number of bytes; we
        do at most one raw read to satisfy it.  We never return more
        than self.buffer_size.
        N)r?�_peek_unlockedr�s  rr�zBufferedReader.peekus����_�	-�	-��&�&�t�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-��*�.�.c�6�t||j��}t|j��|jz
}||ks|dkrI|j|z
}|j�|��}|r#|j|jd�|z|_d|_|j|jd�Sr)r�r<r3rCrDrQr�)rkr��want�have�to_read�currents      rrRzBufferedReader._peek_unlockeds����1�d�&�'�'���4�>�"�"�T�^�3���$�;�;�$�!�)�)��&��-�G��h�m�m�G�,�,�G��
#�!%������!@�7�!J���!"����~�d�n�o�o�.�.rrc	��|dkr|j}|dkrdS|j5|�d��|�t	|t|j��|jz
����cddd��S#1swxYwYdS)z<Reads up to size bytes, with at most one read() system call.rrrN)r<r?rRrFr�r3rCrDr�s  rr�zBufferedReader.read1�s����!�8�8��#�D��1�9�9��3�
�_�	A�	A�����"�"�"��&�&��D�#�d�n�-�-���>�?�?�A�A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�	A�	As�AA<�<B�Bc��t|t��st|��}|jdkrdS|�d��}d}|j5|t|��kr�t
t|j��|jz
t|����}|rM|j|j|j|z�||||z�<|xj|z
c_||z
}|t|��krnxt|��|z
|j	kr+|j
�||d���}|sn8||z
}n|r|s|�d��sn|r|rn|t|��k��ddd��n#1swxYwY|S)z2Read data into *buf* with at most one system call.rr�Nr)
r+r�r(r�r?r3r�rCrDr<rQr�rR)rkrr��writtenrNr�s      rr�zBufferedReader._readinto�s����#�z�*�*�	"��S�/�/�C��:��?�?��1��h�h�s�m�m����
�_�	�	��C��H�H�$�$��C���/�/�$�.�@�#�c�(�(�K�K������t�~�d�n�U�6J�'J�K�����
�-�.��N�N�e�+�N�N��u�$�G��#�c�(�(�*�*���s�8�8�g�%��(8�8�8���)�)�#�g�h�h�-�8�8�A�����q�L�G�G� ��G���.�.�q�1�1�����W���9�C��H�H�$�$�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�>�s�DE.�.E2�5E2c��tt�|��t|j��z
|jzd��Sr)r-r�rur3rCrDrts rruzBufferedReader.tell�s8���#�(�(��.�.��T�^�1D�1D�D�t�~�U�WX�Y�Y�Yrc�"�|tvrtd���|j5|dkr|t|j��|jz
z}t�|||��}|���|cddd��S#1swxYwYdS)N�invalid whence valuer)	�valid_seek_flagsr4r?r3rCrDr�rnr=rps   rrnzBufferedReader.seek�s����)�)�)��3�4�4�4�
�_�	�	���{�{��s�4�>�*�*�T�^�;�;��"�'�'��c�6�:�:�C�� � �"�"�"��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�AB�B�Br�r�r�)r^rcrdr�r8r�r�r=r�rFr�rRr�r�rurnrerrr@r@s���������)<�!�!�!�!�#�#�#����-�-�-�-�2.�2.�2.�2.�h-�-�-�-�	/�	/�	/�	/�A�A�A�A�$,�,�,�\Z�Z�Z������rr@c�P�eZdZdZefd�Zd�Zd�Zd
d�Zd�Z	d�Z
d	�Zdd�Zd�Z
dS)r?z�A buffer for a writeable sequential RawIO object.

    The constructor creates a BufferedWriter for the given writeable raw
    stream. If the buffer_size is not given, it defaults to
    DEFAULT_BUFFER_SIZE.
    c��|���std���t�||��|dkrt	d���||_t
��|_t��|_	dS)Nz "raw" argument must be writable.rr;)
r�r<r�r�r4r<r��
_write_bufr>�_write_lockr@s   rr�zBufferedWriter.__init__�sv���|�|�~�~�	>��<�=�=�=��!�!�$��,�,�,��!����2�3�3�3�&���#�+�+����6�6����rc�4�|j���Sr�)rQr�rts rr�zBufferedWriter.writable�r�rc� �t|t��rtd���|j5|jrtd���t
|j��|jkr|�	��t
|j��}|j�
|��t
|j��|z
}t
|j��|jkr�	|�	��n�#t$r|}t
|j��|jkrUt
|j��|jz
}||z}|jd|j�|_t|j|j
|���Yd}~nd}~wwxYw|cddd��S#1swxYwYdS)Nr&r%)r+r/r1rcr�r4r3rbr<�_flush_unlocked�extend�BlockingIOError�errno�strerror)rkr(�beforer[�e�overages      rr�zBufferedWriter.write�s����a����	@��>�?�?�?�
�
�	�	��{�
9� �!7�8�8�8��4�?�#�#�d�&6�6�6��$�$�&�&�&����)�)�F��O�"�"�1�%�%�%��$�/�*�*�V�3�G��4�?�#�#�d�&6�6�6�	L��(�(�*�*�*�*��&�L�L�L��4�?�+�+�d�.>�>�>�#&�d�o�"6�"6��9I�"I���7�*��*.�/�:K�4�;K�:K�*L���-�a�g�q�z�7�K�K�K�
?�>�>�>�>�����L�����/	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s=�B*F�C,�+F�,
E2�6A2E-�(F�-E2�2F�F�
FNc���|j5|���|�|j���}|j�|��cddd��S#1swxYwYdSr�)rcrfrQrurwrxs  rrwzBufferedWriter.truncates���
�
�	*�	*�� � �"�"�"��{��h�m�m�o�o���8�$�$�S�)�)�		*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�	*�	*s�A	A�A"�%A"c�n�|j5|���ddd��dS#1swxYwYdSr�)rcrfrts rr}zBufferedWriter.flushs���
�
�	#�	#�� � �"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#rSc�v�|jrtd���|jr�	|j�|j��}n#t
$rt
d���wxYw|�ttjdd���|t|j��ks|dkrtd���|jd|�=|j��dSdS)Nr�zHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)r�r4rbrQr�rh�RuntimeErrorri�EAGAINr3r<�rkr�s  rrfzBufferedWriter._flush_unlockeds����;�	5��3�4�4�4��o�	$�
G��H�N�N�4�?�3�3����"�
G�
G�
G�"�$F�G�G�G�
G�����y�%��L�?��D�D�D��3�t��'�'�'�'�1�q�5�5��J�K�K�K������#��o�	$�	$�	$�	$�	$s	�?�Ac�`�t�|��t|j��zSr�)r�rur3rbrts rruzBufferedWriter.tell's%���$�$�T�*�*�S���-A�-A�A�Arrc���|tvrtd���|j5|���t�|||��cddd��S#1swxYwYdS)Nr^)r_r4rcrfr�rnrps   rrnzBufferedWriter.seek*s����)�)�)��3�4�4�4�
�
�	<�	<�� � �"�"�"�#�(�(��s�F�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s�0A�A!�$A!c��|j5|j�|jr	ddd��dS	ddd��n#1swxYwY	|���|j5|j���ddd��dS#1swxYwYdS#|j5|j���ddd��w#1swxYwYwxYwr�)rcrQr�r}rCrts rrCzBufferedWriter.close1s���
�
�	�	��x��4�;���	�	�	�	�	�	�	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	!��J�J�L�L�L��!�
!�
!����� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!�
!�
!���!�
!�
!����� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!�
!���sM�2�6�6�B
�B�B�B�
C�B;�/C�;B?�?C�B?�Cr�r�)r^rcrdr�r8r�r�r�rwr}rfrurnrCrerrr?r?�s���������)<�	"�	"�	"�	"�#�#�#����8*�*�*�*�#�#�#�$�$�$�"B�B�B�<�<�<�<�
!�
!�
!�
!�
!rr?c�z�eZdZdZefd�Zdd�Zd�Zd�Zdd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zed���ZdS)�BufferedRWPaira�A buffered reader and writer object together.

    A buffered reader object and buffered writer object put together to
    form a sequential IO object that can read and write. This is typically
    used with a socket or two-way pipe.

    reader and writer are RawIOBase objects that are readable and
    writeable respectively. If the buffer_size is omitted it defaults to
    DEFAULT_BUFFER_SIZE.
    c���|���std���|���std���t||��|_t||��|_dS)zEConstructor.

        The arguments are two RawIO instances.
        z#"reader" argument must be readable.z#"writer" argument must be writable.N)r�r<r�r@�readerr?�writer)rkrzr{r<s    rr�zBufferedRWPair.__init__Qsn��
��� � �	A��?�@�@�@���� � �	A��?�@�@�@�$�V�[�9�9���$�V�[�9�9����rrc�>�|�d}|j�|��S�Nr)rzr�r�s  rr�zBufferedRWPair.read_s"���<��D��{����%�%�%rc�6�|j�|��Sr�)rzr�r�s  rr�zBufferedRWPair.readintods���{�#�#�A�&�&�&rc�6�|j�|��Sr�)r{r�r�s  rr�zBufferedRWPair.writegs���{� � ��#�#�#rrc�6�|j�|��Sr�)rzr�r�s  rr�zBufferedRWPair.peekjs���{����%�%�%rc�6�|j�|��Sr�)rzr�r�s  rr�zBufferedRWPair.read1ms���{� � ��&�&�&rc�6�|j�|��Sr�)rzr�r�s  rr�zBufferedRWPair.readinto1ps���{�$�$�Q�'�'�'rc�4�|j���Sr�)rzr�rts rr�zBufferedRWPair.readables����{�#�#�%�%�%rc�4�|j���Sr�)r{r�rts rr�zBufferedRWPair.writablevr�rc�4�|j���Sr�)r{r}rts rr}zBufferedRWPair.flushys���{� � �"�"�"rc��	|j���|j���dS#|j���wxYwr�)r{rCrzrts rrCzBufferedRWPair.close|sO��	 ��K�������K���������D�K���������s	�6�Ac�f�|j���p|j���Sr�)rzr7r{rts rr7zBufferedRWPair.isatty�s)���{�!�!�#�#�;�t�{�'9�'9�';�';�;rc��|jjSr�)r{r�rts rr�zBufferedRWPair.closed��
���{�!�!rNr�r�)r^rcrdr�r8r�r�r�r�r�r�r�r�r�r}rCr7r�r�rerrrxrxAs������	�	�4G�:�:�:�:�&�&�&�&�
'�'�'�$�$�$�&�&�&�&�'�'�'�'�(�(�(�&�&�&�&�&�&�#�#�#� � � �<�<�<��"�"��X�"�"�"rrxc�\�eZdZdZefd�Zdd�Zd�Zdd�Zdd�Z	d	�Z
dd
�Zdd�Zd
�Z
d�ZdS)r>z�A buffered interface to random access streams.

    The constructor creates a reader and writer for a seekable stream,
    raw, given in the first argument. If the buffer_size is omitted it
    defaults to DEFAULT_BUFFER_SIZE.
    c��|���t�|||��t�|||��dSr�)r�r@r�r?r@s   rr�zBufferedRandom.__init__�sJ������������c�;�7�7�7�����c�;�7�7�7�7�7rrc���|tvrtd���|���|jrT|j5|j�|jt|j��z
d��ddd��n#1swxYwY|j�||��}|j5|�	��ddd��n#1swxYwY|dkrtd���|S)Nr^rrz seek() returned invalid position)r_r4r}rCr?rQrnrDr3r=r<rps   rrnzBufferedRandom.seek�sm���)�)�)��3�4�4�4��
�
�����>�	G���
G�
G���
�
�d�n�s�4�>�/B�/B�B�A�F�F�F�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G����
G�
G�
G�
G��h�m�m�C��(�(��
�_�	#�	#�� � �"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#���7�7��<�=�=�=��
s#�6A=�=B�B�*C�C�Cc�x�|jrt�|��St�|��Sr�)rbr?rur@rts rruzBufferedRandom.tell�s4���?�	-�!�&�&�t�,�,�,�!�&�&�t�,�,�,rNc�d�|�|���}t�||��Sr�)rur?rwrxs  rrwzBufferedRandom.truncate�s*���;��)�)�+�+�C��&�&�t�S�1�1�1rc�h�|�d}|���t�||��Sr})r}r@r�r�s  rr�zBufferedRandom.read�s/���<��D��
�
�����"�"�4��.�.�.rc�`�|���t�||��Sr�)r}r@r�r�s  rr�zBufferedRandom.readinto�s%���
�
�����&�&�t�Q�/�/�/rc�`�|���t�||��Sr�)r}r@r�r�s  rr�zBufferedRandom.peek�s%���
�
�����"�"�4��.�.�.rrc�`�|���t�||��Sr�)r}r@r�r�s  rr�zBufferedRandom.read1�s%���
�
�����#�#�D�$�/�/�/rc�`�|���t�||��Sr�)r}r@r�r�s  rr�zBufferedRandom.readinto1�s%���
�
�����'�'��a�0�0�0rc��|jrh|j5|j�|jt|j��z
d��|���ddd��n#1swxYwYt�||��Sr�)	rCr?rQrnrDr3r=r?r�r�s  rr�zBufferedRandom.write�s����>�	'���
'�
'���
�
�d�n�s�4�>�/B�/B�B�A�F�F�F��$�$�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'��#�#�D�!�,�,�,s�A
A%�%A)�,A)r�r�r�)r^rcrdr�r8r�rnrurwr�r�r�r�r�r�rerrr>r>�s���������)<�8�8�8�8�
����"-�-�-�2�2�2�2�/�/�/�/�0�0�0�/�/�/�/�0�0�0�0�1�1�1�-�-�-�-�-rr>c����eZdZdZdZdZdZdZdZdZ	dd�Z
d�Zd�Zd	�Z
d
�Zdd�Zdd�Zd
�Zd�Zd�Zefd�Zd�Zdd�Z�fd�Zd�Zd�Zd�Zd�Zd�Zed���Zed���Z �xZ!S)r6rFNTrc�l�|jdkr5	|jrtj|j��d|_n#d|_wxYwt	|t
��rt
d���t	|t��r|}|dkrtd���nd}t	|t��st
d|�����t|��td��kstd|�����td�|D����dks|�d	��dkrtd
���d|vr(d|_
d|_tjtjz}n^d
|vr
d|_d}nPd|vr!d|_tjtjz}n+d|vr'd|_d|_tjtjz}d	|vrd|_d|_|jr|jr|tjz}n&|jr|tjz}n|tjz}|t1tdd��z}t1tdd��pt1tdd��}||z}d}	|dkr�|std���|�tj||d��}nE|||��}t	|t��st
d���|dkrt5d���|}|stj|d��||_tj|��}		t;j|	j��r7tAtBj"tj#tBj"��|���n#tH$rYnwxYwt1|	dd��|_%|j%dkrtL|_%tNrtO|tj(��||_)|jrJ	tj*|dtV��n-#t4$r }
|
j!tBj,kr�Yd}
~
nd}
~
wwxYwn#|�tj|���xYw||_dS)adOpen a file.  The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
        writing, exclusive creation or appending.  The file will be created if it
        doesn't exist when opened for writing or appending; it will be truncated
        when opened for writing.  A FileExistsError will be raised if it already
        exists when opened for creating. Opening a file for creating implies
        writing so this mode behaves in a similar way to 'w'. Add a '+' to the mode
        to allow simultaneous reading and writing. A custom opener can be used by
        passing a callable as *opener*. The underlying file descriptor for the file
        object is then obtained by calling opener with (*name*, *flags*).
        *opener* must return an open file descriptor (passing os.open as *opener*
        results in functionality similar to passing None).
        rrz$integer argument expected, got floatznegative file descriptorzinvalid mode: zxrwab+c3�K�|]}|dvV��	dS)�rwaxNre)�.0�cs  r�	<genexpr>z"FileIO.__init__.<locals>.<genexpr>�s&����)�)�q�q�F�{�)�)�)�)�)�)rrr&zKMust have exactly one of create/read/write/append mode and at most one plusr#Trr$r%�O_BINARY�O_NOINHERIT�	O_CLOEXECNz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr;)-�_fd�_closefdr-rCr+�floatr1r,r4r/r2�sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrVr<�set_inheritabler9�stat�S_ISDIR�st_mode�IsADirectoryErrorri�EISDIRrjr=�_blksizer8�_setmoder�r_�lseekr
�ESPIPE)rkrDrBrHr*�fdr�noinherit_flag�owned_fd�fdfstatrls           rr�zFileIO.__init__�s����8�q�=�=�
��=�'��H�T�X�&�&�&������2���
�
�
�
��d�E�"�"�	D��B�C�C�C��d�C� � �	��B��A�v�v� �!;�<�<�<���B��$��$�$�	:��)�$�$�8�9�9�9��4�y�y�C��M�M�)�)��*�4�4�9�:�:�:��)�)�D�)�)�)�)�)�Q�.�.�$�*�*�S�/�/�A�2E�2E��9�:�:�
:��$�;�;� �D�M�!�D�N��I��
�*�E�E�
�D�[�[�!�D�N��E�E�
�D�[�[�!�D�N��J���+�E�E�
�D�[�[�!�D�N�"�D�O��K�"�*�,�E��$�;�;�!�D�N�!�D�N��>�	!�d�n�	!��R�Y��E�E�
�^�	!��R�[� �E�E��R�[� �E�
���Z��+�+�+��!�"�m�Q�7�7�6�!�"�k�1�5�5�	�
������/	��A�v�v��P�$�%N�O�O�O��>����u�e�4�4�B�B����e�,�,�B�%�b�#�.�.�H�'�(F�G�G�G��A�v�v�%�&@�A�A�A���%�2��&�r�5�1�1�1�#�D�M��h�r�l�l�G�
��<���0�0�M�+�E�L�,.�K���,E�,E�t�M�M�M�M��"�
�
�
���
����$�G�\�1�=�=�D�M��}��!�!� 3��
��
*���R�[�)�)�)��D�I���
���H�R��H�-�-�-�-�������w�%�,�.�.��/�.�.�.�.�����������	��#����"�"�"���������se� 5�	>�B)P�	AM�P�
M'�$P�&M'�'AP�O#�"P�#
P
�-P�P�P
�
P�P*c��|jdkrI|jrD|js?ddl}|�d|��t
d|���|���dSdSdSdS)Nrzunclosed file r)r�source)r�r�r�rr�ResourceWarningrC)rkrs  rr�zFileIO.__del__Vsm���8�q�=�=�T�]�=�4�;�=��O�O�O��M�M�M���6��%&�t�
�
5�
5�
5��J�J�L�L�L�L�L�	�=�=�=�=�=rc�<�td|jj�d����rrrts rrzFileIO.__getstate__]rrc	���|jj�d|jj��}|jrd|zS	|j}d|�d|�d|j�d|j�d�	S#t$rd||j|j|jfzcYSwxYw)	Nriz
<%s [closed]>�<z name=z mode=z	 closefd=�>z<%s fd=%d mode=%r closefd=%r>)	rjrcrdr�r_rBr�r=r�)rk�
class_namer_s   rrzFileIO.__repr__`s��� $�� 9� 9� 9� $�� ;� ;�=�
��;�	0�"�Z�/�/�	B��9�D�D� �Z�Z����t�y�y�y�$�-�-�-�A�
B��	�	F�	F�	F�3����4�9�d�m�D�E�
F�
F�
F�	F���s�A	�	"A.�-A.c�2�|jstd���dS)NzFile not open for reading)r�rbrts rr�zFileIO._checkReadablen�(���~�	D�&�'B�C�C�C�	D�	Drc�2�|jstd���dS)NzFile not open for writing)r�rbr�s  rr�zFileIO._checkWritablerr�rc���|���|���|�|dkr|���S	tj|j|��S#t$rYdSwxYw)z�Read at most size bytes, returned as bytes.

        Only makes one system call, so less data may be returned than requested
        In non-blocking mode, returns None if no data is available.
        Return an empty bytes object at EOF.
        Nr)r|r�r�r-r�r�rhr�s  rr�zFileIO.readvs~��	
�������������<�4�!�8�8��<�<�>�>�!�	��7�4�8�T�*�*�*���	�	�	��4�4�	���s�A � 
A.�-A.c�d�|���|���t}	tj|jdt��}tj|j��j}||kr||z
dz}n#t$rYnwxYwt��}	t|��|kr't|��}|t|t��z
}|t|��z
}	tj
|j|��}n#t$r|rYnYdSwxYw|sn||z
}��t|��S)z�Read all data from the file, returned as bytes.

        In non-blocking mode, returns as much as is immediately available,
        or None if no data is available.  Return an empty bytes object at EOF.
        rrTN)r|r�r8r-r�r�r	r9�st_sizer<r�r3r-r�rhr0)rk�bufsizerq�endrRr�rKs       rr�zFileIO.readall�sU��	
������������%��	��(�4�8�Q��1�1�C��(�4�8�$�$�,�C��c�z�z���)�a�-�����	�	�	��D�	��������
	��6�{�{�g�%�%��f�+�+���3�w�(;�<�<�<���#�f�+�+�%�A�
�����!�,�,����"�
�
�
����E��t�t�
�����
���e�O�F�
	��V�}�}�s$�AA>�>
B�
B�*D�D�Dc��t|���d��}|�t|����}t|��}||d|�<|S)zSame as RawIOBase.readinto().r�N)r�r�r�r3)rkr(�mr�r�s     rr�zFileIO.readinto�sO���q�M�M���s�#�#���y�y��Q��� � ����I�I����"�1�"���rc��|���|���	tj|j|��S#t
$rYdSwxYw)aWrite bytes b to file, return number written.

        Only makes one system call, so not all of the data may be written.
        The number of bytes actually written is returned.  In non-blocking mode,
        returns None if the write would block.
        N)r|r�r-r�r�rhr�s  rr�zFileIO.write�sc��	
������������	��8�D�H�a�(�(�(���	�	�	��4�4�	���s�A�
A�Ac��t|t��rtd���|���t	j|j||��S)a�Move to new file position.

        Argument offset is a byte count.  Optional argument whence defaults to
        SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
        are SEEK_CUR or 1 (move relative to current position, positive or negative),
        and SEEK_END or 2 (move relative to end of file, usually negative, although
        many platforms allow seeking beyond the end of a file).

        Note that not all file objects are seekable.
        zan integer is required)r+r�r1r|r-r�r�rps   rrnzFileIO.seek�sM���c�5�!�!�	6��4�5�5�5��������x���#�v�.�.�.rc�j�|���tj|jdt��S)zYtell() -> int.  Current file position.

        Can raise OSError for non seekable files.r)r|r-r�r�r	rts rruzFileIO.tell�s,��	
�������x���!�X�.�.�.rc��|���|���|�|���}tj|j|��|S)z�Truncate the file to at most size bytes.

        Size defaults to the current file position, as returned by tell().
        The current file position is changed to the value of size.
        )r|r�rur-�	ftruncater�r�s  rrwzFileIO.truncate�sS��	
�������������<��9�9�;�;�D�
��T�X�t�$�$�$��rc����|jsh	|jrtj|j��t�����dS#t�����wxYwdS)z�Close the file.

        A closed file cannot be used for further I/O operations.  close() may be
        called more than once without error.
        N)r�r�r-rCr�rrs �rrCzFileIO.close�se����{�	 �
 ��=�'��H�T�X�&�&�&����
�
����������
�
��������	 �	 s� A�"A.c��|���|j�4	|���d|_n#t$r
d|_YnwxYw|jS)z$True if file supports random-access.NTF)r|�	_seekablerur<rts rr�zFileIO.seekable�sk���������>�!�
&��	�	����"&������
'�
'�
'�!&�����
'�����~�s�9�A
�A
c�8�|���|jS)z'True if file was opened in a read mode.)r|r�rts rr�zFileIO.readable�����������~�rc�8�|���|jS)z(True if file was opened in a write mode.)r|r�rts rr�zFileIO.writabler�rc�8�|���|jS)z3Return the underlying file descriptor (an integer).)r|r�rts rr:z
FileIO.filenos���������x�rc�\�|���tj|j��S)z.True if the file is connected to a TTY device.)r|r-r7r�rts rr7z
FileIO.isattys&���������y���"�"�"rc��|jS)z6True if the file descriptor will be closed by close().)r�rts rrHzFileIO.closefds���}�rc�r�|jr|jrdSdS|jr|jrdSdS|jr|jrdSdSdS)zString giving the file modezxb+�xbzab+�abzrb+rX�wb)r�r�r�r�rts rrBzFileIO.modesc���=�	��~�
��u��t�
�_�	��~�
��u��t�
�^�	��~�
��u��t��4r)rTNr�)"r^rcrdr�r�r�r�r�r�r�r�r�rrr�r�r�r�r�r�rrnrurwrCr�r�r�r:r7r�rHrBr7r8s@rr6r6�s��������
�C��H��I��I��J��I��H�w�w�w�w�r���M�M�M�B�B�B�D�D�D�D�D�D�D����� !�!�!�F������ (�/�/�/�/� /�/�/����� � � � � �
�
�
����
���
���
#�#�#�
����X������X�����rr6c�v�eZdZdZdd�Zd�Zd
d�Zd�Zd�Ze	d	���Z
e	d
���Ze	d���ZdS)�
TextIOBaseznBase class for text I/O.

    This class provides a character and line based interface to stream
    I/O.
    rc�0�|�d��dS)z�Read at most size characters from stream, where size is an int.

        Read from underlying buffer until we have size characters or we hit EOF.
        If size is negative or omitted, read until EOF.

        Returns a string.
        r�Nror�s  rr�zTextIOBase.read3s��	
���&�!�!�!�!�!rc�0�|�d��dS)z.Write string s to stream and returning an int.r�Nro)rk�ss  rr�zTextIOBase.write=s�����'�"�"�"�"�"rNc�0�|�d��dS)z*Truncate size to pos, where pos is an int.rwNrorxs  rrwzTextIOBase.truncateAs�����*�%�%�%�%�%rc�0�|�d��dS)z_Read until newline or EOF.

        Returns an empty string if EOF is hit immediately.
        r�Nrorts rr�zTextIOBase.readlineEs��
	
���*�%�%�%�%�%rc�0�|�d��dS)z�
        Separate the underlying buffer from the TextIOBase and return it.

        After the underlying buffer has been detached, the TextIO is in an
        unusable state.
        r�Nrorts rr�zTextIOBase.detachLr�rc��dS)zSubclasses should override.Nrerts rrzTextIOBase.encodingUs	���trc��dS)z�Line endings translated so far.

        Only line endings translated during reading are considered.

        Subclasses should override.
        Nrerts r�newlineszTextIOBase.newlinesZs	���trc��dS)zMError setting of the decoder or encoder.

        Subclasses should override.Nrerts rrFzTextIOBase.errorsds	��
�trr�r�)
r^rcrdr�r�r�rwr�r�r�rr�rFrerrr�r�+s���������"�"�"�"�#�#�#�&�&�&�&�&�&�&�$�$�$�����X������X������X���rr�c�V�eZdZdZdd�Zdd�Zd�Zd�Zd�Zd	Z	d
Z
dZed���Z
d
S)�IncrementalNewlineDecodera+Codec used when reading a file in universal newlines mode.  It wraps
    another incremental decoder, translating \r\n and \r into \n.  It also
    records the types of newlines encountered.  When used with
    translate=False, it ensures that the newline sequence is returned in
    one piece.
    �strictc��tj�||���||_||_d|_d|_dS)N)rFrF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rkr�r�rFs    rr�z"IncrementalNewlineDecoder.__init__us>���!�*�*�4��*�?�?�?�"�������������rFc��|j�|}n|j�||���}|jr|s|rd|z}d|_|�d��r|s|dd�}d|_|�d��}|�d��|z
}|�d��|z
}|xj|o|j|o|jz|o|jzzc_|j	r0|r|�
dd��}|r|�
dd��}|S)N��final�
FrT�
�
)r��decoder�r�r�r��_LF�_CR�_CRLFr��replace)rk�inputr��output�crlf�cr�lfs       rr�z IncrementalNewlineDecoder.decode|s<���<���F�F��\�(�(��e�(�<�<�F��>�	#�v�	#��	#��F�]�F�"�D�N��?�?�4� � �	"��	"��C�R�C�[�F�!�D�N��|�|�F�#�#��
�\�\�$�
�
�$�
&��
�\�\�$�
�
�$�
&�������t�x�B�O�4�8�<��*��
�,�	,����>�	4��
6������5�5���
4�����d�3�3���
rc�|�|j�d}d}n|j���\}}|dz}|jr|dz}||fS)Nrrr)r��getstater�)rkr�flags   rr
z"IncrementalNewlineDecoder.getstate�sS���<���C��D�D���-�-�/�/�I�C����
���>�	��A�I�D��D�y�rc��|\}}t|dz��|_|j�!|j�||dz	f��dSdSr�)�boolr�r��setstate)rk�staterrs    rrz"IncrementalNewlineDecoder.setstate�sQ���	��T��d�Q�h������<�#��L�!�!�3���	�"2�3�3�3�3�3�$�#rc�f�d|_d|_|j�|j���dSdS)NrF)r�r�r��resetrts rrzIncrementalNewlineDecoder.reset�s:���������<�#��L��� � � � � �$�#rrr�c��d|jS)N)Nr�r�)r�r�r�)r�r�)r�r�)r�r�r�)r�rts rr�z"IncrementalNewlineDecoder.newlines�s������	rN)r�)F)r^rcrdr�r�r�r
rrrrrr�r�rerrr�r�ns�����������������>	�	�	�4�4�4�!�!�!��C�
�C�
�E�
�	�	��X�	�	�	rr�c��eZdZdZdZdZ		d,d�Zd�Z		d,d�Zd�Z	e
d	���Ze
d
���Ze
d���Z
e
d���Ze
d
���Zddeddd�d�Zd�Zd�Zd�Zd�Zd�Ze
d���Ze
d���Zd�Zd�Zd�Zd�Zd�Zd�Zd-d�Zd�Z d�Z!d �Z"		d.d"�Z#d#�Z$d$�Z%d-d%�Z&d&�Z'd/d'�Z(d-d(�Z)d)�Z*d-d*�Z+e
d+���Z,dS)0rAa�Character and line based layer over a BufferedIOBase object, buffer.

    encoding gives the name of the encoding that the stream will be
    decoded or encoded with. It defaults to locale.getencoding().

    errors determines the strictness of encoding and decoding (see the
    codecs.register) and defaults to "strict".

    newline can be None, '', '\n', '\r', or '\r\n'.  It controls the
    handling of line endings. If it is None, universal newlines is
    enabled.  With this enabled, on input, the lines endings '\n', '\r',
    or '\r\n' are translated to '\n' before being returned to the
    caller. Conversely, on output, '\n' is translated to the system
    default line separator, os.linesep. If newline is any other of its
    legal values, that newline becomes the newline when the file is read
    and it is returned untranslated. On output, '\n' is converted to the
    newline.

    If line_buffering is True, a call to flush is implied when a call to
    write contains a newline character.
    iNFc��|�|��t|��}|dkr|���}t|t��std|z���t
j|��jsd}t||z���|�d}nBt|t��std|z���trt
j|��||_d|_
d|_d|_|j���x|_|_t)|jd��|_|�|||||��dS)	Nrr!zG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr�r"r)rr�)�_check_newliner�_get_locale_encodingr+r/r4r��lookup�_is_text_encoding�LookupError�
_CHECK_ERRORS�lookup_errorr�_decoded_chars�_decoded_chars_used�	_snapshotrUr�r��_tellingr��
_has_read1�
_configure)rkrUrrFrGrS�
write_throughr�s        rr�zTextIOWrapper.__init__�sY�����G�$�$�$� ��*�*���x����0�0�2�2�H��(�C�(�(�	@��3�h�>�?�?�?��}�X�&�&�8�	.�B�C��c�H�n�-�-�-��>��F�F��f�c�*�*�
@� �!5��!>�?�?�?��
,��#�F�+�+�+���� ���#$�� ����)-��)=�)=�)?�)?�?�����!�$�+�w�7�7�������&�'�&�
�	7�	7�	7�	7�	7rc��|�4t|t��stdt|�������|dvrt	d|�����dS)Nzillegal newline type: )Nr)r�r�r�zillegal newline value: )r+r/r1�typer4)rkrGs  rrzTextIOWrapper._check_newlines[����z�'�3�'?�'?���)�$�w�-�-�-�I�J�J�J��8�8�8��*�G�G�E�F�F�F�9�8rc���||_||_d|_d|_d|_||_|du|_||_|dk|_|ptj
|_||_||_
|jrn|���r\|j���}|dkr?	|����d��dS#t($rYdSwxYwdSdSdS)N�r)r)�	_encoding�_errors�_encoder�_decoder�	_b2cratio�_readuniversal�_readtranslate�_readnl�_writetranslater-�linesep�_writenl�_line_buffering�_write_throughr�r�rUru�_get_encoderrr)rkrrFrGrSr#�positions       rr"zTextIOWrapper._configures	��!��������
���
����")�k���%��o������&�"�}����-�2�:��
�-���+����>�	�d�m�m�o�o�	��{�'�'�)�)�H��1�}�}���%�%�'�'�0�0��3�3�3�3�3��"�����D�D�����	�	�	�	��}s�#'C�
C�Cc�T�d�|jj|jj��}	|j}|d�|��z
}n#t
$rYnwxYw	|j}|d�|��z
}n#t
$rYnwxYw|d�|j��zS)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)rrjrcrdr_r=rBr)rkrRr_rBs    rrzTextIOWrapper.__repr__/s��������!:�!%��!<�>�>��	1��9�D�
�m�*�*�4�0�0�0�F�F���	�	�	��D�	����	1��9�D�
�m�*�*�4�0�0�0�F�F���	�	�	��D�	�����*�1�1�$�-�@�@�@�@s#�A�
A�A�A=�=
B
�	B
c��|jSr�)r(rts rrzTextIOWrapper.encoding@s
���~�rc��|jSr�)r)rts rrFzTextIOWrapper.errorsD�
���|�rc��|jSr�)r3rts rrSzTextIOWrapper.line_bufferingHs���#�#rc��|jSr�)r4rts rr#zTextIOWrapper.write_throughLs���"�"rc��|jSr�)rrts rrUzTextIOWrapper.bufferPr:r)rrFrGrSr#c��|j�|�|�	|turtd���|�
|�|j}n*d}n't	|t
��st
d|z���|�|j}nAt	|t
��st
d|z���|dkr|���}|tur|j	}|�
|��|�|j}|�|j}|�
��|�|||||��dS)z`Reconfigure the text stream with new parameters.

        This also flushes the stream.
        NzPIt is not possible to set the encoding or newline of stream after the first readr�r"r!r)r+�Ellipsisrbr)r+r/r1r(rr/rrSr#r}r")rkrrFrGrSr#s      r�reconfigurezTextIOWrapper.reconfigureTsH��
�M�%��)�V�-?��x�/�/�&�'�(�(�
(��>�������!����F�C�(�(�	;��0�6�9�:�:�:����~�H�H��h��,�,�
C�� 6�� A�B�B�B��8�#�#��4�4�6�6���h����l�G����G�$�$�$��!�!�0�N�� � �.�M��
�
��������&�'�&�
�	7�	7�	7�	7�	7rc�<�|jrtd���|jS)Nr�)r�r4r�rts rr�zTextIOWrapper.seekables#���;�	>��<�=�=�=��~�rc�4�|j���Sr�)rUr�rts rr�zTextIOWrapper.readable�r�rc�4�|j���Sr�)rUr�rts rr�zTextIOWrapper.writable�r�rc�P�|j���|j|_dSr�)rUr}r�r rts rr}zTextIOWrapper.flush�s#������������
�
�
rc���|j�U|jsP	|���|j���dS#|j���wxYwdSdSr�)rUr�r}rCrts rrCzTextIOWrapper.close�se���;�"�4�;�"�
$��
�
������!�!�#�#�#�#�#����!�!�#�#�#�#����	#�"�"�"r�c��|jjSr�)rUr�rts rr�zTextIOWrapper.closed�r�rc��|jjSr�)rUr_rts rr_zTextIOWrapper.name�s
���{��rc�4�|j���Sr�)rUr:rts rr:zTextIOWrapper.fileno�����{�!�!�#�#�#rc�4�|j���Sr�)rUr7rts rr7zTextIOWrapper.isatty�rIrc��|jrtd���t|t��st	d|jjz���t|��}|js|j	od|v}|r-|jr&|j
dkr|�d|j
��}|jp|�
��}|�|��}|j�|��|j	r|sd|vr|���|j�|�d��d|_|jr|j���|S)zWrite data, where s is a strr%zcan't write %s to text streamr�r�Nr))r�r4r+r/r1rjr^r3r0r3r2rr*r5�encoderUr�r}r�_set_decoded_charsr+r)rkr��length�haslf�encoderr(s      rr�zTextIOWrapper.write�sR���;�	5��3�4�4�4��!�S�!�!�	2��;��K�0�1�2�2�
2��Q�����%�=��)=�L�4�1�9���	/�T�)�	/�d�m�t�.C�.C��	�	�$��
�.�.�A��-�6�4�#4�#4�#6�#6���N�N�1��������!������	�U�	�d�a�i�i��J�J�L�L�L��>�%��#�#�B�'�'�'�!�D�N��=�	"��M���!�!�!��
rc�l�tj|j��}||j��|_|jSr�)r��getincrementalencoderr(r)r*)rk�make_encoders  rr5zTextIOWrapper._get_encoder�s/���3�D�N�C�C��$��T�\�2�2��
��}�rc��tj|j��}||j��}|jrt||j��}||_|Sr�)r��getincrementaldecoderr(r)r-r�r.r+)rk�make_decoderr�s   r�_get_decoderzTextIOWrapper._get_decoder�sO���3�D�N�C�C���,�t�|�,�,����	N�/���9L�M�M�G���
��rc�"�||_d|_dS)zSet the _decoded_chars buffer.rN)rr)rk�charss  rrMz TextIOWrapper._set_decoded_chars�s��#���#$�� � � rc��|j}|�|j|d�}n|j|||z�}|xjt|��z
c_|S)z'Advance into the _decoded_chars buffer.N)rrr3)rkr��offsetrYs    r�_get_decoded_charsz TextIOWrapper._get_decoded_chars�sW���)���9��'����0�E�E��'��v��z�(9�:�E�� � �C��J�J�.� � ��rc�V�	ddl}|���S#t$rYdSwxYw)Nrr)r�getencoding�ImportError)rkrs  rrz"TextIOWrapper._get_locale_encoding�sH��	(��M�M�M�
�%�%�'�'�'��	�	�	�	��7�7�	���s��
(�(c�Z�|j|krtd���|xj|zc_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r�AssertionErrorrss  r�_rewind_decoded_charsz#TextIOWrapper._rewind_decoded_chars�s9���#�a�'�'� �!E�F�F�F�� � �A�%� � � � rc��|j�td���|jr|j���\}}|jr |j�|j��}n|j�|j��}|}|j�	||��}|�
|��|r*t|��t|j��z|_
nd|_
|jr|||zf|_|S)zQ
        Read and decode the next chunk of data from the BufferedReader.
        Nz
no decoderr')r+r4r r
r!rUr��_CHUNK_SIZEr�r�rMr3rr,r)rk�
dec_buffer�	dec_flags�input_chunk�eof�
decoded_charss      r�_read_chunkzTextIOWrapper._read_chunk�s���=� ��\�*�*�*��=�	=�%)�M�$:�$:�$<�$<�!�J�	�
�?�	=��+�+�+�D�,<�=�=�K�K��+�*�*�4�+;�<�<�K��o���
�,�,�[�#�>�>�
����
�.�.�.��	!� ��-�-��D�4G�0H�0H�H�D�N�N� �D�N��=�	C�(��k�)A�B�D�N��w�rrc�P�||dzz|dzz|dzzt|��dzzS)N�@���)r
)rkr6rf�
bytes_to_feed�need_eof�
chars_to_skips      r�_pack_cookiezTextIOWrapper._pack_cookie	s?���I�r�M�*�m�S�.@�A��s�"�$�&*�8�n�n�c�&9�:�	;rc���t|d��\}}t|d��\}}t|d��\}}t|d��\}}|||t|��|fS)Nl)�divmodr
)rk�bigint�restr6rfrprqrrs        r�_unpack_cookiezTextIOWrapper._unpack_cookie	sg�����.�.���h� ��u�-�-���i�$�T�5�1�1���m�"(��u�"5�"5���-���M�4��>�>�=�P�Prc
���|jstd���|jstd���|���|j���}|j}|�|j�|j	rtd���|S|j\}}|t|��z}|j}|dkr|�
||��S|���}	t|j|z��}d}|dkr�|�d|f��t|�|d|�����}	|	|kr6|���\}
}|
s|}||	z}n>|t|
��z}d}n
||z}|dz}|dk��d}|�d|f��||z}|}
|dkr+|�
||
��|�|��Sd}d}d}t'|t|����D]n}|dz
}|t|�|||dz�����z
}|���\}}|s||kr||z
}||z}|dd}}}
||krn?�o|t|�dd	�
����z
}d	}||krtd���|�
||
|||��|�|��S#|�|��wxYw)N�!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrrrrFTr�z'can't reconstruct logical file position)r�rbr r<r}rUrur+rrrar3rrsr
r,r,rr��range)rkr6r�rf�
next_inputrr�saved_state�
skip_bytes�	skip_backr�r(�d�	start_pos�start_flags�	bytes_fedrq�
chars_decoded�ires                   rruzTextIOWrapper.tell$	s����~�	L�&�'J�K�K�K��}�	F��D�E�E�E��
�
�����;�#�#�%�%���-���?�d�n�4��"�
=�$�%;�<�<�<��O�!%���	�:��C�
�O�O�#���0�
��A����$�$�X�y�9�9�9��&�&�(�(��F	*��T�^�m�;�<�<�J��I��q�.�.�� � �#�y�!1�2�2�2�����z�+�:�+�'>�?�?�@�@���
�%�%�"�+�+�-�-�D�A�q���$%�	�%��*�
���#�a�&�&�(�J� !�I�I��)�+�J� )�A�
�I�#�q�.�.�&�
�� � �#�y�!1�2�2�2�!�:�-�I�#�K���!�!��(�(��K�@�@�@
���[�)�)�)�)�5�I��H��M��:�s�:���7�7�
M�
M���Q��	���W�^�^�J�q��1��u�4E�%F�%F�!G�!G�G�
�(/�(8�(8�(:�(:�%�
�I�!�L�m�}�&D�&D���*�I�!�]�2�M�<E�q�!�M��K� �M�1�1��E�2���W�^�^�C�t�^�%D�%D�!E�!E�E�
��� �=�0�0�!�"K�L�L�L��$�$��;�	�8�]�L�L�
���[�)�)�)�)��G���[�)�)�)�)���s�C'K�C(K�K(c��|���|�|���}|j�|��Sr�)r}rurUrwrxs  rrwzTextIOWrapper.truncate�	s7���
�
�����;��)�)�+�+�C��{�#�#�C�(�(�(rc�v�|j�td���|���|j}d|_|S)Nzbuffer is already detached)rUr4r}r)rkrUs  rr�zTextIOWrapper.detach�	s9���;���9�:�:�:��
�
�����������
rc�:���fd�}�jrtd����jstd���|tkr,|dkrtd���d}����}n�|tkr�|dkrtd��������j�	d|��}��
d��d�_�jr�j�
��||��|S|dkrtd|�d	����|dkrtd
|�����������|��\}}}}}	�j�	|����
d��d�_|dkr!�jr�j�
��nP�js|s|	rE�jp�����_�j�d|f��|df�_|	r�j�|��}
��
�j�|
|����||
f�_t'�j��|	krt+d���|	�_||��|S)
Nc����	�jp����}|dkr|�d��dS|���dS#t$rYdSwxYw)z9Reset the encoder (merely useful for proper BOM handling)rN)r*r5rrr)r6rPrks  �r�_reset_encoderz*TextIOWrapper.seek.<locals>._reset_encoder�	sz���	
$��-�>�4�+<�+<�+>�+>��
�q�=�=��$�$�Q�'�'�'�'�'��M�M�O�O�O�O�O���
�
�
����
���s�A�
A�Ar0rzrz#can't do nonzero cur-relative seeksz#can't do nonzero end-relative seeksr)zunsupported whence (�)r,rz#can't restore logical file position)r�r4r�rbr	rur
r}rUrnrMrr+rrxrWrr�r�r3rr<r)rk�cookierrr�r6r�rfrprqrrrgs`          rrnzTextIOWrapper.seek�	s����	$�	$�	$�	$�	$��;�	4��2�3�3�3��~�	L�&�'J�K�K�K��X�����{�{�*�+P�Q�Q�Q��F��Y�Y�[�[�F�F�
�x�
�
���{�{�*�+P�Q�Q�Q��J�J�L�L�L��{�'�'��6�2�2�H��#�#�B�'�'�'�!�D�N��}�
&��
�#�#�%�%�%��N�8�$�$�$��O��Q�;�;��*�&�&�&�B�C�C�C��A�:�:��*�F�F�D�E�E�E��
�
����

����'�'�	E�	�9�m�X�}�	
�����#�#�#�����#�#�#�����Q�;�;�4�=�;��M���!�!�!�!�
�]�	.�i�	.�=�	.� �M�@�T�->�->�-@�-@�D�M��M�"�"�C��#3�4�4�4�'��-�D�N��
	5��+�*�*�=�9�9�K��#�#��
�$�$�[�(�;�;�
=�
=�
=�'��5�D�N��4�&�'�'�-�7�7��C�D�D�D�'4�D�$���v�����
rc��|���|�d}n3	|j}|��}n #t$rt|�d����wxYw|jp|���}|dkrh|���|�|j�	��d���z}|j
�|�d��d|_
|Sd}|�|��}t|��|krT|sR|�
��}||�|t|��z
��z
}t|��|kr|�R|S)Nrr�rTr�r)F)r�r�r=r1r+rWr\r�rUr�rrMr3rj)rkr�r�r�rRrhs      rr�zTextIOWrapper.read�	sx���������<��D�D�
$�!�^�
�"�z�|�|����"�
?�
?�
?��4� =� =� =�>�>�>�
?�����-�6�4�#4�#4�#6�#6���!�8�8��-�-�/�/��n�n�T�[�%5�%5�%7�%7�t�n�D�D�E�F��~�)��'�'��+�+�+�!%����M��C��,�,�T�2�2�F��f�+�+��$�$�S�$��*�*�,�,�,���$�1�1�$��V���2D�E�E�E���f�+�+��$�$�S�$��Ms	�-�A
c�t�d|_|���}|sd|_|j|_t�|S)NF)r r�rr�r�r�s  rr�zTextIOWrapper.__next__�	s9����
��}�}�����	 �!�D�N� �N�D�M����rc��|jrtd���|�d}n3	|j}|��}n #t$rt	|�d����wxYw|���}d}|js|���dx}}	|jr3|�	d|��}|dkr|dz}�nUt|��}n�|jr{|�	d|��}|�	d|��}|dkr|dkrt|��}nk|dz}n�|dkr|dz}n�||kr|dz}n�||dzkr|d	z}n�|dz}n�|�	|j��}|dkr|t|j��z}n�|dkrt|��|kr|}no|�
��r|jrn|�
���|jr||���z
}n|�d
��d|_|S��|dkr||kr|}|�t|��|z
��|d|�S)Nr rr�rTr�rr�rr))r�r4r�r=r1r\r+rWr.r�r3r-r/rjrrMrrb)	rkr�r�r��startrq�endpos�nlpos�crposs	         rr�zTextIOWrapper.readline
s����;�	6��4�5�5�5��<��D�D�
$�!�^�
�"�z�|�|����"�
?�
?�
?��4� =� =� =�>�>�>�
?�����&�&�(�(�����}�	 ����������f�>	��"�-
��i�i��e�,�,���!�8�8� �1�W�F����I�I�E�E��$�$
�
�	�	�$��.�.���	�	�$��.�.���B�;�;���{�{� #�D�	�	���"'������b�[�[�"�Q�Y�F���U�]�]�"�Q�Y�F���e�a�i�'�'�"�Q�Y�F��#�Q�Y�F���i�i���-�-���!�8�8� �3�t�|�#4�#4�4�F���q�y�y�S��Y�Y�$�.�.�����"�"�$�$�
��&����"�"�$�$�
��"�
���/�/�1�1�1����'�'��+�+�+�!%�����}>	�@�1�9�9��$����F�	
�"�"�3�t�9�9�v�#5�6�6�6��G�V�G�}�r"c�,�|jr|jjndSr�)r+r�rts rr�zTextIOWrapper.newlinesc
s��)-��@�t�}�%�%�D�@r)NNNFFr�)rrFrr�)-r^rcrdr�rdrr�rr"rr�rrFrSr#rUr?r@r�r�r�r}rCr�r_r:r7r�r5rWrMr\rrbrjrsrxrurwr�rnr�r�r�r�rerrrArA�s2��������,�K��G�
DH�5:�7�7�7�7�BG�G�G�>B�7<�����HA�A�A�"����X������X���$�$��X�$��#�#��X�#�����X��"�$��#'�t�)7�)7�)7�)7�)7�V���
&�&�&�&�&�&�'�'�'�$�$�$��"�"��X�"�� � ��X� �$�$�$�$�$�$����0���
���%�%�%�
����(�(�(�&�&�&�(�(�(�T01�JK�;�;�;�;�Q�Q�Q�a*�a*�a*�F)�)�)�)����I�I�I�I�V����:���[�[�[�[�z�A�A��X�A�A�ArrAc�b��eZdZdZd
�fd�	Zd�Zd�Zed���Zed���Z	d	�Z
�xZS)�StringIOz�Text I/O implementation using an in-memory buffer.

    The initial_value argument sets the value of object.  The newline
    argument is like the one of TextIOWrapper's constructor.
    r)r�c�x��tt|���t��dd|���|�d|_|�ut|t��s4td�t|��j
�����|�|��|�d��dSdS)Nr�
surrogatepass)rrFrGFz*initial_value must be str or None, not {0}r)
rr�r�r
r0r+r/r1rr%r^r�rn)rk�
initial_valuerGrjs   �rr�zStringIO.__init__o
s����
�h����&�&�w�y�y�07�.=�/6�	'�	8�	8�	8��?�#(�D� ��$��m�S�1�1�
G�� L�!'���]�(;�(;�(D�!E�!E�G�G�G��J�J�}�%�%�%��I�I�a�L�L�L�L�L�%�$rc�l�|���|jp|���}|���}|���	|�|j���d���|�|��S#|�|��wxYw)NTr�)	r}r+rWr
rr�rUrr)rkr��	old_states   rrzStringIO.getvalue
s����
�
�����-�6�4�#4�#4�#6�#6���$�$�&�&�	��
�
����	(��>�>�$�+�"6�"6�"8�"8��>�E�E����Y�'�'�'�'��G���Y�'�'�'�'���s�-B�B3c�6�t�|��Sr�)�objectrrts rrzStringIO.__repr__�
s�����t�$�$�$rc��dSr�rerts rrFzStringIO.errors�
����trc��dSr�rerts rrzStringIO.encoding�
r�rc�0�|�d��dS)Nr�rorts rr�zStringIO.detach�
s�����(�#�#�#�#�#r)r)r�)r^rcrdr�r�rrr�rFrr�r7r8s@rr�r�h
s���������������� (�(�(�%�%�%�
����X������X��$�$�$�$�$�$�$rr�)r)rrNNNTN):r�r-�abcr�rir�r�_threadrr>�platform�msvcrtrr��iorrr	r
r_r��addr
�	SEEK_DATAr8rhr�dev_moder�rr�staticmethodrVrZ�	open_coder=r`rbr<r4�ABCMetarg�registerr��_ior6r�r�r
r@r?rxr>r�r�r�rAr�rerr�<module>r�sy����
�	�	�	�
�
�
�
�
�
�
�
���������
�
�
�
�)�)�)�)�)�)��<�&�&�&�*�*�*�*�*�*�*��H�	�	�	�	�6�6�6�6�6�6�6�6�6�6�6�6��9�9��
�7�2�{���'������&�&�&������&�&�&���"��$�G�C�);�<�<�R��	�@R��(�
�����B�=A�,0�K�K�K���K�^��� (���I�I���(�(�(�'�I�I�I�(����
K�
K�
K�$
��2�����
�
�
�
�
�
�
�
�w�
�
�
�
�
�
�
����
_�_�_�_�_�s�{�_�_�_�_�B	�	���6����;#�;#�;#�;#�;#��;#�;#�;#�z����i� � � �������	���6����e$�e$�e$�e$�e$�V�e$�e$�e$�N����>�*�*�*�h!�h!�h!�h!�h!�~�h!�h!�h!�VL�L�L�L�L�n�L�L�L�^A�A�A�A�A�%�A�A�A�Ff!�f!�f!�f!�f!�%�f!�f!�f!�RF"�F"�F"�F"�F"�^�F"�F"�F"�RG-�G-�G-�G-�G-�^�^�G-�G-�G-�TT�T�T�T�T�Y�T�T�T�n
>�>�>�>�>��>�>�>�@�
���z�"�"�"�R�R�R�R�R�� 9�R�R�R�jb
A�b
A�b
A�b
A�b
A�J�b
A�b
A�b
A�J0$�0$�0$�0$�0$�}�0$�0$�0$�0$�0$s$�;C�C
�C
�C�C3�2C3

?>