HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/pygments/formatters/__pycache__/other.cpython-37.pyc
B

��f��@szdZddlmZddlmZddlmZddlmZdddgZ	Gd	d�de�Z
Gd
d�de�ZdZdZ
Gd
d�de�ZdS)z�
    pygments.formatters.other
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    Other formatters: NullFormatter, RawTokenFormatter.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�	Formatter)�get_choice_opt)�Token)�colorize�
NullFormatter�RawTokenFormatter�TestcaseFormatterc@s*eZdZdZdZddgZdgZdd�ZdS)	rz;
    Output the text unchanged without any formatting.
    z	Text only�text�nullz*.txtcCs<|j}x0|D](\}}|r*|�|�|��q|�|�qWdS)N)�encoding�write�encode)�self�tokensource�outfile�enc�ttype�value�r�J/opt/alt/python37/lib/python3.7/site-packages/pygments/formatters/other.py�formats
zNullFormatter.formatN)�__name__�
__module__�__qualname__�__doc__�name�aliases�	filenamesrrrrrrs
c@s6eZdZdZdZddgZdgZdZdd�Zd	d
�Z	dS)ra}
    Format tokens as a raw representation for storing token streams.

    The format is ``tokentype<TAB>repr(tokenstring)\n``. The output can later
    be converted to a token stream with the `RawTokenLexer`, described in the
    :doc:`lexer list <lexers>`.

    Only two options are accepted:

    `compress`
        If set to ``'gz'`` or ``'bz2'``, compress the output with the given
        compression algorithm after encoding (default: ``''``).
    `error_color`
        If set to a color name, highlight error tokens using that color.  If
        set but with no value, defaults to ``'red'``.

        .. versionadded:: 0.11

    z
Raw tokens�raw�tokensz*.rawFcKs�tj|f|�d|_t|dddddgd�|_|�dd�|_|jdkrJd	|_|jdk	r�yt|jd�Wn"tk
r�t	d
|j��YnXdS)N�ascii�compress��none�gz�bz2�error_colorTZredzInvalid color %r specified)
r�__init__rrr!�getr&r�KeyError�
ValueError)r�optionsrrrr'>s

zRawTokenFormatter.__init__c
sy��d�Wntk
r*td��YnX|jdkr\ddl}|�ddd����j}�j}nF|jdkr�ddl}|�d����fd	d
�}��fdd�}n�j}�j}|j	r�xd|D]8\}}d
||f}	|t
jkr�|t|j	|	��q�||	�q�Wn"x |D]\}}|d
||f�q�W|�dS)N�z3The raw tokens formatter needs a binary output filer$rr"�wb�	r%cs����|��dS)N)rr!)r	)�
compressorrrrr`sz'RawTokenFormatter.format.<locals>.writecs���������dS)N)r�flushr)r/rrrr0csz'RawTokenFormatter.format.<locals>.flushs%r	%r
)
r�	TypeErrorr!�gzip�GzipFile�closer%�
BZ2Compressorr0r&r�Errorr)
rrrr2rr0r%rr�liner)r/rrrPs2



zRawTokenFormatter.formatN)
rrrrrrrZ
unicodeoutputr'rrrrrr$szG    def testNeedsName(lexer):
        fragment = %r
        tokens = [
zD        ]
        assert list(lexer.get_tokens(fragment)) == tokens
c@s*eZdZdZdZdgZdd�Zdd�ZdS)	rzU
    Format tokens as appropriate for a new testcase.

    .. versionadded:: 2.0
    ZTestcaseZtestcasecKs.tj|f|�|jdk	r*|jdkr*td��dS)Nzutf-8z*Only None and utf-8 are allowed encodings.)rr'rr*)rr+rrrr'�szTestcaseFormatter.__init__cCs�d}g}g}x.|D]&\}}|�|�|�d|||f�qWtd�|�f}d�|�}	t}
|jdkrx|�||	|
�n0|�|�d��|�|	�d��|�|
�d��|��dS)Nz            z%s(%s, %r),
r"zutf-8)�append�TESTCASE_BEFORE�join�TESTCASE_AFTERrrr
r0)rrr�indentationZrawbufZoutbufrr�beforeZduring�afterrrrr�s


zTestcaseFormatter.formatN)rrrrrrr'rrrrrr�s
N)rZpygments.formatterrZ
pygments.utilrZpygments.tokenrZpygments.consoler�__all__rrr9r;rrrrr�<module>	s
W