§
    ¡”jS)  ã                   ó"  — d Z ddlmZ ddlZddlmZ dZddd	d
dœZi Zd„ Z	d„ Z
d„ Z G d„ de¦  «        Z e
d¦  «        Z e
d¦  «        Z e
d¦  «        Zd!d„Zd„ Zedfd„Zd!d„Zd„ Zedfd„Zd„ Z G d„ de¦  «        Z G d„ d e¦  «        ZdS )"a  

    webencodings
    ~~~~~~~~~~~~

    This is a Python implementation of the `WHATWG Encoding standard
    <http://encoding.spec.whatwg.org/>`. See README for details.

    :copyright: Copyright 2012 by Simon Sapin
    :license: BSD, see LICENSE for details.

é    )Úunicode_literalsNé   )ÚLABELSz0.5.1z
iso-8859-8zmac-cyrillicz	mac-romanÚcp874)ziso-8859-8-izx-mac-cyrillicÚ	macintoshzwindows-874c                 óv   — |                       d¦  «                             ¦   «                              d¦  «        S )a9  Transform (only) ASCII letters to lower case: A-Z is mapped to a-z.

    :param string: An Unicode string.
    :returns: A new Unicode string.

    This is used for `ASCII case-insensitive
    <http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_
    matching of encoding labels.
    The same matching is also used, among other things,
    for `CSS keywords <http://dev.w3.org/csswg/css-values/#keywords>`_.

    This is different from the :meth:`~py:str.lower` method of Unicode strings
    which also affect non-ASCII characters,
    sometimes mapping them into the ASCII range:

        >>> keyword = u'Bac\N{KELVIN SIGN}ground'
        >>> assert keyword.lower() == u'background'
        >>> assert ascii_lower(keyword) != keyword.lower()
        >>> assert ascii_lower(keyword) == u'bac\N{KELVIN SIGN}ground'

    Úutf8)ÚencodeÚlowerÚdecode)Ústrings    úd/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/webencodings/__init__.pyÚascii_lowerr   #   s0   € ð. �=Š=˜Ñ Ô ×&Ò&Ñ(Ô(×/Ò/°Ñ7Ô7Ð7ó    c                 ó^  — t          |                      d¦  «        ¦  «        } t          j        | ¦  «        }|€dS t                               |¦  «        }|€V|dk    rddlm} n/t                               ||¦  «        }t          j	        |¦  «        }t          ||¦  «        }|t          |<   |S )u<  
    Look for an encoding by its label.
    This is the specâ€™s `get an encoding
    <http://encoding.spec.whatwg.org/#concept-encoding-get>`_ algorithm.
    Supported labels are listed there.

    :param label: A string.
    :returns:
        An :class:`Encoding` object, or :obj:`None` for an unknown label.

    z	
 Nzx-user-definedr   )Ú
codec_info)r   Ústripr   ÚgetÚCACHEÚx_user_definedr   ÚPYTHON_NAMESÚcodecsÚlookupÚEncoding)ÚlabelÚnameÚencodingr   Úpython_names        r   r   r   =   s­   € õ ˜Ÿš KÑ0Ô0Ñ1Ô1€EÝŒ:�eÑÔ€DØ€|ØˆtÝ�yŠy˜‰Œ€HØÐØÐ#Ò#Ð#Ø2Ð2Ð2Ð2Ð2Ð2Ð2å&×*Ò*¨4°Ñ6Ô6ˆKåœ {Ñ3Ô3ˆJÝ˜D *Ñ-Ô-ˆØ�ˆd‰Ø€Or   c                 óp   — t          | d¦  «        r| S t          | ¦  «        }|€t          d| z  ¦  «        ‚|S )zç
    Accept either an encoding object or label.

    :param encoding: An :class:`Encoding` object or a label string.
    :returns: An :class:`Encoding` object.
    :raises: :exc:`~exceptions.LookupError` for an unknown label.

    r   NzUnknown encoding label: %r)Úhasattrr   ÚLookupError)Úencoding_or_labelr   s     r   Ú_get_encodingr#   [   sK   € õ Ð  ,Ñ/Ô/ð !Ø Ð åÐ'Ñ(Ô(€HØÐÝÐ6Ð9JÑJÑKÔKÐKØ€Or   c                   ó   — e Zd ZdZd„ Zd„ ZdS )r   aO  Reresents a character encoding such as UTF-8,
    that can be used for decoding or encoding.

    .. attribute:: name

        Canonical name of the encoding

    .. attribute:: codec_info

        The actual implementation of the encoding,
        a stdlib :class:`~codecs.CodecInfo` object.
        See :func:`codecs.register`.

    c                 ó"   — || _         || _        d S ©N)r   r   )Úselfr   r   s      r   Ú__init__zEncoding.__init__|   s   € ØˆŒ	Ø$ˆŒˆˆr   c                 ó   — d| j         z  S )Nz<Encoding %s>)r   )r'   s    r   Ú__repr__zEncoding.__repr__€   s   € Ø ¤Ñ*Ð*r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   r*   © r   r   r   r   m   s<   € € € € € ðð ð%ð %ð %ð+ð +ð +ð +ð +r   r   zutf-8zutf-16lezutf-16beÚreplacec                 ó’   — t          |¦  «        }t          | ¦  «        \  }} |p|}|j                             | |¦  «        d         |fS )aÖ  
    Decode a single string.

    :param input: A byte string
    :param fallback_encoding:
        An :class:`Encoding` object or a label string.
        The encoding to use if :obj:`input` does note have a BOM.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
    :return:
        A ``(output, encoding)`` tuple of an Unicode string
        and an :obj:`Encoding`.

    r   )r#   Ú_detect_bomr   r   )ÚinputÚfallback_encodingÚerrorsÚbom_encodingr   s        r   r   r   ‹   sS   € õ  &Ð&7Ñ8Ô8ÐÝ% eÑ,Ô,Ñ€L�%ØÐ0Ð0€HØÔ×%Ò% e¨VÑ4Ô4°QÔ7¸ÐAÐAr   c                 óî   — |                       d¦  «        rt          | dd…         fS |                       d¦  «        rt          | dd…         fS |                       d¦  «        rt          | dd…         fS d| fS )zBReturn (bom_encoding, input), with any BOM removed from the input.s   ÿþé   Ns   þÿs   ï»¿é   )Ú
