Your IP : 3.21.46.129


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/codecs.cpython-312.pyc

�

�Q�f����dZddlZddlZ	ddl�gd�ZdZdxZ	Z
dxZZd	Z
d
Zejdk(re
xZZe
ZnexZZeZe
ZeZe
ZeZGd�d
e�ZGd�d�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Z Gd�d�Z!Gd�d�Z"d2d!�Z#d3d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d4d)�Z+d4d*�Z,d+�Z-d,�Z.	e/d �Z0e/d-�Z1e/d.�Z2e/d/�Z3e/d0�Z4e/d1�Z5dZ7e7rddl8Z8yy#e$rZedez��dZ[wwxYw#e6$rdZ0dZ1dZ2dZ3dZ4dZ5Y�5wxYw)5z� codecs -- Python Codec Registry, API and helpers.


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N)�*z%Failed to load the builtin codecs: %s),�register�lookup�open�EncodedFile�BOM�BOM_BE�BOM_LE�BOM32_BE�BOM32_LE�BOM64_BE�BOM64_LE�BOM_UTF8�	BOM_UTF16�BOM_UTF16_LE�BOM_UTF16_BE�	BOM_UTF32�BOM_UTF32_LE�BOM_UTF32_BE�	CodecInfo�Codec�IncrementalEncoder�IncrementalDecoder�StreamReader�StreamWriter�StreamReaderWriter�
StreamRecoder�
getencoder�
getdecoder�getincrementalencoder�getincrementaldecoder�	getreader�	getwriter�encode�decode�
iterencode�
iterdecode�
strict_errors�
ignore_errors�replace_errors�xmlcharrefreplace_errors�backslashreplace_errors�namereplace_errors�register_error�lookup_errorss��s��s��s���littlec�,�eZdZdZdZ		ddd�d�Zd�Zy)rz0Codec details when looking up the codec registryTN)�_is_text_encodingc��tj|||||f�}	||	_||	_||	_||	_||	_||	_||	_|�||	_	|	S�N)
�tuple�__new__�namer$r%�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr2)
�clsr$r%r;r:r8r9r7r2�selfs
          �-/opt/alt/python312/lib64/python3.12/codecs.pyr6zCodecInfo.__new__^se���}�}�S�6�6�<��"N�O����	�������"4���"4���(���(����(�%6�D�"���c��d|jj|jj|jt	|�fzS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r7�id�r=s r>�__repr__zCodecInfo.__repr__ms:��6����*�*�D�N�N�,G�,G����B�t�H�&�&�	&r?)NNNNN)�__name__rBrC�__doc__r2r6rF�r?r>rrSs%��:���EI�?C�
�!�
�&r?rc� �eZdZdZdd�Zdd�Zy)ra9 Defines the interface for stateless encoders/decoders.

        The .encode()/.decode() methods may use different error
        handling schemes by providing the errors argument. These
        string values are predefined:

         'strict' - raise a ValueError error (or a subclass)
         'ignore' - ignore the character and continue with the next
         'replace' - replace with a suitable replacement character;
                    Python will use the official U+FFFD REPLACEMENT
                    CHARACTER for the builtin Unicode codecs on
                    decoding and '?' on encoding.
         'surrogateescape' - replace with private code points U+DCnn.
         'xmlcharrefreplace' - Replace with the appropriate XML
                               character reference (only for encoding).
         'backslashreplace'  - Replace with backslashed escape sequences.
         'namereplace'       - Replace with \N{...} escape sequences
                               (only for encoding).

        The set of allowed values can be extended via register_error.

    c��t�)a# Encodes the object input and returns a tuple (output
            object, length consumed).

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamWriter for codecs which have to keep state in order to
            make encoding efficient.

            The encoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        ��NotImplementedError�r=�input�errorss   r>r$zCodec.encode�s
��""�!r?c��t�)a� Decodes the object input and returns a tuple (output
            object, length consumed).

            input must be an object which provides the bf_getreadbuf
            buffer slot. Python strings, buffer objects and memory
            mapped files are examples of objects providing this slot.

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamReader for codecs which have to keep state in order to
            make decoding efficient.

            The decoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        rLrNs   r>r%zCodec.decode�s
