HEX
Server: Apache
System: Linux ip-172-26-2-106 6.1.0-37-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User: daemon (1)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pygments/formatters/__pycache__/terminal256.cpython-311.pyc
�

�E�c�-���dZddlmZddlmZddlmZddgZGd�d��ZGd	�de��Z	Gd
�de	��Z
dS)a�
    pygments.formatters.terminal256
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for 256-color terminal output with ANSI sequences.

    RGB-to-XTERM color conversion routines adapted from xterm256-conv
    tool (http://frexx.de/xterm-256-notes/data/xterm256-conv2.tar.bz2)
    by Wolfgang Frisch.

    Formatter version 1.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�	Formatter)�codes)�
ansicolors�Terminal256Formatter�TerminalTrueColorFormatterc�.�eZdZdd�Zd�Zd�Zd�Zd�ZdS)	�EscapeSequenceNFc�L�||_||_||_||_||_dS�N)�fg�bg�bold�	underline�italic)�selfrr
rrrs      �A/usr/lib/python3/dist-packages/pygments/formatters/terminal256.py�__init__zEscapeSequence.__init__#s)����������	�"��������c�Z�t|��rdd�|��zdzSdS)Nz[�;�m�)�len�join�r�attrss  r�escapezEscapeSequence.escape*s/���u�:�:�	3��S�X�X�e�_�_�,�s�2�2��rrc	��g}|j�}|jtvrOt|j�dd��}d|vrd|_|�|dd���n |�ddd	|jzf��|j��|jtvrat|j�dd��}|�tt|dd���d
z����n |�ddd	|jzf��|jr|�d��|j
r|�d
��|jr|�d��|�|��S)N�ansirz;01mT���38�5z%i�
�48�01�04�03)
rrr�replacer�append�extendr
�str�intrrr)rr�escs   r�color_stringzEscapeSequence.color_string/sf�����7���w�*�$�$��D�G�O�O�F�2�6�6�7���S�=�=� $�D�I����S��1��X�&�&�&�&����d�C�����8�9�9�9��7���w�*�$�$��D�G�O�O�F�2�6�6�7�����S��S��1��X���r�!1�2�2�3�3�3�3����d�C�����8�9�9�9��9�	��L�L������>�	��L�L������;�	��L�L������{�{�5�!�!�!rc
�|�g}|jrb|�ddt|jd��t|jd��t|jd��f��|jrb|�ddt|jd��t|jd��t|jd��f��|jr|�d��|jr|�d��|jr|�d	��|�|��S)
Nr"�2r�r r%r&r'r()	rr+r,r
rr*rrrrs  r�true_color_stringz EscapeSequence.true_color_stringIs�����7�	Y��L�L�$��S�����_�_�c�$�'�!�*�o�o�s�4�7�ST�:���W�X�X�X��7�	Y��L�L�$��S�����_�_�c�$�'�!�*�o�o�s�4�7�ST�:���W�X�X�X��9�	��L�L������>�	��L�L������;�	��L�L������{�{�5�!�!�!rc���g}|j�|�d��|j�|�d��|js|js|jr|�d��|�|��S)N�39�49�00)rr*r
rrrrrs  r�reset_stringzEscapeSequence.reset_stringWs{�����7���L�L������7���L�L������9�	���	�$�+�	��L�L������{�{�5�!�!�!r)NNFFF)�__name__�
__module__�__qualname__rrr/r3r8�rrr	r	"sd�������������
"�"�"�4"�"�"�"�"�"�"�"rr	c�R�eZdZdZdZgd�ZgZd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZdS)
ra�
    Format tokens with ANSI color sequences, for output in a 256-color
    terminal or console.  Like in `TerminalFormatter` color sequences
    are terminated at newlines, so that paging the output works correctly.

    The formatter takes colors from a style defined by the `style` option
    and converts them to nearest ANSI 256-color escape sequences. Bold and
    underline attributes from the style are preserved (and displayed).

    .. versionadded:: 0.9

    .. versionchanged:: 2.2
       If the used style defines foreground colors in the form ``#ansi*``, then
       `Terminal256Formatter` will map these to non extended foreground color.
       See :ref:`AnsiTerminalStyle` for more information.

    .. versionchanged:: 2.4
       The ANSI color names have been updated with names that are easier to
       understand and align with colornames of other projects and terminals.
       See :ref:`this table <new-ansi-color-names>` for more information.


    Options accepted:

    `style`
        The style to use, can be a string or a Style subclass (default:
        ``'default'``).

    `linenos`
        Set to ``True`` to have line numbers on the terminal output as well
        (default: ``False`` = no line numbers).
    �Terminal256)�terminal256�
