HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/pygments/__pycache__/util.cpython-310.pyc
o

��h/'�@s6dZddlZddlmZe�d�Ze�dejejBejB�Z	e�dej
ejBejB�Ze�dej�Z
Gdd	�d	e�ZGd
d�de�Zd2d
d�Zd3dd�Zd3dd�Zd3dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZiZdd �Zd!d"�Zd4d#d$�Zd5d&d'�ZGd(d)�d)�Z d*d+�Z!d,d-�Z"d.d/�Z#Gd0d1�d1e�Z$dS)6z�
    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-2025 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__�r
r
�D/usr/local/lib/python3.10/dist-packages/pip/_vendor/pygments/util.pyr�rc@r)�OptionErrorz�
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    Nrr
r
r
rr
"rr
Fc	Cs@|�||�}|r|��}||vrtd�|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�stringr
r
r�get_choice_opt(srcCs�|�||�}t|t�r
|St|t�rt|�St|t�s&td|�d|�d���|��dvr.dS|��dvr6dStd|�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�intrr
r�rrrrr
r
r�get_bool_opt5s


r*c	Cs^|�||�}zt|�WStytd|�d|�d���ty.td|�d|�d���w)z?As :func:`get_bool_opt`, but interpret the value as an integer.rrz ; you must give an integer valuer%)rr(�	TypeErrorr
�
ValueErrorr)r
r
r�get_int_optRs
�r-cCsJ|�||�}t|t�r|��St|ttf�rt|�Std|�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.
    rrz; you must give a list value)rr&r�split�list�tupler
)rrr�valr
r
r�get_list_opt^s
r2cCsL|jsdSg}|j����D]}|��r|�d|���qd�|���S)N�� )r	�strip�
splitlines�appendr�lstrip)�obj�res�liner
r
r�docstring_headlinensr<cs�fdd�}�j|_t|�S)zAReturn a static text analyser function that returns float values.c	sZz�|�}Wn
tyYdSw|sdSztdtdt|���WSttfy,YdSw)Ngg�?)�	Exception�min�max�floatr,r+)�text�rv��fr
r�text_analyse|s��z%make_analysator.<locals>.text_analyse)r	�staticmethod)rDrEr
rCr�make_analysatorzsrGcCs�|�d�}|dkr|d|���}n|��}|�d�rNzdd�t�|dd����D�d}Wn
ty9Yd	Swt�d
|�d�tj	�}|�
|�durNdSd	S)
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#!cSsg|]}|r|�d�s|�qS)�-)�
startswith)�.0�xr
r
r�
<listcomp>�s
�
�z#shebang_matches.<locals>.<listcomp>����F�^z(\.(exe|cmd|bat|bin))?$T)�findrrJ�
split_path_rer.r5�
IndexError�re�compile�
IGNORECASE�search)rA�regex�index�
first_line�foundr
r
r�shebang_matches�s 

��r\cCs<t�|�}|durdS|�d�}t�|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_rerW�grouprTrU�I�matchr5)rArX�m�doctyper
r
r�doctype_matches�s


rdcCs
t|d�S)z3Check if the file looks like it has a html doctype.�html)rd)rAr
r
r�html_doctype_matches�s
rfcCsnt�|�rdSt|�}zt|WSty6t�|�}|dur#YdSt�|dd��du}|t|<|YSw)z2Check if a doctype exists or if we have some tags.TNi�)�xml_decl_rera�hash�_looks_like_xml_cache�KeyErrorr^rW�tag_re)rA�keyrbrBr
r
r�looks_like_xml�s


�rmcCsd|d?d|d@fS)zoGiven a unicode character code with length greater than 16 bits,
    return the two 16 bit surrogate pair.
    i���
i�i�r
)�cr
r
r�
surrogatepair�srpc	Cs�g}d|d}d|dd}|�||d�|r*|D]}|�||d�qn|D]}t|d�}|�||dd�|d	d�q,|�|d
�d�|�S)z)Formats a sequence of strings for output.r4�r]z = (�,�"N���rO�)rH)r7�reprr)	�var_name�seq�raw�indent_level�lines�base_indent�inner_indent�i�rr
r
r�format_lines�s�$
r�r
cCs>g}t�}|D]}||vs||vrq|�|�|�|�q|S)za
    Returns a list with duplicates removed from the iterable `it`.

    Order is preserved.
    )�setr7�add)�it�already_seen�lst�seenr~r
r
r�duplicates_removed�s
r�c@seZdZdZdd�ZdS)�Futurez�Generic class to defer some work.

    Handled specially in RegexLexerMeta, to support regex string construction at
    first use.
    cCst��N)�NotImplementedError��selfr
r
rrsz
Future.getN)rrrr	rr
r
r
rr�	sr�cCsxz
|�d�}|dfWSty;zddl}|��}|��}||fWYSttfy:|�d�}|dfYYSww)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)rAr��prefencodingr
r
r�guess_decodes


��r�cCsHt|dd�r z|�|j�}WntyYt|�Sw||jfSt|�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�)rA�termr
r
r�guess_decode_from_terminal(s�
r�cCs"t|dd�r	|jSddl}|��S)z7Return our best guess of encoding for the given *term*.r�Nr)r�r�r�r�)r�r�r
r
r�terminal_encoding9sr�c@seZdZdd�ZdS)�UnclosingTextIOWrappercCs|��dSr�)�flushr�r
r
r�closeCszUnclosingTextIOWrapper.closeN)rrrr�r
r
r
rr�Asr�)NFr�)Fr)r
)%r	rT�iorrUrR�DOTALL�	MULTILINE�VERBOSEr^rVrkr`rgr,rr=r
rr*r-r2r<rGr\rdrfrirmrpr�r�r�r�r�r�r�r
r
r
r�<module>s@

�	�



-