��*"�!r?N��strict)rGrBrCrHr$r%rIr?r>rrrs���,"�&"r?rc�2�eZdZdZdd�Zd	d�Zd�Zd�Zd�Zy)
rz�
    An IncrementalEncoder encodes an input in multiple steps. The input can
    be passed piece by piece to the encode() method. The IncrementalEncoder
    remembers the state of the encoding process between calls to encode().
    c� �||_d|_y)z�
        Creates an IncrementalEncoder instance.

        The IncrementalEncoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        �N)rP�buffer�r=rPs  r>�__init__zIncrementalEncoder.__init__�s�������r?c��t�)zA
        Encodes input and returns the resulting object.
        rL�r=rO�finals   r>r$zIncrementalEncoder.encode��
��"�!r?c��y)z:
        Resets the encoder to the initial state.
        NrIrEs r>�resetzIncrementalEncoder.reset���r?c��y)z:
        Return the current state of the encoder.
        rrIrEs r>�getstatezIncrementalEncoder.getstate�s��r?c��y)zl
        Set the current state of the encoder. state must have been
        returned by getstate().
        NrI�r=�states  r>�setstatezIncrementalEncoder.setstate�r`r?NrR�F)	rGrBrCrHrYr$r_rbrfrIr?r>rr�s ���
	�"��
�r?rc�8�eZdZdZd	d�Zd�Zd
d�Zd�Zd�Zd�Z	y)�BufferedIncrementalEncoderz�
    This subclass of IncrementalEncoder can be used as the baseclass for an
    incremental encoder if the encoder must keep some of the output in a
    buffer between calls to encode().
    c�>�tj||�d|_y�NrV)rrYrWrXs  r>rYz#BufferedIncrementalEncoder.__init__�s���#�#�D�&�1���r?c��t�r4rL�r=rOrPr\s    r>�_buffer_encodez)BufferedIncrementalEncoder._buffer_encode��
��"�!r?c�x�|j|z}|j||j|�\}}||d|_|Sr4)rWrnrP�r=rOr\�data�result�consumeds      r>r$z!BufferedIncrementalEncoder.encode��?���{�{�U�"��!�0�0��t�{�{�E�J�����8�9�o����
r?c�<�tj|�d|_yrk)rr_rWrEs r>r_z BufferedIncrementalEncoder.reset�s��� � ��&���r?c�"�|jxsdS�Nr�rWrEs r>rbz#BufferedIncrementalEncoder.getstate�s���{�{��a�r?c��|xsd|_yrkryrds  r>rfz#BufferedIncrementalEncoder.setstate�s
���k�r��r?NrRrg)
rGrBrCrHrYrnr$r_rbrfrIr?r>riri�s%���
�
"�
�� �"r?ric�2�eZdZdZdd�Zd	d�Zd�Zd�Zd�Zy)
rz�
    An IncrementalDecoder decodes an input in multiple steps. The input can
    be passed piece by piece to the decode() method. The IncrementalDecoder
    remembers the state of the decoding process between calls to decode().
    c��||_y)z�
        Create an IncrementalDecoder instance.

        The IncrementalDecoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        N)rPrXs  r>rYzIncrementalDecoder.__init__s����r?c��t�)z@
        Decode input and returns the resulting object.
        rLr[s   r>r%zIncrementalDecoder.decoder]r?c��y)z9
        Reset the decoder to the initial state.
        NrIrEs r>r_zIncrementalDecoder.resetr`r?c��y)a	
        Return the current state of the decoder.

        This must be a (buffered_input, additional_state_info) tuple.
        buffered_input must be a bytes object containing bytes that
        were passed to decode() that have not yet been converted.
        additional_state_info must be a non-negative integer
        representing the state of the decoder WITHOUT yet having
        processed the contents of buffered_input.  In the initial state
        and after reset(), getstate() must return (b"", 0).
        )r?rrIrEs r>rbzIncrementalDecoder.getstates��r?c��y)z�
        Set the current state of the decoder.

        state must have been returned by getstate().  The effect of
        setstate((b"", 0)) must be equivalent to reset().
        NrIrds  r>rfzIncrementalDecoder.setstate'r`r?NrRrg)	rGrBrCrHrYr%r_rbrfrIr?r>rr�s ���
