https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/pygments/formatters/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/pygments/formatters/__pycache__/terminal256.cpython-310.pyc
o

���a�-�@sbdZddlmZddlmZddlmZddgZGdd�d�ZGd	d�de�Z	Gd
d�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-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�	Formatter)�codes)�
ansicolors�Terminal256Formatter�TerminalTrueColorFormatterc@s6eZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�EscapeSequenceNFcCs"||_||_||_||_||_dS�N)�fg�bg�bold�	underline�italic)�selfr	r
rrr
�r�A/usr/lib/python3/dist-packages/pygments/formatters/terminal256.py�__init__#s

zEscapeSequence.__init__cCst|�r
dd�|�dSdS)Nz[�;�m�)�len�join�r�attrsrrr�escape*szEscapeSequence.escapecCs�g}|jdur1|jtvr&t|j�dd�}d|vrd|_|�|dd��n|�ddd	|jf�|jdur_|jtvrTt|j�dd�}|�tt	|dd��d
��n|�ddd	|jf�|jrg|�d�|j
ro|�d
�|jrw|�d�|�|�S)N�ansirz;01mT���38�5z%i�
�48�01�04�03)
r	rr�replacer�append�extendr
�str�intrr
r)rr�escrrr�color_string/s(



 



zEscapeSequence.color_stringc	Cs�g}|jr|�ddt|jd�t|jd�t|jd�f�|jr:|�ddt|jd�t|jd�t|jd�f�|jrB|�d�|jrJ|�d�|jrR|�d	�|�|�S)
Nr�2r�rr r!r"r#)	r	r&r'r
rr%rr
rrrrr�true_color_stringIs22



z EscapeSequence.true_color_stringcCsRg}|jdur|�d�|jdur|�d�|js|js|jr$|�d�|�|�S)N�39�49�00)r	r%r
rrr
rrrrr�reset_stringWs





zEscapeSequence.reset_string)NNFFF)�__name__�
__module__�__qualname__rrr*r-r1rrrrr"s
rc@s`eZdZdZdZgd�ZgZdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)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�256cKsjtj|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�getr<�_lineno)r�optionsrrrr�s



zTerminal256Formatter.__init__cCsB|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]!}||dd}||dd}||d}|j�|||f�qftdd�D]}d|d}|j�|||f�q�dS)N)rrr)��rr)rrHr)rHrHr)rr��)rHrrH)rrHrH)��rJrJ)�rKrK)�rr)rrLr)rLrLr)�\rMrL)rLrrL)rrLrL)rLrLrL)r�_����rL���$�r,��r)r=r%�range)r�
valuerange�i�r�g�b�vrrrrC�s4�z'Terminal256Formatter._build_color_tablecCsrd}d}tdd�D]-}|j|}||d}||d}	||d}
|||	|	|
|
}||kr6|}|}q	|S)Nir�r,r)rWr=)rrZr[r\�distance�matchrY�values�rd�gd�bd�drrr�_closest_color�s
�z#Terminal256Formatter._closest_colorcCs�|j�|d�}|tvr|}||j|<|durGz	tt|�d�}Wnty*d}Ynw|d?d@}|d?d@}|d@}|�|||�}||j|<|S)N�rrLrV)r>rErr(r'�
ValueErrorrf)r�color�index�rgbrZr[r\rrr�_color_index�s 
�
z!Terminal256Formatter._color_indexcCs�|jD]d\}}t�}|dr|�|d�|_n|dr#|�|d�|_|dr0|�|d�|_n|dr<|�|d�|_|jrF|drFd|_|jrP|drPd|_|j	rZ|drZd|_
|��|��f|j
t|�<qdS)	N�	ansicolorri�bgansicolor�bgcolorrTrr
)�stylerrlr	r
r@rrArrBr
r*r1r?r'�r�ttype�ndefrrrrrD�s(��z"Terminal256Formatter._setup_stylescCs4|jd7_|�d|jdkrdpd|jf�dS)Nr,z%s%04d: �
r)rF�write)r�outfilerrr�
_write_lineno�s&z"Terminal256Formatter._write_linenocCst�|||�Sr)r�format)r�tokensourcervrrrrx�szTerminal256Formatter.formatc
	Cs�|jr|�|�|D]e\}}d}|rh|rhzC|jt|�\}}|�d�}|dd�D]}	|	r6|�||	|�|jr?|�|�q)|�d�q)|drT|�||d|�d}Wntyc|j}Ynw|rh|s|ro|�|�q
|jrz|�d�dSdS)NTrt���F)r<rwr?r'�splitru�KeyError�parent)
rryrvrr�value�	not_found�on�off�spl�linerrr�format_unencoded�s6


��
��z%Terminal256Formatter.format_unencodedN)r2r3r4�__doc__�name�aliases�	filenamesrrCrfrlrDrwrxr�rrrrrbs $c@s8eZdZdZdZgd�ZgZdd�Zdd�Zdd	�Z	d
S)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�16mcCsdSrr)rrrrrC7sz-TerminalTrueColorFormatter._build_color_tablecCsRz	tt|�d�}Wn
tyYdSw|d?d@}|d?d@}|d@}|||fS)NrgrLrV)r(r'rh)rrirkrZr[r\rrr�_color_tuple:s�
z'TerminalTrueColorFormatter._color_tuplecCs�|jD]J\}}t�}|dr|�|d�|_|dr"|�|d�|_|jr,|dr,d|_|jr6|dr6d|_|j	r@|dr@d|_
|��|��f|j
t|�<qdS)NrirorTrr
)rprr�r	r
r@rrArrBr
r-r1r?r'rqrrrrDDs ��z(TerminalTrueColorFormatter._setup_stylesN)
r2r3r4r�r�r�r�rCr�rDrrrrr%s

N)r��pygments.formatterr�pygments.consoler�pygments.styler�__all__rrrrrrr�<module>s@D

https://t.me/RX1948 - 2025