HEX
Server: Apache/2.4.67 (Debian)
System: Linux vps-b2547eb4 6.1.0-41-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pygments/__pycache__/util.cpython-311.pyc
�

�E�c�#����dZddlZddlmZejd��Zejdejejzejz��Z	ejdej
ejzejz��Zejdej��Z
Gd�d	e��ZGd
�de��Zd"d
�Zd#d�Zd#d�Zd#d�Zd�Zd�Zd�Zd�Zd�ZiZd�Zd�Zd$d�Zd%d�ZGd�d��Z d�Z!d�Z"d�Z#Gd �d!e��Z$dS)&z�
    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
TextIOWrapperz[/\\ ]z�
    <!DOCTYPE\s+(
     [a-zA-Z_][a-zA-Z0-9]*
     (?: \s+      # optional in HTML5
     [a-zA-Z_][a-zA-Z0-9]*\s+
     "[^"]*")?
     )
     [^>]*>
z<(.+?)(\s.*?)?>.*?</.+?>z\s*<\?xml[^>]*\?>c��eZdZdZdS)�
ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N)�__name__�
__module__�__qualname__�__doc__���//usr/lib/python3/dist-packages/pygments/util.pyrrs������M�M�M�Mrrc��eZdZdS)�OptionErrorN)rrrr
rrrr"s�������DrrFc���|�||��}|r|���}||vr;td|�dd�t	t
|���������|S)NzValue for option z must be one of z, )�get�lowerr�join�map�str)�options�optname�allowed�default�normcase�strings      r�get_choice_optr&sy��
�[�[��'�
*�
*�F�� �������
�W����k�"�7�7�D�I�I�c�#�w�.?�.?�$@�$@�$@�B�C�C�	C��Mrc��|�||��}t|t��r|St|t��rt|��St|t��std|�d|�d����|���dvrdS|���dvrdStd|�d|�d����)	N�
Invalid type � for option z%; use 1/0, yes/no, true/false, on/off)�1�yes�true�onT)�0�no�false�offF�Invalid value )r�
isinstance�bool�intrrr�rrrrs    r�get_bool_optr,0s���
�[�[��'�
*�
*�F��&�$���0��
�	�F�C�	 �	 �
0��F�|�|��
���
$�
$�0��k�$�f�f�g�g�g�/�0�0�	0�
�����5�	5�	5��t�	�����6�	6�	6��u��k�$�f�f�g�g�g�/�0�0�	0rc���|�||��}	t|��S#t$rtd|�d|�d����t$rtd|�d|�d����wxYw)Nrrz ; you must give an integer valuer')rr*�	TypeErrorr�
ValueErrorr+s    r�get_int_optr0Ds���
�[�[��'�
*�
*�F�	0��6�{�{����0�0�0��k�$�f�f�g�g�g�/�0�0�	0��0�0�0��k�$�f�f�g�g�g�/�0�0�	0�0���s
�'�AA'c��|�||��}t|t��r|���St|tt
f��rt	|��St
d|�d|�d����)Nrrz; you must give a list value)rr(r�split�list�tupler)rrr�vals    r�get_list_optr6Rs}��
�+�+�g�w�
'�
'�C��#�s���-��y�y�{�{��	�C�$���	'�	'�-��C�y�y���k�!�c�c�7�7�7�,�-�-�	-rc�@�|jsdSg}|j������D]A}|���r+|�d|���z���Ad�|�����S)N�� )r	�strip�
splitlines�appendr�lstrip)�obj�res�lines   r�docstring_headlinerA^s����;���r�
�C���!�!�#�#�.�.�0�0�����:�:�<�<�	��J�J�s�T�Z�Z�\�\�)�*�*�*�*��
�7�7�3�<�<��� � � rc�D���fd�}�j|_t|��S)zAReturn a static text analyser function that returns float values.c	����	�|��}n#t$rYdSwxYw|sdS	tdtdt|������S#tt
f$rYdSwxYw)Ngg�?)�	Exception�min�max�floatr/r.)�text�rv�fs  �r�text_analysez%make_analysator.<locals>.text_analysels����	���4���B�B���	�	�	��3�3�	�����	��3�	��s�C��U�2�Y�Y�/�/�0�0�0���I�&�	�	�	��3�3�	���s��
��*A�A%�$A%)r	�staticmethod)rJrKs` r�make_analysatorrMjs6���
�
�
�
�
��9�L����%�%�%rc���|�d��}|dkr|d|����}n|���}|�d��r�	d�t�|dd������D��d}n#t$rYdSwxYwtjd	|ztj	��}|�
|���d
SdS)a�Check if the given regular expression matches the last part of the
    shebang if one exists.

        >>> from pygments.util import shebang_matches
        >>> shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?')
        True
        >>> shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?')
        True
        >>> shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?')
        False
        >>> shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?')
        False
        >>> shebang_matches('#!/usr/bin/startsomethingwith python',
        ...                 r'python(2\.\d)?')
        True

    It also checks for common windows executable file extensions::

        >>> shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?')
        True

    Parameters (``'-f'`` or ``'--foo'`` are ignored so ``'perl'`` does
    the same as ``'perl -e'``)

    Note that this method automatically searches the whole string (eg:
    the regular expression is wrapped in ``'^$'``)
    �
rNz#!c�@�g|]}|�|�d���|��S)�-)�
startswith)�.0�xs  r�
<listcomp>z#shebang_matches.<locals>.<listcomp>�s@��5�5�5�1��5�"#�,�,�s�"3�"3�5�Q�5�5�5r����Fz^%s(\.(exe|cmd|bat|bin))?$T)�findrrR�
split_path_rer2r:�
IndexError�re�compile�
IGNORECASE�search)rH�regex�index�
first_line�founds     r�shebang_matchesrc{s���8
�I�I�d�O�O�E���z�z��&�5�&�\�'�'�)�)�
�
��Z�Z�\�\�
����T�"�"��	�5�5�
� 3� 3�J�q�r�r�N�4H�4H�4J�4J� K� K�5�5�5�57�9�E�E���	�	�	��5�5�	�����
�8�5�@�"�-�P�P���<�<����*��4��5s�#AB(�(
B6�5B6c���t�|��}|�dS|�d��}tj|tj���|�����duS)z�Check if the doctype matches a regular expression (if present).

    Note that this method only checks the first part of a DOCTYPE.
    eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
    NF�)�doctype_lookup_rer^�groupr[r\�I�matchr:)rHr_�m�doctypes    r�doctype_matchesrl�s_��	� � ��&�&�A��y��u��g�g�a�j�j�G�
�:�e�R�T�"�"�(�(������9�9��E�Erc�"�t|d��S)z3Check if the file looks like it has a html doctype.�html)rl)rHs r�html_doctype_matchesro�s���4��)�)�)rc�2�t�|��rdSt|��}	t|S#t$rRt
�|��}|�YdSt�|dd���du}|t|<|cYSwxYw)z2Check if a doctype exists or if we have some tags.TNi�)�xml_decl_reri�hash�_looks_like_xml_cache�KeyErrorrfr^�tag_re)rH�keyrjrIs    r�looks_like_xmlrw�s�����������t�
�t�*�*�C��$�S�)�)�������$�$�T�*�*���=��4�4�
�]�]�4����;�
'�
'�t�
3��%'��c�"��	�	�	�
���s�:�&B�#0B�Bc�"�d|dz	zd|dzzfS)zoGiven a unicode character code with length greater than 16 bits,
    return the two 16 bit surrogate pair.
    i���
i�i�r
)�cs r�
surrogatepairr{�s!��
�a�2�g���1�u�9�!5�7�7rc��g}d|zdz}d|dzzdz}|�||zdz��|r!|D]}|�||zdz���nC|D]@}t|dz��}|�||dd�z|d	zdz���A|�|d
z��d�|��S)z)Formats a sequence of strings for output.r9�rez = (�,�"N���rW�)rO)r<�reprr)	�var_name�seq�raw�indent_level�lines�base_indent�inner_indent�i�rs	         r�format_linesr��s����E���$�q�(�K��,��*�+�a�/�L�	�L�L��x�'�&�0�1�1�1�
�>��	1�	1�A��L�L���)�C�/�0�0�0�0�	1��	>�	>�A��Q��W�
�
�A��L�L���#�2�#��.��2��6��<�=�=�=�=�	�L�L��s�"�#�#�#��9�9�U���rr
c��g}t��}|D]5}||vs||vr�|�|��|�|���6|S)za
    Returns a list with duplicates removed from the iterable `it`.

    Order is preserved.
    )�setr<�add)�it�already_seen�lst�seenr�s     r�duplicates_removedr��s\��
�C��5�5�D�
������9�9��\�)�)���
�
�1�
�
�
����������Jrc��eZdZdZd�ZdS)�Futurez�Generic class to defer some work.

    Handled specially in RegexLexerMeta, to support regex string construction at
    first use.
    c��t��N)�NotImplementedError��selfs rrz
Future.get�s��!�!rN)rrrr	rr
rrr�r��s-��������
"�"�"�"�"rr�c��	|�d��}|dfS#t$rf	ddl}|���}|���}||fcYS#ttf$r|�d��}|dfcYcYSwxYwwxYw)z�Decode *text* with guessed encoding.

    First try UTF-8; this should fail for non-UTF-8 encodings.
    Then try the preferred locale encoding.
    Fall back to latin-1, which always works.
    zutf-8rN�latin1)�decode�UnicodeDecodeError�locale�getpreferredencoding�LookupError)rHr��prefencodings   r�guess_decoder�s���"��{�{�7�#�#���W�}����"�"�"�	"��M�M�M�!�6�6�8�8�L��;�;�=�=�D���%�%�%�%��"�K�0�	"�	"�	"��;�;�x�(�(�D���>�!�!�!�!�!�	"����
"���s,��
B�/A�B�*B�B�B�Bc��t|dd��r4	|�|j��}||jfS#t$rYnwxYwt	|��S)z�Decode *text* coming from terminal *term*.

    First try the terminal encoding, if given.
    Then try UTF-8.  Then try the preferred locale encoding.
    Fall back to latin-1, which always works.
    �encodingN)�getattrr�r�r�r�)rH�terms  r�guess_decode_from_terminalr�sq���t�Z��&�&�'�	'��;�;�t�}�-�-�D����&�&��"�	�	�	��D�	��������s�6�
A�Ac�b�t|dd��r|jSddl}|���S)z7Return our best guess of encoding for the given *term*.r�Nr)r�r�r�r�)r�r�s  r�terminal_encodingr�)s9���t�Z��&�&���}���M�M�M��&�&�(�(�(rc��eZdZd�ZdS)�UnclosingTextIOWrapperc�.�|���dSr�)�flushr�s r�closezUnclosingTextIOWrapper.close3s���
�
�����rN)rrrr�r
rrr�r�1s#����������rr�)NFr�)Fr)r
)%r	r[�iorr\rY�DOTALL�	MULTILINE�VERBOSErfr]rurhrqr/rrDrrr,r0r6rArMrcrlrorsrwr{r�r�r�r�r�r�r�r
rr�<module>r�s�����
�	�	�	���������
�9�%�%�
��B�J� ��Y�����
�*�,�,��
���/��M�B�I�-���<�
>�
>���b�j�-�r�t�4�4��N�N�N�N�N�J�N�N�N�	�	�	�	�	�)�	�	�	�����0�0�0�0�(0�0�0�0�	-�	-�	-�	-�	!�	!�	!�&�&�&�"*�*�*�Z
F�
F�
F�*�*�*�
��
�
�
� 8�8�8�����&
�
�
�
� "�"�"�"�"�"�"�"�"�"�"�*���")�)�)������]�����r