HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/pygments/__pycache__/util.cpython-37.pyc
B

L��g�'�@s6dZddlZddlmZe�d�Ze�dejejBejB�Z	e�dej
ejBejB�Ze�dej�Z
Gdd	�d	e�ZGd
d�de�Zd2d
d�Zd3dd�Zd4dd�Zd5dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZiZdd �Zd!d"�Zd6d#d$�Zd7d&d'�ZGd(d)�d)�Z d*d+�Z!d,d-�Z"d.d/�Z#Gd0d1�d1e�Z$dS)8z�
    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-2023 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@seZdZdZdS)�
ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N)�__name__�
__module__�__qualname__�__doc__�rr�=/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/pygments/util.pyrsrc@seZdZdZdS)�OptionErrorz�
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    N)rrrrrrrr	r
"sr
FcCs@|�||�}|r|��}||kr<td|d�tt|��f��|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 %s must be one of %sz, )�get�lowerr
�join�map�str)�options�optname�allowed�default�normcase�stringrrr	�get_choice_opt(srcCs||�||�}t|t�r|St|t�r,t|�St|t�sHtd||f��n0|��dkrXdS|��dkrhdStd||f��dS)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).
    zBInvalid type %r for option %s; use 1/0, yes/no, true/false, on/off)�1�yes�true�onT)�0�no�false�offFzCInvalid value %r for option %s; use 1/0, yes/no, true/false, on/offN)r�
isinstance�bool�intrr
r)rrrrrrr	�get_bool_opt6s


r"cCs`|�||�}yt|�Stk
r8td||f��Yn$tk
rZtd||f��YnXdS)z?As :func:`get_bool_opt`, but interpret the value as an integer.z=Invalid type %r for option %s; you must give an integer valuez>Invalid value %r for option %s; you must give an integer valueN)rr!�	TypeErrorr
�
ValueError)rrrrrrr	�get_int_optUsr%cCsH|�||�}t|t�r|��St|ttf�r4t|�Std||f��dS)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.
    z9Invalid type %r for option %s; you must give a list valueN)rrr�split�list�tupler
)rrr�valrrr	�get_list_optcs
r*cCsR|js
dSg}x4|j����D]"}|��r>|�d|���qPqWd�|���S)N�� )r�strip�
splitlines�appendr
�lstrip)�obj�res�linerrr	�docstring_headlinetsr4cs�fdd�}�j|_t|�S)zAReturn a static text analyser function that returns float values.c	s\y�|�}Wntk
r dSX|s*dSytdtdt|���Sttfk
rVdSXdS)Ngg�?)�	Exception�min�max�floatr$r#)�text�rv)�frr	�text_analyse�sz%make_analysator.<locals>.text_analyse)r�staticmethod)r;r<r)r;r	�make_analysator�sr>cCs�|�d�}|dkr$|d|���}n|��}|�d�r�y(dd�t�|dd����D�d}Wntk
rrd	SXt�d
|tj	�}|�
|�dk	r�dSd	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�xrrr	�
<listcomp>�sz#shebang_matches.<locals>.<listcomp>����Fz^%s(\.(exe|cmd|bat|bin))?$T)�findrrA�
split_path_rer&r-�
IndexError�re�compile�
IGNORECASE�search)r9�regex�index�
first_line�foundrrr	�shebang_matches�s


rRcCs<t�|�}|dkrdS|�d�}t�|tj��|���dk	S)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_rerM�grouprJrK�I�matchr-)r9rN�m�doctyperrr	�doctype_matches�s


rZcCs
t|d�S)z3Check if the file looks like it has a html doctype.�html)rZ)r9rrr	�html_doctype_matches�sr\cCslt�|�rdSt|�}yt|Stk
rft�|�}|dk	rDdSt�|dd��dk	}|t|<|SXdS)z2Check if a doctype exists or if we have some tags.TNi�)�xml_decl_rerW�hash�_looks_like_xml_cache�KeyErrorrTrM�tag_re)r9�keyrXr:rrr	�looks_like_xml�s

rccCsd|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)�crrr	�
surrogatepair�srfc	Cs�g}d|d}d|dd}|�||d�|rXx\|D]}|�||d�q<Wn<x:|D]2}t|d�}|�||dd�|d	d�q^W|�|d
�d�|�S)z)Formats a sequence of strings for output.r,�rSz = (�,�"N���rF�)r?)r/�reprr
)	�var_name�seq�raw�indent_level�linesZbase_indentZinner_indent�i�rrrr	�format_lines�s

&rtrcCsBg}t�}x2|D]*}||ks||kr&q|�|�|�|�qW|S)za
    Returns a list with duplicates removed from the iterable `it`.

    Order is preserved.
    )�setr/�add)�itZalready_seen�lst�seenrrrrr	�duplicates_removed�s

rzc@seZdZdZdd�ZdS)�Futurez�Generic class to defer some work.

    Handled specially in RegexLexerMeta, to support regex string construction at
    first use.
    cCst�dS)N)�NotImplementedError)�selfrrr	rsz
Future.getN)rrrrrrrrr	r{sr{cCsty|�d�}|dfStk
rny ddl}|��}|��}||fSttfk
rh|�d�}|dfSXYnXdS)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)r9r�Zprefencodingrrr	�guess_decodes

r�cCsDt|dd�r<y|�|j�}Wntk
r0YnX||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)�getattrrr�r�r�)r9�termrrr	�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�rrr	�terminal_encoding?sr�c@seZdZdd�ZdS)�UnclosingTextIOWrappercCs|��dS)N)�flush)r}rrr	�closeIszUnclosingTextIOWrapper.closeN)rrrr�rrrr	r�Gsr�)NF)N)N)N)Fr)r)%rrJ�iorrKrH�DOTALL�	MULTILINE�VERBOSErTrLrarVr]r$rr5r
rr"r%r*r4r>rRrZr\r_rcrfrtrzr{r�r�r�r�rrrr	�<module>	s:




-