HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pygments/lexers/__pycache__/__init__.cpython-310.pyc
o

���a�+�@sNdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZmZdd	d
�Zgd�ee�ee�ZiZiZdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zd*dd�Zd+dd�Zd+dd�Zdd �Zd,d"d#�Zd$d%�Z d&d'�Z!Gd(d)�d)ej"�Z#ej$e%Z&e#e%�Z'e'j(�)e&j(�e'ej$e%<e'`'e'`&e'`e'`dS)-z�
    pygments.lexers
    ~~~~~~~~~~~~~~~

    Pygments lexers.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�basename)�LEXERS)�get_filetype_from_buffer)�find_plugin_lexers)�
ClassNotFound�guess_decode�PythonLexer�PythonTracebackLexer)�Python3Lexer�Python3TracebackLexer)�get_lexer_by_name�get_lexer_for_filename�find_lexer_class�guess_lexer�load_lexer_from_filecCs8|tvrt�t�|��}t|<|�|�St|�|�S)zBReturn whether the supplied file name fn matches pattern filename.)�_pattern_cache�re�compile�fnmatch�	translate�match)�fn�glob�pattern�r�:/usr/lib/python3/dist-packages/pygments/lexers/__init__.py�_fn_matches"s
rcCs4t|dddg�}|jD]}t||�}|t|j<qdS)z0Load a lexer (and all others in the module too).N�__all__)�
__import__r�getattr�_lexer_cache�name)�module_name�mod�
lexer_name�clsrrr�_load_lexers*s


�r&ccsD�t��D]	}|dd�Vqt�D]
}|j|j|j|jfVqdS)zoReturn a generator of tuples in the form ``(name, aliases,
    filenames, mimetypes)`` of all know lexers.
    �N)r�valuesrr!�aliases�	filenames�	mimetypes)�item�lexerrrr�get_all_lexers2s�
�r.cCsf|tvrt|St��D]\}}}}}||kr!t|�t|Sqt�D]}|j|kr0|Sq%dS)zALookup a lexer class by name.

    Return None if not found.
    N)r rr(r&rr!)r!r"�lnamer)�_r%rrrr<s�

��rcCs~|std|��t��D]\}}}}}|��|vr'|tvr!t|�t|Sqt�D]
}|��|jvr8|Sq+td|��)z�Lookup a lexer class by alias.

    Like `get_lexer_by_name`, but does not instantiate the class.

    .. versionadded:: 2.2
    �no lexer for alias %r found�rrr(�lowerr r&rr))�_aliasr"r!r)r0r%rrr�find_lexer_class_by_nameNs�
�r5cKs�|std|��t��D] \}}}}}|��|vr,|tvr!t|�t|di|��Sqt�D]}|��|jvrB|di|��Sq0td|��)zEGet a lexer by an alias.

    Raises ClassNotFound if not found.
    r1Nrr2)r4�optionsr"r!r)r0r%rrrrds�
�r�CustomLexerc
Ks�z6i}t|d��}t|��|�Wd�n1swY||vr+td||f��||}|di|��WStyJ}ztd||f��d}~wtyQ�tyb}ztd|��d}~ww)aLoad a lexer from a file.

    This method expects a file located relative to the current working
    directory, which contains a Lexer class. By default, it expects the
    Lexer to be name CustomLexer; you can specify your own class name
    as the second argument to this function.

    Users should be very careful with the input, because this method
    is equivalent to running eval on the input file.

    Raises ClassNotFound if there are any problems importing the Lexer.

    .. versionadded:: 2.2
    �rbNzno valid %s class found in %szcannot read %s: %sz#error when loading custom lexer: %sr)�open�exec�readr�OSError�	Exception)�filename�	lexernamer6�custom_namespace�f�lexer_class�errrrrrys(�����rcs�g}t|�}t��D]"\}}}}}|D]}t||�r+|tvr"t|�|�t||f�qq
t�D]}	|	jD]}t||�rC|�|	|f�q5q0t	�t
�rNt����fdd�}
|rb|j|
d�|ddSdS)z�Get a lexer for a filename.

    If multiple lexers match the filename pattern, use ``analyse_text()`` to
    figure out which one is more appropriate.

    Returns None if not found.
    cs@|\}}d|vr