startswithÚ_UTF16LEÚ_UTF16BEÚUTF8)r3   s    r   r2   r2   ¡   s†   € à×Ò˜Ñ$Ô$ð #Ý˜˜q˜r˜rœÐ"Ð"Ø×Ò˜Ñ$Ô$ð #Ý˜˜q˜r˜rœÐ"Ð"Ø×Ò˜Ñ(Ô(ð Ý�U˜1˜2˜2”YˆÐØ�ˆ;Ðr   Ústrictc                 ó^   — t          |¦  «        j                             | |¦  «        d         S )a;  
    Encode a single string.

    :param input: An Unicode string.
    :param encoding: An :class:`Encoding` object or a label string.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
    :return: A byte string.

    r   )r#   r   r
   )r3   r   r5   s      r   r
   r
   ¬   s*   € õ ˜Ñ"Ô"Ô-×4Ò4°U¸FÑCÔCÀAÔFÐFr   c                 óh   — t          ||¦  «        }t          | |¦  «        }t          |¦  «        }||fS )aâ  
    "Pull"-based decoder.

    :param input:
        An iterable of byte strings.

        The input is first consumed just enough to determine the encoding
        based on the precense of a BOM,
        then consumed on demand when the return value is.
    :param fallback_encoding:
        An :class:`Encoding` object or a label string.
        The encoding to use if :obj:`input` does note have a BOM.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
    :returns:
        An ``(output, encoding)`` tuple.
        :obj:`output` is an iterable of Unicode strings,
        :obj:`encoding` is the :obj:`Encoding` that is being used.

    )ÚIncrementalDecoderÚ_iter_decode_generatorÚnext)r3   r4   r5   ÚdecoderÚ	generatorr   s         r   Úiter_decoderF   º   s9   € õ, !Ð!2°FÑ;Ô;€GÝ& u¨gÑ6Ô6€IÝ�I‰Œ€HØ�hÐÐr   c              #   ó.  K  — |j         }t          | ¦  «        } | D ]'} ||¦  «        }|r|j        €J ‚|j        V — |V —  n(Œ( |dd¬¦  «        }|j        €J ‚|j        V — |r|V — dS | D ]} ||¦  «        }|r|V — Œ |dd¬¦  «        }|r|V — dS dS )zqReturn a generator that first yields the :obj:`Encoding`,
    then yields output chukns as Unicode strings.

    Nr   T©Úfinal)r   Úiterr   )r3   rD   r   ÚchunckÚoutputs        r   rB   rB   Ö   s  è è € ð
 Œ^€FÝ�‰KŒK€EØð ð ˆØ�˜‘”ˆØð 	ØÔ#Ð/Ð/Ð/ØÔ"Ð"Ð"Ð"ØˆLˆLˆLØˆEð		ð �˜ 4Ð(Ñ(Ô(ˆØÔÐ+Ð+Ð+ØÔÐÐÐØð 	ØˆLˆLˆLØˆàð ð ˆØ�˜‘”ˆØð 	ØˆLˆLˆLøØˆV�C˜tÐ$Ñ$Ô$€FØð Øˆˆˆˆˆðð r   c                 óL   — t          ||¦  «        j        }t          | |¦  «        S )uY  
    â€œPullâ€�-based encoder.

    :param input: An iterable of Unicode strings.
    :param encoding: An :class:`Encoding` object or a label string.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
    :returns: An iterable of byte strings.

    )ÚIncrementalEncoderr
   Ú_iter_encode_generator)r3   r   r5   r
   s       r   Úiter_encoderP   ö   s&   € õ   ¨&Ñ1Ô1Ô8€FÝ! %¨Ñ0Ô0Ð0r   c              #   ó`   K  — | D ]} ||¦  «        }|r|V — Œ |dd¬¦  «        }|r|V — d S d S )NÚ TrH   r/   )r3   r
   rK   rL   s       r   rO   rO     sg   è è € Øð ð ˆØ�˜‘”ˆØð 	ØˆLˆLˆLøØˆV�B˜dÐ#Ñ#Ô#€FØð Øˆˆˆˆˆðð r   c                   ó"   — e Zd ZdZdd„Zdd„ZdS )	rA   uO  
    â€œPushâ€�-based decoder.

    :param fallback_encoding:
        An :class:`Encoding` object or a label string.
        The encoding to use if :obj:`input` does note have a BOM.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.

    r0   c                 óf   — t          |¦  «        | _        || _        d| _        d | _        d | _        d S )Nr   )r#   Ú_fallback_encodingÚ_errorsÚ_bufferÚ_decoderr   )r'   r4   r5   s      r   r(   zIncrementalDecoder.__init__  s5   € å"/Ð0AÑ"BÔ"BˆÔØˆŒØˆŒØˆŒð
 ˆŒˆˆr   Fc                 ó.  — | j         }|� |||¦  «        S | j        |z   }t          |¦  «        \  }}|€%t          |¦  «        dk     r|s	|| _        dS | j        }|j                             | j        ¦  «        j        }|| _         || _	         |||¦  «        S )zùDecode one chunk of the input.

        :param input: A byte string.
        :param final:
            Indicate that no more input is available.
            Must be :obj:`True` if this is the last call.
        :returns: An Unicode string.

        Nr9   rR   )