�"��
�r?rc�8�eZdZdZd	d�Zd�Zd
d�Zd�Zd�Zd�Z	y)�BufferedIncrementalDecoderz�
    This subclass of IncrementalDecoder can be used as the baseclass for an
    incremental decoder if the decoder must be able to handle incomplete
    byte sequences.
    c�>�tj||�d|_y�Nr?)rrYrWrXs  r>rYz#BufferedIncrementalDecoder.__init__5s���#�#�D�&�1���r?c��t�r4rLrms    r>�_buffer_decodez)BufferedIncrementalDecoder._buffer_decode:ror?c�x�|j|z}|j||j|�\}}||d|_|Sr4)rWr�rPrqs      r>r%z!BufferedIncrementalDecoder.decode?rur?c�<�tj|�d|_yr�)rr_rWrEs r>r_z BufferedIncrementalDecoder.resetGs��� � ��&���r?c��|jdfSrxryrEs r>rbz#BufferedIncrementalDecoder.getstateKs�����Q��r?c��|d|_yrxryrds  r>rfz#BufferedIncrementalDecoder.setstateOs
���A�h��r?NrRrg)
rGrBrCrHrYr�r%r_rbrfrIr?r>r�r�/s%���
�
"�
�� �r?r�c�J�eZdZdd�Zd�Zd�Zd�Zdd�Zefd�Z	d�Z
d�Zd	�Zy
)
rc� �||_||_y)aw Creates a StreamWriter instance.

            stream must be a file-like object open for writing.

            The StreamWriter may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'xmlcharrefreplace' - Replace with the appropriate XML
                                   character reference.
             'backslashreplace'  - Replace with backslashed escape
                                   sequences.
             'namereplace'       - Replace with \N{...} escape sequences.

            The set of allowed parameter values can be extended via
            register_error.
        N)�streamrP�r=r�rPs   r>rYzStreamWriter.__init__\s��,�����r?c�x�|j||j�\}}|jj|�y)z> Writes the object's contents encoded to self.stream.
        N)r$rPr��write)r=�objectrrrts    r>r�zStreamWriter.writeus.�����V�T�[�[�9���h������$�r?c�D�|jdj|��y)z[ Writes the concatenated list of strings to the stream
            using .write().
        rVN)r��join�r=�lists  r>�
writelineszStreamWriter.writelines|s��
	
�
�
�2�7�7�4�=�!r?c��y)a2 Resets the codec buffers used for keeping internal state.

            Calling this method should ensure that the data on the
            output is put into a clean state, that allows appending
            of new fresh data without having to rescan the whole
            stream to recover state.

        NrIrEs r>r_zStreamWriter.reset�s��	
r?c�t�|jj||�|dk(r|dk(r|j�yyyrx�r��seekr_�r=�offset�whences   r>r�zStreamWriter.seek�s3���������(��Q�;�6�Q�;��J�J�L�'�;r?c�(�||j|�S�z? Inherit all other methods from the underlying stream.
        �r��r=r7�getattrs   r>�__getattr__zStreamWriter.__getattr__����
�t�{�{�D�)�)r?c��|Sr4rIrEs r>�	__enter__zStreamWriter.__enter__�����r?c�8�|jj�yr4�r��close�r=�type�value�tbs    r>�__exit__zStreamWriter.__exit__���������r?c�F�td|jjz���Nzcan't serialize %s��	TypeErrorrArG�r=�protos  r>�
__reduce_ex__zStreamWriter.__reduce_ex__�����,�t�~�~�/F�/F�F�G�Gr?NrR�r)
rGrBrCrYr�r�r_r�r�r�r�r�r�rIr?r>rrZs5���2 �"�

��$�*���Hr?rc�n�eZdZeZdd�Zdd�Zdd�Zdd�Zdd�Z	d�Z
dd�Zd	�Zd
�Z
efd�Zd�Zd
�Zd�Zy)rc��||_||_d|_|j�|_|j|_d|_y)a� Creates a StreamReader instance.

            stream must be a file-like object open for reading.

            The StreamReader may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'backslashreplace' - Replace with backslashed escape sequences;

            The set of allowed parameter values can be extended via
            register_error.
        r?N)r�rP�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebufferr�s   r>rYzStreamReader.__init__�s>��$���������!%�!4�!4�!6����0�0�����r?c��t�r4rLrNs   r>r%zStreamReader.decode�s��!�!r?c�F�|jr1|jj|j�|_d|_|dkr|}	|dk\rt	|j�|k\rn�|dkr|j