console256�256c��tj|fi|��g|_i|_i|_d|v|_d|v|_d|v|_|���|�	��|�
dd��|_d|_dS)N�nobold�nounderline�noitalic�linenosFr)
rr�xterm_colors�
best_match�style_string�usebold�useunderline�	useitalic�_build_color_table�
_setup_styles�getrF�_lineno)r�optionss  rrzTerminal256Formatter.__init__�s�����4�+�+�7�+�+�+�����������w�.���)��8���#�7�2������!�!�!��������{�{�9�e�4�4�������rc�f�|j�d��|j�d��|j�d��|j�d��|j�d��|j�d��|j�d��|j�d��|j�d	��|j�d
��|j�d��|j�d��|j�d
��|j�d��|j�d��|j�d��d}td��D]F}||dzdz}||dzdz}||dz}|j�|||f���Gtdd��D]'}d|dzz}|j�|||f���(dS)N)rrr)��rr)rrSr)rSrSr)rr��)rSrrS)rrSrS)��rUrU)�rVrV)�rr)rrWr)rWrWr)�\rXrW)rWrrW)rrWrW)rWrWrW)r�_����rW���$�r2��r$)rGr*�range)r�
valuerange�i�r�g�b�vs       rrMz'Terminal256Formatter._build_color_table�sB��	
�� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4��� � �!3�4�4�4�:�
��s���	0�	0�A��A��G�q�=�)�A��A��F�a�<�(�A��1�q�5�!�A���$�$�a��A�Y�/�/�/�/��q�"���	0�	0�A��A��F�
�A���$�$�a��A�Y�/�/�/�/�	0�	0rc���d}d}tdd��D]K}|j|}||dz
}||dz
}	||dz
}
||z|	|	zz|
|
zz}||kr|}|}�L|S)Nir�r2r )rbrG)rrerfrg�distance�matchrd�values�rd�gd�bd�ds            r�_closest_colorz#Terminal256Formatter._closest_color�s��������q�#���
	�
	�A��&�q�)�F��V�A�Y��B��V�A�Y��B��V�A�Y��B��2���2��
