HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/pygments/__pycache__/util.cpython-311.pyc
�

�;f/'����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-2024 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__���@/opt/alt/python311/lib/python3.11/site-packages/pygments/util.pyrrs������M�M�M�Mrrc��eZdZdZdS)�OptionErrorz�
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    Nrrrr
rr"s���������rrFc��|�||��}|r|���}||vrItd�|d�tt|���������|S)z}
    If the key `optname` from the dictionary is not in the sequence
    `allowed`, raise an error, otherwise return it.
    z%Value for option {} must be one of {}z, )�get�lowerr�format�join�map�str)�options�optname�allowed�default�normcase�strings      r
�get_choice_optr(sw��
�[�[��'�
*�
*�F�� �������
�W����A�H�H��RV�R[�R[�\_�`c�el�\m�\m�Rn�Rn�o�o�p�p�p��Mrc��|�||��}t|t��r|St|t��rt|��St|t��std|�d|�d����|���dvrdS|���dvrdStd|�d|�d����)	a@
    Intuitively, this is `options.get(optname, default)`, but restricted to
    Boolean value. The Booleans can be represented as string, in order to accept
    Boolean value from the command line arguments. If the key `optname` is
    present in the dictionary `options` and is not associated with a Boolean,
    raise an `OptionError`. If it is absent, `default` is returned instead.

    The valid string values for ``True`` are ``1``, ``yes``, ``true`` and
    ``on``, the ones for ``False`` are ``0``, ``no``, ``false`` and ``off``
    (matched case-insensitively).
    �
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.5s����[�[��'�
*�
*�F��&�$���
=��
�	�F�C�	 �	 �=��F�|�|��
���
$�
$�	=��<�&�<�<��<�<�<�=�=�	=�	�����5�	5�	5��t�	�����6�	6�	6��u��<�6�<�<��<�<�<�=�=�	=rc���|�||��}	t|��S#t$rtd|�d|�d����t$rtd|�d|�d����wxYw)z?As :func:`get_bool_opt`, but interpret the value as an integer.rr z ; you must give an integer valuer))rr,�	TypeErrorr�
ValueErrorr-s    r
�get_int_optr2Rs���
�[�[��'�
*�
*�F�8��6�{�{����8�8�8��7�&�7�7��7�7�7�8�8�	8��8�8�8��7�6�7�7��7�7�7�8�8�	8�8���s
�'�AA'c��|�||��}t|t��r|���St|tt
f��rt	|��St
d|�d|�d����)z�
    If the key `optname` from the dictionary `options` is a string,
    split it at whitespace and return it. If it is already a list
    or a tuple, it is returned as a list.
    rr z; you must give a list value)rr*r�split�list�tupler)rrr�vals    r
�get_list_optr8^s����+�+�g�w�
'�
'�C��#�s���4��y�y�{�{��	�C�$���	'�	'�4��C�y�y���3�#�3�3�W�3�3�3�4�4�	4rc�@�|jsdSg}|j������D]A}|���r+|�d|���z���Ad�|�����S)N�� )r
�strip�
splitlines�appendr�lstrip)�obj�res�lines   r
�docstring_headlinerCns����;���r�
�C���!�!�#�#�.�.�0�0�����:�:�<�<�	��J�J�s�T�Z�Z�\�\�)�*�*�*�*��
�7�7�3�<�<��� � � rc�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�floatr1r0)�text�rv�fs  �r
�text_analysez%make_analysator.<locals>.text_analyse|s����	���4���B�B���	�	�	��3�3�	�����	��3�	��s�C��U�2�Y�Y�/�/�0�0�0���I�&�	�	�	��3�3�	���s��
��*A�A%�$A%)r
�staticmethod)rLrMs` r
�make_analysatorrOzs6���
�
�
�
�
��9�L����%�%�%rc���|�d��}|dkr|d|����}n|���}|�d��r�	d�t�|dd������D��d}n#t$rYdSwxYwtjd	|�d
�tj	��}|�
|���dSdS)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����F�^z(\.(exe|cmd|bat|bin))?$T)�findrrT�
split_path_rer4r<�
IndexError�re�compile�
IGNORECASE�search)rJ�regex�index�
first_line�founds     r
�shebang_matchesrf�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�	�����
�>��>�>�>��
�N�N���<�<����*��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_rera�groupr^r_�I�matchr<)rJrb�m�doctypes    r
�doctype_matchesro�s_��	� � ��&�&�A��y��u��g�g�a�j�j�G�
�:�e�R�T�"�"�(�(������9�9��E�Erc�"�t|d��S)z3Check if the file looks like it has a html doctype.�html)ro)rJs r
�html_doctype_matchesrr�s���4��)�)�)rc�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_rerl�hash�_looks_like_xml_cache�KeyErrorrira�tag_re)rJ�keyrmrKs    r
�looks_like_xmlrz�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�7rc��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.r;�rhz = (�,�"N���rY�)rQ)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���rrc��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�
�
�
����������Jrc��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.gets��!�!rN)rrr	r
rrrr
r�r�	s-��������
"�"�"�"�"rr�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)rJr��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�)rJ�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�9s9���t�Z��&�&���}���M�M�M��&�&�(�(�(rc��eZdZd�ZdS)�UnclosingTextIOWrapperc�.�|���dSr�)�flushr�s r
�closezUnclosingTextIOWrapper.closeCs���
�
�����rN)rrr	r�rrr
r�r�As#����������rr�)NFr�)Fr)r)%r
r^�iorr_r\�DOTALL�	MULTILINE�VERBOSErir`rxrkrtr1rrFrrr.r2r8rCrOrfrorrrvrzr~r�r�r�r�r�r�r�rrr
�<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������)����
�
�
�
�=�=�=�=�:
8�
8�
8�
8�
4�
4�
4�
4� 	!�	!�	!�&�&�&�"*�*�*�Z
F�
F�
F�*�*�*�
��
�
�
� 8�8�8�����&
�
�
�
� "�"�"�"�"�"�"�"�"�"�"�*���")�)�)������]�����r