j
�}n|j
j
|�}|j|z}|snC	|j||j�\}}||d|_|xj|z
c_|sn��|dkr|j}
|j|_|
S|jd|}
|j|d|_|
S#t$rZ}|rM|j|d|j|j�\}}|jd��}	t	|	�dkr��Yd}~��d}~wwxYw)a� Decodes data from the stream self.stream and returns the
            resulting object.

            chars indicates the number of decoded code points or bytes to
            return. read() will never return more data than requested,
            but it might return less, if there is not enough available.

            size indicates the approximate maximum number of decoded
            bytes or code points to read for decoding. The decoder
            can modify this setting as appropriate. The default value
            -1 indicates to read and decode as much as possible.  size
            is intended to prevent having to decode huge files in one
            step.

            If firstline is true, and a UnicodeDecodeError happens
            after the first line terminator in the input only the first line
            will be returned, the rest of the input will be kept until the
            next call to read().

            The method should use a greedy read strategy, meaning that
            it should read as much data as is allowed within the
            definition of the encoding and the given size, e.g.  if
            optional encoding endings or state markers are available
            on the stream, these should be read too.
        NrT��keepends�)
r�r�r�r��lenr��readr�r%rP�UnicodeDecodeError�start�
splitlines)r=�size�chars�	firstline�newdatarr�newchars�decodedbytes�exc�linesrss           r>r�zStreamReader.read�s���8�?�?�"�4�4�9�9�$�/�/�J�D�O�"�D�O��1�9��E����z��t���'�5�0���a�x��+�+�*�*�,���+�+�*�*�4�0���?�?�W�,�D���

�)-���T�4�;�;�)G�&��,�#�<�=�1�D�O��O�O�x�'�O���?�@�1�9��_�_�F�"�4�4�D�O�
�
��_�_�V�e�,�F�"�o�o�e�f�5�D�O��
��1&�
�����D��#�)�)�$4�d�k�k�B�+�H�l�$�/�/��/�>�E��5�z�1�}���%��
�s�2D=�=	F �AF�F Nc�&�|jrh|jd}|jd=t|j�dk(r|jd|_d|_|s|jd��d}|S|xsd}|j}	|j|d��}|rXt
|t�r|jd	�s!t
|t�r'|jd
�r||jdd��z
}||z
}|jd��}|r�t|�dkDrm|d}|d=t|�dkDr&|dxx|jz
cc<||_d|_n|d|jz|_|s|jd��d}	|S|d}|djd��d}||k7r<|jj|dd�|jz|_|r|}	|S|}	|S|r|�|r|s|jd��d}	|S|d
kr|dz}���)z� Read one line from the input stream and return the
            decoded data.

            size, if given, is passed as size argument to the
            read() method.

        rr�NFr��HT)r��
�
)r�r����i@�)r�r�r�r�r�r��
isinstance�str�endswith�bytesr�)	r=r�r��line�readsizerrr��line0withend�line0withoutends	         r>�readlinezStreamReader.readlines;���?�?��?�?�1�%�D�����"��4�?�?�#�q�(�#'�/�/�!�"4���"&���������6�q�9���K��:�2���%�%����9�9�X��9�6�D���t�S�)�d�m�m�D�.A��t�U�+��
�
�e�0D��D�I�I�1�A�I�6�6�D��D�L�D��O�O�T�O�2�E���u�:��>�!��8�D��a���5�z�A�~��b�	�T�_�_�4�	�*/���*.���+0��(�T�_�_�*D���#�#�����>�q�A���&��% %�Q�x��"'��(�"5�"5�u�"5�"E�a�"H���?�2�&*�&<�&<�&A�&A�%���)�&L�&*�o�o�'6�D�O��+����� /�����
�4�+����?�?�E�?�:�1�=�D�����$���A�
��]r?c�D�|j�}|j|�S)aS Read all lines available on the input stream
            and return them as a list.

            Line breaks are implemented using the codec's decoder
            method and are included in the list entries.

            sizehint, if given, is ignored since there is no efficient
            way to finding the true end-of-line.

        )r�r�)r=�sizehintr�rrs    r>�	readlineszStreamReader.readlinesas���y�y�{�����x�(�(r?c�B�d|_|j|_d|_y)z� Resets the codec buffers used for keeping internal state.

            Note that no stream repositioning should take place.
            This method is primarily intended to be able to recover
            from decoding errors.

        r?N)r�r�r�r�rEs r>r_zStreamReader.resetps������0�0�����r?c�\�|jj||�|j�y)zp Set the input stream's current position.

            Resets the codec buffers used for keeping state.
        Nr�r�s   r>r�zStreamReader.seek}s!��
	