dpd}�r|���||jfS|j||jfS)N�*g�?r)�analyse_text�__name__�priority)�infor%r>�bonus��coderr�
get_rating�s
z1find_lexer_class_for_filename.<locals>.get_rating��key���rN)
rrr(rr r&�appendrr*�
isinstance�bytesr�sort)�_fnrK�matchesr�modnamer!r0r*r>r%rLrrJr�find_lexer_class_for_filename�s.
��


��
�rWcKs(t||�}|s
td|��|di|��S)z�Get a lexer for a filename.

    If multiple lexers match the filename pattern, use ``analyse_text()`` to
    figure out which one is more appropriate.

    Raises ClassNotFound if not found.
    �no lexer for filename %r foundNr)rWr)rTrKr6�resrrrr
�s
r
cKszt��D]\}}}}}||vr"|tvrt|�t|di|��Sqt�D]}||jvr6|di|��Sq&td|��)zHGet a lexer for a mimetype.

    Raises ClassNotFound if not found.
    zno lexer for mimetype %r foundNr)rr(r r&rr+r)�_mimer6rVr!r0r+r%rrr�get_lexer_for_mimetype�s�

�r[TccsV�tt�D]}t|dd�\}}|tvrt|�t|Vq|r)t�EdHdSdS)z*Return an iterator over all lexer classes.N�)�sortedrr r&r)�pluginsrNr"r!rrr�_iter_lexerclasses�s��r_c
s
t|�}i�t�}t�D]*}|jD]}t||�r!|�|�d�|<q|jD]}t||�r5|�|�d�|<q%q|s?td|��t|�dkrN|�	�di|��Sg}|D]}|�
|�}|dkrf|di|��S|�||f�qR�fdd�}	|j|	d�|d	ddi|��S)a�
    Lookup all lexers that handle those filenames primary (``filenames``)
    or secondary (``alias_filenames``). Then run a text analysis for those
    lexers and choose the best result.

    usage::

        >>> from pygments.lexers import guess_lexer_for_filename
        >>> guess_lexer_for_filename('hello.html', '<%= @foo %>')
        <pygments.lexers.templates.RhtmlLexer object at 0xb7d2f32c>
        >>> guess_lexer_for_filename('hello.html', '<h1>{{ title|e }}</h1>')
        <pygments.lexers.templates.HtmlDjangoLexer object at 0xb7d2f2ac>
        >>> guess_lexer_for_filename('style.css', 'a { color: <?= $link ?> }')
        <pygments.lexers.templates.CssPhpLexer object at 0xb7ba518c>
    TFrXr'��?cs$|d�|d|dj|djfS�Nrr')rGrF)�t��primaryrr�	type_sorts$z+guess_lexer_for_filename.<locals>.type_sortrMrONr)
r�setr_r*r�add�alias_filenamesr�len�poprErPrS)
rT�_textr6r�matching_lexersr-r>�result�rvrerrcr�guess_lexer_for_filename�s8



�


��
rocKs�t|t�s|�d|�d��}|r|�|pd�}nt|�\}}t|�}|dur9z	t|fi|��WSty8Ynwddg}t�D]"}|�	|�}|dkrT|d
i|��S||dkrb||f|dd�<q@|drm|ddurqtd	��|dd
i|��S)z?Guess a lexer by strong distinctions in the text (eg, shebang).�
inencoding�encoding�utf8Ngr`rr'z no lexer matching the text foundr)
rQ�str�get�decoderrrrr_rE)rkr6rpr0�ft�
best_lexerr-rnrrrr#s.
�

�rc@seZdZdZdd�ZdS)�_automodulezAutomatically import lexers.cCsTt�|�}|rt|d�t|d}t|||�|S|tvr&t|t|�St|��ra)rrtr&r �setattr�COMPATr�AttributeError)�selfr!rHr%rrr�__getattr__Es
z_automodule.__getattr__N)rF�
__module__�__qualname__�__doc__r}rrrrrxBsrx)r7)N)T)*r�r�sys�typesr�os.pathr�pygments.lexers._mappingr�pygments.modeliner�pygments.pluginr�
pygments.utilrrrz�listrr rrr&r.rr5rrrWr
r[r_ror�
ModuleTyperx�modulesrF�oldmod�newmod�__dict__�updaterrrr�<module>sN
���


#
+
3