AlkantarClanX12

Your IP : 3.22.249.229


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/codecs.cpython-39.pyc

a

R�fA��
@sNdZddlZddlZzddlTWn0eyPZzede��WYdZ[n
dZ[00gd�ZdZdZ	Z
dZZd	Z
d
Zejdkr�e
ZZe
ZneZZeZe
ZeZe
ZeZGdd
�d
e�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�d�Z!Gdd�d�Z"dCd#d$�Z#dDd%d&�Z$d'd(�Z%d)d*�Z&d+d,�Z'd-d.�Z(d/d0�Z)d1d2�Z*dEd3d4�Z+dFd5d6�Z,d7d8�Z-d9d:�Z.z4e/d!�Z0e/d;�Z1e/d<�Z2e/d=�Z3e/d>�Z4e/d?�Z5Wn,e6�ydZ0dZ1dZ2dZ3dZ4dZ5Yn0dZ7e7�r ddl8Z8e9d@k�rJe$ej:dAdB�e_:e$ej;dBdA�e_;dS)Gz� 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@s,eZdZdZdZd	dd�dd�Zdd�ZdS)
rz0Codec details when looking up the codec registryTN)�_is_text_encodingc
CsPt�|||||f�}	||	_||	_||	_||	_||	_||	_||	_|durL||	_	|	S�N)
�tuple�__new__�namer#r$�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr0)
�clsr#r$r8r7r5r6r4r0�self�r;�+/opt/alt/python39/lib64/python3.9/codecs.pyr3^szCodecInfo.__new__cCsd|jj|jj|jt|�fS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r4�id�r:r;r;r<�__repr__ms

��zCodecInfo.__repr__)NNNNN)�__name__r>r?�__doc__r0r3rBr;r;r;r<rSs��rc@s$eZdZdZddd�Zd	dd�ZdS)
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.

    �strictcCst�dS)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.

        N��NotImplementedError�r:�input�errorsr;r;r<r#�szCodec.encodecCst�dS)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.

        NrFrHr;r;r<r$�szCodec.decodeN)rE)rE)rCr>r?rDr#r$r;r;r;r<rrs
rc@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)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().
    rEcCs||_d|_dS)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)rJ�buffer�r:rJr;r;r<�__init__�szIncrementalEncoder.__init__FcCst�dS)zA
        Encodes input and returns the resulting object.
        NrF�r:rI�finalr;r;r<r#�szIncrementalEncoder.encodecCsdS)z:
        Resets the encoder to the initial state.
        Nr;rAr;r;r<�reset�szIncrementalEncoder.resetcCsdS)z:
        Return the current state of the encoder.
        rr;rAr;r;r<�getstate�szIncrementalEncoder.getstatecCsdS)zl
        Set the current state of the encoder. state must have been
        returned by getstate().
        Nr;�r:�stater;r;r<�setstate�szIncrementalEncoder.setstateN)rE)F)	rCr>r?rDrNr#rQrRrUr;r;r;r<r�s

rc@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�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().
    rEcCst�||�d|_dS�NrK)rrNrLrMr;r;r<rN�sz#BufferedIncrementalEncoder.__init__cCst�dSr1rF�r:rIrJrPr;r;r<�_buffer_encode�sz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|�||j|�\}}||d�|_|Sr1)rLrYrJ�r:rIrP�data�result�consumedr;r;r<r#�s
z!BufferedIncrementalEncoder.encodecCst�|�d|_dSrW)rrQrLrAr;r;r<rQ�s
z BufferedIncrementalEncoder.resetcCs
|jpdS�Nr�rLrAr;r;r<rR�sz#BufferedIncrementalEncoder.getstatecCs|pd|_dSrWr_rSr;r;r<rU�sz#BufferedIncrementalEncoder.setstateN)rE)F)
rCr>r?rDrNrYr#rQrRrUr;r;r;r<rV�s

rVc@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)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().
    rEcCs