�������(��
�
�r?c�6�|j�}|r|St��z4 Return the next decoded line from the input stream.)r��
StopIteration)r=r�s  r>�__next__zStreamReader.__next__�s���}�}�����K��r?c��|Sr4rIrEs r>�__iter__zStreamReader.__iter__�r�r?c�(�||j|�Sr�r�r�s   r>r�zStreamReader.__getattr__�r�r?c��|Sr4rIrEs r>r�zStreamReader.__enter__�r�r?c�8�|jj�yr4r�r�s    r>r�zStreamReader.__exit__�r�r?c�F�td|jjz��r�r�r�s  r>r�zStreamReader.__reduce_ex__�r�r?rR)r�r�F)NTr�)rGrBrCr�r�rYr%r�r�r�r_r�r�r�r�r�r�r�r�rIr?r>rr�sR���N��2"�N�`I�V
)�����$�*���Hr?rc�v�eZdZdZdZdd�Zdd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zd�Zd�Z
dd
�Zefd�Zd�Zd�Zd�Zy)ra StreamReaderWriter instances allow wrapping streams which
        work in both read and write modes.

        The design is such that one can use the factory functions
        returned by the codec.lookup() function to construct the
        instance.

    �unknownc�X�||_|||�|_|||�|_||_y)aR Creates a StreamReaderWriter instance.

            stream must be a Stream-like object.

            Reader, Writer must be factory functions or classes
            providing the StreamReader, StreamWriter interface resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)r��reader�writerrP)r=r��Reader�WriterrPs     r>rYzStreamReaderWriter.__init__�s.������V�V�,����V�V�,�����r?c�8�|jj|�Sr4)r�r��r=r�s  r>r�zStreamReaderWriter.read�s���{�{����%�%r?Nc�8�|jj|�Sr4)r�r�r�s  r>r�zStreamReaderWriter.readline�s���{�{�#�#�D�)�)r?c�8�|jj|�Sr4)r�r�)r=r�s  r>r�zStreamReaderWriter.readlines�s���{�{�$�$�X�.�.r?c�,�t|j�Sr�)�nextr�rEs r>r�zStreamReaderWriter.__next__�s���D�K�K� � r?c��|Sr4rIrEs r>r�zStreamReaderWriter.__iter__�r�r?c�8�|jj|�Sr4)r�r�)r=rrs  r>r�zStreamReaderWriter.write�s���{�{� � ��&�&r?c�8�|jj|�Sr4)r�r�r�s  r>r�zStreamReaderWriter.writelines�s���{�{�%�%�d�+�+r?c�l�|jj�|jj�yr4�r�r_r�rEs r>r_zStreamReaderWriter.reset��"�������������r?c��|jj||�|jj�|dk(r!|dk(r|jj�yyyrx)r�r�r�r_r�r�s   r>r�zStreamReaderWriter.seek�sJ���������(��������Q�;�6�Q�;��K�K����'�;r?c�(�||j|�Sr�r�r�s   r>r�zStreamReaderWriter.__getattr__�r�r?c��|Sr4rIrEs r>r�zStreamReaderWriter.__enter__�r�r?c�8�|jj�yr4r�r�s    r>r�zStreamReaderWriter.__exit__�r�r?c�F�td|jjz��r�r�r�s  r>r�z StreamReaderWriter.__reduce_ex__�r�r?rR�r�r4r�)rGrBrCrH�encodingrYr�r�r�r�r�r�r�r_r�r�r�r�r�r�rIr?r>rr�sZ����H��$&�*�/�!�
�'�,��
 �$�*���Hr?rc�|�eZdZdZdZdZ	dd�Zdd�Zdd�Zdd�Z	d�Z
d	�Zd
�Zd�Z
d�Zdd
�Zefd�Zd�Zd�Zd�Zy)raB StreamRecoder instances translate data from one encoding to another.

        They use the complete set of APIs returned by the
        codecs.lookup() function to implement their task.

        Data written to the StreamRecoder is first decoded into an
        intermediate format (depending on the "decode" codec) and then
        written to the underlying stream using an instance of the provided
        Writer class.

        In the other direction, data is read from the underlying stream using
        a Reader instance and then encoded and returned to the caller.

    r�c�t�||_||_||_|||�|_|||�|_||_y)a� Creates a StreamRecoder instance which implements a two-way
            conversion: encode and decode work on the frontend (the
            data visible to .read() and .write()) while Reader and Writer
            work on the backend (the data in stream).

            You can use these objects to do transparent
            transcodings from e.g. latin-1 to utf-8 and back.

            stream must be a file-like object.

            encode and decode must adhere to the Codec interface; Reader and
            Writer must be factory functions or classes providing the
            StreamReader and StreamWriter interfaces resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)r�r$r%r�r�rP)r=r�r$r%r�r�rPs       r>rYzStreamRecoder.__init__s<��*����������V�V�,����V�V�,�����r?c�z�|jj|�}|j||j�\}}|Sr4)r�r�r$rP�r=r�rr�bytesencodeds    r>r�zStreamRecoder.read,s4���{�{����%��!�[�[��t�{�{�;���l��r?Nc��|�|jj�}n|jj|�}|j||j�\}}|Sr4)r�r�r$rPrs    r>r�zStreamRecoder.readline2sK���<��;�;�'�'�)�D��;�;�'�'��-�D�!�[�[��t�{�{�;���l��r?c��|jj�}|j||j�\}}|j	d��S)NTr�)r�r�r$rPr�)r=r�rrrs    r>r�zStreamRecoder.readlines;s>���{�{���!��!�[�[��t�{�{�;���l������-�-r?c�n�t|j�}|j||j�\}}|Sr�)r�r�r$rP)r=rrrs   r>r�zStreamRecoder.__next__As0���D�K�K� ��!�[�[��t�{�{�;���l��r?c��|Sr4rIrEs r>r�zStreamRecoder.__iter__Hr�r?c�v�|j||j�\}}|jj|�Sr4)r%rPr�r�)r=rr�bytesdecodeds   r>r�zStreamRecoder.writeKs0��!�[�[��t�{�{�;���l��{�{� � ��&�&r?c��dj|�}|j||j�\}}|jj	|�Sr�)r�r%rPr�r�)r=r�rrrs    r>r�zStreamRecoder.writelinesPs=���x�x��~��!�[�[��t�{�{�;���l��{�{� � ��&�&r?c�l�|jj�|jj�yr4rrEs r>r_zStreamRecoder.resetVrr?c�t�|jj||�|jj||�yr4)r�r�r�r�s   r>r�zStreamRecoder.seek[s,��	
�������(��������(r?c�(�||j|�Sr�r�r�s   r>r�zStreamRecoder.__getattr__ar�r?c��|Sr4rIrEs r>r�zStreamRecoder.__enter__hr�r?c�8�|jj�yr4r�r�s    r>r�zStreamRecoder.__exit__kr�r?c�F�td|jjz��r�r�r�s  r>r�zStreamRecoder.__reduce_ex__nr�r?rRr	r4r�)rGrBrCrH�
data_encoding�
file_encodingrYr�r�r�r�r�r�r�r_r�r�r�r�r�r�rIr?r>rr�sd��
��M��M�!��8��.���'�
'��
)�$�*���Hr?rrSc���|�	d|vr|dz}tj|||�}|�|S	t|�}t||j|j
|�}||_|S#|j��xYw)a� Open an encoded file using the given mode and return
        a wrapped version providing transparent encoding/decoding.

        Note: The wrapped version will only accept the object format
        defined by the codecs, i.e. Unicode objects for most builtin
        codecs. Output is also codec dependent and will usually be
        Unicode as well.

        If encoding is not None, then the
        underlying encoded files are always opened in binary mode.
        The default file mode is 'r', meaning to open the file in read mode.

        encoding specifies the encoding which is to be used for the
        file.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        buffering has the same meaning as for the builtin open() API.
        It defaults to -1 which means that the default buffer size will
        be used.

        The returned wrapped file object provides an extra attribute
        .encoding which allows querying the used encoding. This
        attribute is only available if an encoding was specified as
        parameter.

    �b)�builtinsrrrr;r:r
r�)�filename�moder
rP�	buffering�file�info�srws        r>rrss���>��
�$���c�z���=�=��4��3�D�������h��� ��t�'8�'8�$�:K�:K�V�T������
����
�
��
�s�5A�A1c���|�|}t|�}t|�}t||j|j|j|j
|�}||_||_|S)a� Return a wrapped version of file which provides transparent
        encoding translation.

        Data written to the wrapped file is decoded according
        to the given data_encoding and then encoded to the underlying
        file using file_encoding. The intermediate data type
        will usually be Unicode but depends on the specified codecs.

        Bytes read from the file are decoded using file_encoding and then
        passed back to the caller encoded using data_encoding.

        If file_encoding is not given, it defaults to data_encoding.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        The returned wrapped file object provides two extra attributes
        .data_encoding and .file_encoding which reflect the given
        parameters of the same name. The attributes can be used for
        introspection by Python programs.

    )rrr$r%r;r:rr)r%rrrP�	data_info�	file_info�srs       r>rr�sj��2��%�
��}�%�I��}�%�I�	�t�Y�-�-�y�/?�/?� �-�-�y�/E�/E�v�
O�B�%�B��$�B��
�Ir?c�,�t|�jS)z� Lookup up the codec for the given encoding and return
        its encoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr$�r
s r>rr�����(��"�"�"r?c�,�t|�jS)z� Lookup up the codec for the given encoding and return
        its decoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr%r-s r>rr�r.r?c�J�t|�j}|�t|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalEncoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental encoder.

    )rr8�LookupError)r
�encoders  r>r r ��)���X��1�1�G����(�#�#��Nr?c�J�t|�j}|�t|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalDecoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental decoder.

    )rr9r1)r
�decoders  r>r!r!�r3r?c�,�t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamReader class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr;r-s r>r"r"�����(��(�(�(r?c�,�t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamWriter class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr:r-s r>r#r#r7r?c+�K�t|�|fi|��}|D]}|j|�}|s�|���|jdd�}|r|��yy�w)z�
    Encoding iterator.

    Encodes the input strings from the iterator using an IncrementalEncoder.

    errors and kwargs are passed through to the IncrementalEncoder
    constructor.
    rVTN)r r$)�iteratorr
rP�kwargsr2rO�outputs       r>r&r&s^����.�#�H�-�f�?��?�G�������&����L���^�^�B��
%�F�
�����
�+A� Ac+�K�t|�|fi|��}|D]}|j|�}|s�|���|jdd�}|r|��yy�w)z�
    Decoding iterator.

    Decodes the input strings from the iterator using an IncrementalDecoder.

    errors and kwargs are passed through to the IncrementalDecoder
    constructor.
    r?TN)r!r%)r:r
