� ��^iS)��"�dZddlmZddlZddlmZdZddd d d �ZiZd �Z d �Z d�Z Gd�de ��Z e d��Ze d��Ze d��Zd!d�Zd�Zedfd�Zd!d�Zd�Zedfd�Zd�ZGd�de ��ZGd�d e ��ZdS)"a webencodings ~~~~~~~~~~~~ This is a Python implementation of the `WHATWG Encoding standard `. See README for details. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. �)�unicode_literalsN�)�LABELSz0.5.1z iso-8859-8z mac-cyrillicz mac-roman�cp874)z iso-8859-8-izx-mac-cyrillic� macintoshz windows-874c�v�|�d������d��S)a9Transform (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 `_ matching of encoding labels. The same matching is also used, among other things, for `CSS 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 ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/webencodings/__init__.py� ascii_lowerr#s0��. �=�=�� � � &� &� (� (� /� /�� 7� 7�7�c�^�t|�d����}tj|��}|�dSt�|��}|�V|dkrddlm}n/t�||��}tj |��}t||��}|t|<|S)u< Look for an encoding by its label. This is the spec’s `get an encoding `_ algorithm. Supported labels are listed there. :param label: A string. :returns: An :class:`Encoding` object, or :obj:`None` for an unknown label. z Nzx-user-definedr)� codec_info) r�stripr�get�CACHE�x_user_definedr� PYTHON_NAMES�codecs�lookup�Encoding)�label�name�encodingr� python_names rrr=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� � �Orc�p�t|d��r|St|��}|�td|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. rNzUnknown encoding label: %r)�hasattrr� LookupError)�encoding_or_labelrs r� _get_encodingr#[sK��� �,�/�/�!� � ��'�(�(�H����6�9J�J�K�K�K� �Orc��eZdZdZd�Zd�ZdS)raOReresents 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�"�||_||_dS�N)rr)�selfrrs r�__init__zEncoding.__init__|s���� �$����rc��d|jzS)Nz )r)r's r�__repr__zEncoding.__repr__�s�����*�*rN)�__name__� __module__� __qualname__�__doc__r(r*�rrrrms<������ � �%�%�%�+�+�+�+�+rrzutf-8zutf-16lezutf-16be�replacec��t|��}t|��\}}|p|}|j�||��d|fS)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_bomrr )�input�fallback_encoding�errors� bom_encodingrs rr r �sS�� &�&7�8�8��%�e�,�,��L�%��0�0�H� � � %� %�e�V� 4� 4�Q� 7�� A�Arc���|�d��rt|dd�fS|�d��rt|dd�fS|�d��rt|dd�fSd|fS)zBReturn (bom_encoding, input), with any BOM removed from the input.s���Ns��s�)� startswith�_UTF16LE�_UTF16BE�UTF8)r3s rr2r2�s��� ��� �$�$�#���q�r�r��"�"� ��� �$�$�#���q�r�r��"�"� ����(�(���U�1�2�2�Y��� ��;�r�strictc�^�t|��j�||��dS)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#rr )r3rr5s rr r �s*�� �� "� "� -� 4� 4�U�F� C� C�A� F�Frc�h�t||��}t||��}t|��}||fS)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)r3r4r5�decoder� generatorrs r� iter_decoderF�s9��,!�!2�F�;�;�G�&�u�g�6�6�I��I���H� �h� �rc#�.K�|j}t|��}|D]'}||��}|r|j�J�|jV�|V�n(�(|dd���}|j�J�|jV�|r|V�dS|D]}||��}|r|V��|dd���}|r|V�dSdS)zqReturn a generator that first yields the :obj:`Encoding`, then yields output chukns as Unicode strings. NrT��final)r �iterr)r3rDr �chunck�outputs rrBrB�s���� �^�F� ��K�K�E����������� � ��#�/�/�/��"� "� "� "��L�L�L� �E�  ����4�(�(�(����+�+�+������ � ��L�L�L������������� � ��L�L�L�� �V�C�t� $� $� $�F� ��� � � � � ��rc�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)r3rr5r s r� iter_encoderP�s&�� ��&� 1� 1� 8�F� !�%�� 0� 0�0rc#�`K�|D]}||��}|r|V��|dd���}|r|V�dSdS)N�TrHr/)r3r rKrLs rrOrOsg�������������� � ��L�L�L�� �V�B�d� #� #� #�F� ��� � � � � ��rc�"�eZdZdZdd�Zdd�ZdS) rAuO “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. r0c�f�t|��|_||_d|_d|_d|_dS)Nr)r#�_fallback_encoding�_errors�_buffer�_decoderr)r'r4r5s rr(zIncrementalDecoder.__init__s5��"/�0A�"B�"B����� ��� ��� � �� � � rFc�.�|j}|� |||��S|j|z}t|��\}}|�%t|��dkr |s ||_dS|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. Nr9rR) rXrWr2�lenrUr�incrementaldecoderrVr r)r'r3rIrDrs rr zIncrementalDecoder.decode's����-�� � ��7�5�%�(�(� (�� �u�$��%�e�,�,���%� � ��5�z�z�A�~�~�e�~�$�� ��r��2���%�8�8���F�F�M���� � �� ��w�u�e�$�$�$rN�r0)F)r+r,r-r.r(r r/rrrArAsF������ � � � � � �%�%�%�%�%�%rrAc��eZdZdZedfd�ZdS)rNu� “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|_dSr&)r#r�incrementalencoderr )r'rr5s rr(zIncrementalEncoder.__init__Ts.�� ��*�*���)�<�<�V�D�D�K�� � � rN)r+r,r-r.r=r(r/rrrNrNCs?�������� !%�X�L�L�L�L�L�LrrNr\)r.� __future__rr�labelsr�VERSIONrrrrr#�objectrr=r;r<r r2r rFrBrPrOrArNr/rr�rds��� � �(�'�'�'�'�'� � � � ������� �� !�$��� �� � ��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%�fL�L�L�L�L��L�L�L�L�Lr