rX   rW   r2   ÚlenrU   r   ÚincrementaldecoderrV   r   r   )r'   r3   rI   rD   r   s        r   r   zIncrementalDecoder.decode'  s¨   € ð ”-ˆØÐØ�7˜5 %Ñ(Ô(Ð(à”˜uÑ$ˆÝ% eÑ,Ô,‰ˆ�%ØÐÝ�5‰zŒz˜AŠ~ˆ~ eˆ~Ø$�”Ø�ràÔ2�ØÔ%×8Ò8¸¼ÑFÔFÔMˆØˆŒØ ˆŒØˆw�u˜eÑ$Ô$Ð$r   N©r0   )F)r+   r,   r-   r.   r(   r   r/   r   r   rA   rA     sF   € € € € € ð	ð 	ð
ð 
ð 
ð 
ð%ð %ð %ð %ð %ð %r   rA   c                   ó   — e Zd ZdZedfd„ZdS )rN   uù  
    â€œPushâ€�-based encoder.

    :param encoding: An :class:`Encoding` object or a label string.
    :param errors: Type of error handling. See :func:`codecs.register`.
    :raises: :exc:`~exceptions.LookupError` for an unknown encoding label.

    .. method:: encode(input, final=False)

        :param input: An Unicode string.
        :param final:
            Indicate that no more input is available.
            Must be :obj:`True` if this is the last call.
        :returns: A byte string.

    r>   c                 ól   — t          |¦  «        }|j                             |¦  «        j        | _        d S r&   )r#   r   Úincrementalencoderr
   )r'   r   r5   s      r   r(   zIncrementalEncoder.__init__T  s.   € Ý  Ñ*Ô*ˆØÔ)×<Ò<¸VÑDÔDÔKˆŒˆˆr   N)r+   r,   r-   r.   r=   r(   r/   r   r   rN   rN   C  s?   € € € € € ðð ð  !%¨Xð Lð Lð Lð Lð Lð Lr   rN   r\   )r.   Ú
__future__r   r   Úlabelsr   ÚVERSIONr   r   r   r   r#   Úobjectr   r=   r;   r<   r   r2   r
   rF   rB   rP   rO   rA   rN   r/   r   r   ú<module>rd      sç  ððð ð (Ð 'Ð 'Ð 'Ð 'Ð 'à €€€à Ð Ð Ð Ð Ð ð €ð
 !Ø$ØØð	ð €ð 	€ð8ð 8ð 8ð4ð ð ð<ð ð ð$+ð +ð +ð +ð +ˆvñ +ô +ð +ð0 €vˆg�„€àˆ6�*ÑÔ€Øˆ6�*ÑÔ€ðBð Bð Bð Bð,ð ð ð  ¨ð Gð Gð Gð Gðð ð ð ð8ð ð ð@ !%¨Xð 1ð 1ð 1ð 1ð ð ð ð0%ð 0%ð 0%ð 0%ð 0%˜ñ 0%ô 0%ð 0%ðfLð Lð Lð Lð L˜ñ Lô Lð Lð Lð Lr   