��2��%�A��8�|�|�������rc�8�|j�|d��}|tvr|}||j|<|�g	tt	|��d��}n#t
$rd}YnwxYw|dz	dz}|dz	dz}|dz}|�|||��}||j|<|S)N�rrWra)rHrOrr-r,�
ValueErrorrr)r�color�index�rgbrerfrgs       r�_color_indexz!Terminal256Formatter._color_index�s�����#�#�E�4�0�0���J����E�%*�D�O�E�"��=�
��#�e�*�*�b�)�)�����
�
�
�����
�������d�"�A����T�!�A��d�
�A��'�'��1�a�0�0�E�%*�D�O�E�"��s�A�A!� A!c��|jD�]5\}}t��}|dr!|�|d��|_n(|dr |�|d��|_|dr!|�|d��|_n(|dr |�|d��|_|jr|drd|_|jr|drd|_|j	r|drd|_
|���|���f|j
t|��<��7dS)	N�	ansicolorrv�bgansicolor�bgcolorrTrr)�styler	ryrr
rJrrKrrLrr/r8rIr,�r�ttype�ndefrs    rrNz"Terminal256Formatter._setup_styles�sZ���:�	D�	D�K�E�4�#�%�%�F��K� �
=� �-�-�d�;�.?�@�@��	�	��g��
=� �-�-�d�7�m�<�<��	��M�"�
?� �-�-�d�=�.A�B�B��	�	��i��
?� �-�-�d�9�o�>�>��	��|�
#��V��
#�"���� �
(�T�+�%6�
(�#'�� ��~�
%�$�x�.�
%� $��
�-3�-@�-@�-B�-B�-3�-@�-@�-B�-B�-D�D��c�%�j�j�)�)�#	D�	Drc�~�|xjdz
c_|�d|jdkrdpd|jfz��dS)Nr2z%s%04d: �
r)rP�write)r�outfiles  r�
_write_linenoz"Terminal256Formatter._write_lineno�sG����������
�
�j�D�L�A�$5�$>�$�$D�"�d�l�#S�S�T�T�T�T�Trc�.�tj|||��Sr)r�format)r�tokensourcer�s   rr�zTerminal256Formatter.format�s�����k�7�;�;�;rc�p�|jr|�|��|D]�\}}d}|r�|r�	|jt|��\}}|�d��}|dd�D]Q}	|	r|�||	z|z��|jr|�|���<|�d���R|dr!|�||dz|z��d}n#t$r
|j}YnwxYw|r|��|r|�|����|jr|�d��dSdS)NTr����F)rFr�rIr,�splitr��KeyError�parent)
rr�r�r��value�	not_found�on�off�spl�lines
          r�format_unencodedz%Terminal256Formatter.format_unencoded�s����<�	(����w�'�'�'�'�	%�	%�L�E�5��I��
)�I�
)�)�"�/��E�
�
�;�G�B�� �+�+�d�+�+�C� #�C�R�C��0�0���;�#�M�M�"�t�)�c�/�:�:�:��<�0� �.�.�w�7�7�7�7�#�M�M�$�/�/�/�/��2�w�:��
�
�b�3�r�7�l�S�&8�9�9�9� %�I�I�� �)�)�)�!�L�E�E�E�)����-�
)�I�
)�6�
%��
�
�e�$�$�$���<�	 ��M�M�$������	 �	 s�B9C%�%C9�8C9N)r9r:r;�__doc__�name�aliases�	filenamesrrMrrryrNr�r�r�r<rrrrbs���������@�D�2�2�2�G��I����""0�"0�"0�H���"���&D�D�D�*U�U�U�<�<�<�% �% �% �% �% rc�4�eZdZdZdZgd�ZgZd�Zd�Zd�Z	dS)ra}
    Format tokens with ANSI color sequences, for output in a true-color
    terminal or console.  Like in `TerminalFormatter` color sequences
    are terminated at newlines, so that paging the output works correctly.

    .. versionadded:: 2.1

    Options accepted:

    `style`
        The style to use, can be a string or a Style subclass (default:
        ``'default'``).
    �TerminalTrueColor)�terminal16m�
console16m�16mc��dSrr<)rs rrMz-TerminalTrueColorFormatter._build_color_table7s���rc��	tt|��d��}n#t$rYdSwxYw|dz	dz}|dz	dz}|dz}|||fS)NrtrWra)r-r,ru)rrvrxrerfrgs      r�_color_tuplez'TerminalTrueColorFormatter._color_tuple:sq��	��c�%�j�j�"�%�%�C�C���	�	�	��4�4�	����
�B�Y�$���
�A�X�����$�J���1�a�y�s� �
.�.c���|jD]�\}}t��}|dr |�|d��|_|dr |�|d��|_|jr|drd|_|jr|drd|_|j	r|drd|_
|���|���f|j
t|��<��dS)Nrvr}rTrr)r~r	r�rr
rJrrKrrLrr3r8rIr,rs    rrNz(TerminalTrueColorFormatter._setup_stylesDs���:�
	D�
	D�K�E�4�#�%�%�F��G�}�
=� �-�-�d�7�m�<�<��	��I��
?� �-�-�d�9�o�>�>��	��|�
#��V��
#�"���� �
(�T�+�%6�
(�#'�� ��~�
%�$�x�.�
%� $��
�-3�-E�-E�-G�-G�-3�-@�-@�-B�-B�-D�D��c�%�j�j�)�)�
	D�
	DrN)
r9r:r;r�r�r�r�rMr�rNr<rrrr%sg���������D�2�2�2�G��I�
�
�
����D�D�D�D�DrN)r��pygments.formatterr�pygments.consoler�pygments.styler�__all__r	rrr<rr�<module>r�s�����2)�(�(�(�(�(�"�"�"�"�"�"�%�%�%�%�%�%�"�#?�
@��="�="�="�="�="�="�="�="�@ � � � � �9� � � �F-D�-D�-D�-D�-D�!5�-D�-D�-D�-D�-Dr