rPr;r5rOr<s       r>r'r' s^����.�#�H�-�f�?��?�G�������&����L���^�^�C��
&�F�
����r=c�.�|D�cic]}||��c}Scc}w)z� make_identity_dict(rng) -> dict

        Return a dictionary where elements of the rng sequence are
        mapped to themselves.

    rI)�rng�is  r>�make_identity_dictrB4s �����A�A�a�C�����s�
c�X�i}|j�D]\}}||vr|||<�d||<�|S)a� Creates an encoding map from a decoding map.

        If a target mapping in the decoding map occurs multiple
        times, then that target is mapped to None (undefined mapping),
        causing an exception when encountered by the charmap codec
        during translation.

        One example where this happens is cp875.py which decodes
        multiple character to \u001a.

    N)�items)�decoding_map�m�k�vs    r>�make_encoding_maprI>s@��	�A��!�!�#���!��A�v��A�a�D��A�a�D�	$�

�Hr?�ignore�replace�xmlcharrefreplace�backslashreplace�namereplace)�rNrSr�)NrSrR)9rHr!�sys�_codecs�ImportError�why�SystemError�__all__rr
rr	rrr�	byteorderrrrrrrr
r5rrr�rrirr�rrrrrrrrr r!r"r#r&r'rBrIr/r(r)r*r+r,r-r1�_false�	encodingsrIr?r>�<module>rYs����
�E��
-��0��$�#���$�#���#��#���=�=�H��#�"�C�)��I�
#�"�C�)��I���������
&��&�>@"�@"�D&��&�P "�!3� "�D/��/�b"�!3�"�VHH�5�HH�XxH�5�xH�xVH�VH�tsH�sH�n/�b"�L#�#���)�)��$�(�
�.� ��*�M� ��*�M�!�)�,�N�+�,?�@��*�+=�>��%�m�4��
��	��
��o"�E�
�=��C�
D�D��E��V"���M��M��N�#��"�����s)�D�0D-�D*�D%�%D*�-E�E

?>