||_dS)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)rJrMr;r;r<rNszIncrementalDecoder.__init__FcCst�dS)z@
        Decode input and returns the resulting object.
        NrFrOr;r;r<r$szIncrementalDecoder.decodecCsdS)z9
        Reset the decoder to the initial state.
        Nr;rAr;r;r<rQszIncrementalDecoder.resetcCsdS)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).
        )�rr;rAr;r;r<rRszIncrementalDecoder.getstatecCsdS)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().
        Nr;rSr;r;r<rU'szIncrementalDecoder.setstateN)rE)F)	rCr>r?rDrNr$rQrRrUr;r;r;r<r�s


rc@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�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.
    rEcCst�||�d|_dS�Nr`)rrNrLrMr;r;r<rN5sz#BufferedIncrementalDecoder.__init__cCst�dSr1rFrXr;r;r<�_buffer_decode:sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|�||j|�\}}||d�|_|Sr1)rLrcrJrZr;r;r<r$?s
z!BufferedIncrementalDecoder.decodecCst�|�d|_dSrb)rrQrLrAr;r;r<rQGs
z BufferedIncrementalDecoder.resetcCs
|jdfSr^r_rAr;r;r<rRKsz#BufferedIncrementalDecoder.getstatecCs|d|_dSr^r_rSr;r;r<rUOsz#BufferedIncrementalDecoder.setstateN)rE)F)
rCr>r?rDrNrcr$rQrRrUr;r;r;r<ra/s

rac@sTeZdZddd�Zdd�Zdd�Zdd	�Zddd�Zefd
d�Z	dd�Z
dd�ZdS)rrEcCs||_||_dS)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)�streamrJ�r:rdrJr;r;r<rN\szStreamWriter.__init__cCs"|�||j�\}}|j�|�dS)z> Writes the object's contents encoded to self.stream.
        N)r#rJrd�write)r:�objectr[r]r;r;r<rfuszStreamWriter.writecCs|�d�|��dS)z[ Writes the concatenated list of strings to the stream
            using .write().
        rKN)rf�join�r:�listr;r;r<�
writelines|szStreamWriter.writelinescCsdS)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.

        Nr;rAr;r;r<rQ�s
zStreamWriter.resetrcCs*|j�||�|dkr&|dkr&|��dSr^�rd�seekrQ�r:�offset�whencer;r;r<rm�szStreamWriter.seekcCs||j|�S�z? Inherit all other methods from the underlying stream.
        �rd�r:r4�getattrr;r;r<�__getattr__�szStreamWriter.__getattr__cCs|Sr1r;rAr;r;r<�	__enter__�szStreamWriter.__enter__cCs|j��dSr1�rd�close�r:�type�value�tbr;r;r<�__exit__�szStreamWriter.__exit__N)rE)r)rCr>r?rNrfrkrQrmrtrurvr}r;r;r;r<rZs

�
rc@s�eZdZeZddd�Zd dd�Zd!dd	�Zd"dd
�Zd#dd�Z	dd�Z
d$dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�Zd
S)%rrEcCs.||_||_d|_|��|_|j|_d|_dS)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)rdrJ�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebufferrer;r;r<rN�s
zStreamReader.__init__cCst�dSr1rFrHr;r;r<r$�szStreamReader.decode���Fc
CsP|jr|j�|j�|_d|_|dkr(|}|dkrBt|j�|krB�q|dkrV|j��}n|j�|�}|j|}|st�qz|�||j	�\}}Wnbt
y�}zJ|r�|�|d|j�|j	�\}}|jdd�}	t|	�dkr؂n�WYd}~n
d}~00||d�|_|j|7_|s(�qq(|dk�r.|j}
|j|_n|jd|�}
|j|d�|_|
S)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�rhr��lenrd�readr~r$rJ�UnicodeDecodeError�start�
splitlines)r:�size�chars�	firstline�newdatar[�newchars�decodedbytes�exc�linesr\r;r;r<r��sD
�

zStreamReader.readNTc	Cs�|jrP|jd}|jd=t|j�dkr8|jd|_d|_|sL|jdd�d}|S|pVd}|j}|j|dd�}|r�t|t�r�|�d	�s�t|t	�r�|�d
�r�||jddd�7}||7}|jdd�}|�r�t|�dk�r8|d}|d=t|�dk�r|d|j7<||_d|_n|d|j|_|�s�|jdd�d}�q�|d}|djdd�d}||k�r�|j�
|dd��|j|_|�r�|}n|}�q�|�r�|du�r�|�r�|�s�|jdd�d}�q�|d
kr^|d9}q^|S)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�r�i@�)r�r�r�r�r�r��
isinstance�str�endswith�bytesrh)	r:r�r��line�readsizer[r��line0withend�line0withoutendr;r;r<�readlinesd
��
�
zStreamReader.readlinecCs|��}|�|�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�r[r;r;r<�	readlines^szStreamReader.readlinescCsd|_|j|_d|_dS)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�rAr;r;r<rQms	zStreamReader.resetrcCs|j�||�|��dS)zp Set the input stream's current position.

            Resets the codec buffers used for keeping state.
        Nrlrnr;r;r<rmzszStreamReader.seekcCs|��}|r|St�dS)�4 Return the next decoded line from the input stream.N)r��
StopIteration)r:r�r;r;r<�__next__�szStreamReader.__next__cCs|Sr1r;rAr;r;r<�__iter__�szStreamReader.__iter__cCs||j|�Srqrrrsr;r;r<ru�szStreamReader.__getattr__cCs|Sr1r;rAr;r;r<rv�szStreamReader.__enter__cCs|j��dSr1rwryr;r;r<r}�szStreamReader.__exit__)rE)rE)r�r�F)NT)NT)r)rCr>r?r�rrNr$r�r�r�rQrmr�r�rtrurvr}r;r;r;r<r�s


P
K

�
rc@s�eZdZdZdZd!dd�Zd"dd�Zd#d
d�Zd$dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d%dd�Zefdd�Zdd�Zdd �Zd	S)&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.

    �unknownrEcCs(||_|||�|_|||�|_||_dS)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)rd�reader�writerrJ)r:rd�Reader�WriterrJr;r;r<rN�s
zStreamReaderWriter.__init__r�cCs|j�|�Sr1)r�r��r:r�r;r;r<r��szStreamReaderWriter.readNcCs|j�|�Sr1)r�r�r�r;r;r<r��szStreamReaderWriter.readlinecCs|j�|�Sr1)r�r�)r:r�r;r;r<r��szStreamReaderWriter.readlinescCs
t|j�S�r�)�nextr�rAr;r;r<r��szStreamReaderWriter.__next__cCs|Sr1r;rAr;r;r<r��szStreamReaderWriter.__iter__cCs|j�|�Sr1)r�rf)r:r[r;r;r<rf�szStreamReaderWriter.writecCs|j�|�Sr1)r�rkrir;r;r<rk�szStreamReaderWriter.writelinescCs|j��|j��dSr1�r�rQr�rAr;r;r<rQ�s
zStreamReaderWriter.resetrcCs6|j�||�|j��|dkr2|dkr2|j��dSr^)rdrmr�rQr�rnr;r;r<rm�s
zStreamReaderWriter.seekcCs||j|�Srqrrrsr;r;r<ru�szStreamReaderWriter.__getattr__cCs|Sr1r;rAr;r;r<rv�szStreamReaderWriter.__enter__cCs|j��dSr1rwryr;r;r<r}�szStreamReaderWriter.__exit__)rE)r�)N)N)r)rCr>r?rD�encodingrNr�r�r�r�r�rfrkrQrmrtrurvr}r;r;r;r<r�s 	




�
	rc@s�eZdZdZdZdZd!dd�Zd"dd�Zd#d
d�Zd$dd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd%dd�Zefdd�Zdd�Zdd �Zd	S)&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�rEcCs4||_||_||_|||�|_|||�|_||_dS)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)rdr#r$r�r�rJ)r:rdr#r$r�r�rJr;r;r<rNszStreamRecoder.__init__r�cCs"|j�|�}|�||j�\}}|Sr1)r�r�r#rJ�r:r�r[�bytesencodedr;r;r<r�#szStreamRecoder.readNcCs6|dur|j��}n|j�|�}|�||j�\}}|Sr1)r�r�r#rJr�r;r;r<r�)s
zStreamRecoder.readlinecCs(|j��}|�||j�\}}|jdd�S)NTr�)r�r�r#rJr�)r:r�r[r�r;r;r<r�2s
zStreamRecoder.readlinescCs t|j�}|�||j�\}}|Sr�)r�r�r#rJ)r:r[r�r;r;r<r�8s
zStreamRecoder.__next__cCs|Sr1r;rAr;r;r<r�?szStreamRecoder.__iter__cCs|�||j�\}}|j�|�Sr1)r$rJr�rf)r:r[�bytesdecodedr;r;r<rfBszStreamRecoder.writecCs(d�|�}|�||j�\}}|j�|�Srb)rhr$rJr�rf)r:rjr[r�r;r;r<rkGs
zStreamRecoder.writelinescCs|j��|j��dSr1r�rAr;r;r<rQMs
zStreamRecoder.resetrcCs |j�||�|j�||�dSr1)r�rmr�rnr;r;r<rmRszStreamRecoder.seekcCs||j|�Srqrrrsr;r;r<ruXszStreamRecoder.__getattr__cCs|Sr1r;rAr;r;r<rv_szStreamRecoder.__enter__cCs|j��dSr1rwryr;r;r<r}bszStreamRecoder.__exit__)rE)r�)N)N)r)rCr>r?rD�
data_encoding�
file_encodingrNr�r�r�r�r�rfrkrQrmrtrurvr}r;r;r;r<r�s$�


	

�
r�rrEr�cCst|durd|vr|d}t�|||�}|dur2|Sz&t|�}t||j|j|�}||_|WS|���Yn0dS)aq 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.

        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.

    N�b)�builtinsrrrr8r7r�rx)�filename�moder�rJ�	buffering�file�info�srwr;r;r<rgs�rcCsF|dur|}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.

    N)rrr#r$r8r7r�r�)r�r�r�rJ�	data_info�	file_info�srr;r;r<r�s
�rcCs
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�r;r;r<r�srcCs
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�r;r;r<r�srcCst|�j}|durt|��|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.

    N)rr5�LookupError)r��encoderr;r;r<r�s	
rcCst|�j}|durt|��|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.

    N)rr6r�)r��decoderr;r;r<r �s	
r cCs
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.

    )rr8r�r;r;r<r!�sr!cCs
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.

    )rr7r�r;r;r<r"�sr"cksLt|�|fi|��}|D]}|�|�}|r|Vq|�dd�}|rH|VdS)z�
    Encoding iterator.

    Encodes the input strings from the iterator using an IncrementalEncoder.

    errors and kwargs are passed through to the IncrementalEncoder
    constructor.
    rKTN)rr#)�iteratorr�rJ�kwargsr�rI�outputr;r;r<r%s	
r%cksLt|�|fi|��}|D]}|�|�}|r|Vq|�dd�}|rH|VdS)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�rJr�r�rIr�r;r;r<r&s	
r&cCsdd�|D�S)z� make_identity_dict(rng) -> dict

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

    cSsi|]
}||�qSr;r;)�.0�ir;r;r<�
<dictcomp>/r`z&make_identity_dict.<locals>.<dictcomp>r;)�rngr;r;r<�make_identity_dict'sr�cCs4i}|��D]"\}}||vr&|||<qd||<q|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�vr;r;r<�make_encoding_map1s


r��ignore�replace�xmlcharrefreplace�backslashreplace�namereplace�__main__zlatin-1zutf-8)r�NrEr�)NrE)rE)rE)<rDr��sys�_codecs�ImportErrorZwhy�SystemError�__all__rr	rrrrr�	byteorderrrrrr
r
rr2rrrgrrVrrarrrrrrrrrr r!r"r%r&r�r�r.r'r(r)r*r+r,r��_falseZ	encodingsrC�stdout�stdinr;r;r;r<�<module>s�	"
B("1+IzWt
0
&