HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pygments/__pycache__/cmdline.cpython-38.pyc
U

`a�[OL�@s2dZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
mZmZmZmZddlmZmZmZmZmZmZddlmZdd	lmZmZdd
lmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'dd
l(m)Z)m*Z*ddl+m,Z,m-Z-dZ.dd�Z/dd�Z0dd�Z1dd�Z2dd�Z3ej4fdd�Z5dS)z�
    pygments.cmdline
    ~~~~~~~~~~~~~~~~

    Command line interface.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�print_functionN)�dedent)�__version__�	highlight)�
ClassNotFound�OptionError�docstring_headline�guess_decode�guess_decode_from_terminal�terminal_encoding)�get_all_lexers�get_lexer_by_name�guess_lexer�load_lexer_from_file�get_lexer_for_filename�find_lexer_class_for_filename)�	TextLexer)�LatexEmbeddedLexer�LatexFormatter)�get_all_formatters�get_formatter_by_name�load_formatter_from_file�get_formatter_for_filename�find_formatter_class)�TerminalFormatter)�Terminal256Formatter)�get_all_filters�find_filter_class)�get_all_styles�get_style_by_namea�Usage: %s [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]
          [-O <options>] [-P <option=value>] [-s] [-v] [-x] [-o <outfile>] [<infile>]

       %s -S <style> -f <formatter> [-a <arg>] [-O <options>] [-P <option=value>]
       %s -L [<which> ...]
       %s -N <filename>
       %s -H <type> <name>
       %s -h | -V

Highlight the input file and write the result to <outfile>.

If no input file is given, use stdin, if -o is not given, use stdout.

If -s is passed, lexing will be done in "streaming" mode, reading and
highlighting one line at a time.  This will only work properly with
lexers that have no constructs spanning multiple lines!

<lexer> is a lexer name (query all lexer names with -L). If -l is not
given, the lexer is guessed from the extension of the input file name
(this obviously doesn't work if the input is stdin).  If -g is passed,
attempt to guess the lexer from the file contents, or pass through as
plain text if this fails (this can work for stdin).

Likewise, <formatter> is a formatter name, and will be guessed from
the extension of the output file name. If no output file is given,
the terminal formatter will be used by default.

The additional option -x allows custom lexers and formatters to be
loaded from a .py file relative to the current working directory. For
example, ``-l ./customlexer.py -x``. By default, this option expects a
file with a class named CustomLexer or CustomFormatter; you can also
specify your own class name with a colon (``-l ./lexer.py:MyLexer``).
Users should be very careful not to use this option with untrusted files,
because it will import and run them.

With the -O option, you can give the lexer and formatter a comma-
separated list of options, e.g. ``-O bg=light,python=cool``.

The -P option adds lexer and formatter options like the -O option, but
you can only give one option per -P. That way, the option value may
contain commas and equals signs, which it can't with -O, e.g.
``-P "heading=Pygments, the Python highlighter".

With the -F option, you can add filters to the token stream, you can
give options in the same way as for -O after a colon (note: there must
not be spaces around the colon).

The -O, -P and -F options can be given multiple times.

With the -S option, print out style definitions for style <style>
for formatter <formatter>. The argument given by -a is formatter
dependent.

The -L option lists lexers, formatters, styles or filters -- set
`which` to the thing you want to list (e.g. "styles"), or omit it to
list everything.

The -N option guesses and prints out a lexer name based solely on
the given filename. It does not take input or highlight anything.
If no specific lexer can be determined "text" is returned.

The -H option prints detailed help for the object <name> of type <type>,
where <type> is one of "lexer", "formatter" or "filter".

The -s option processes lines one at a time until EOF, rather than
waiting to process the entire file.  This only works for stdin, and
is intended for streaming input such as you get from 'tail -f'.
Example usage: "tail -f sql.log | pygmentize -s -l sql"

The -v option prints a detailed traceback on unhandled exceptions,
which is useful for debugging and bug reports.

The -h option prints this help.
The -V option prints the package version.
c
Cs�i}|s|S|D]t}|��sq|�d�}|D]V}|��}z$|�dd�\}}|��}|��}Wntk
rxd||<Yq,X|||<q,q|S)N�,�=�T)�strip�split�
ValueError)Zo_strs�optsZo_strZo_argsZo_argZo_keyZo_val�r'�2/usr/lib/python3/dist-packages/pygments/cmdline.py�_parse_optionsps"
r)cCsVg}|s|S|D]@}d|krB|�dd�\}}|�|t|g�f�q|�|if�q|S)N�:r")r$�appendr))Zf_strs�filtersZf_str�fname�foptsr'r'r(�_parse_filters�sr/c	Cs�z�|dkr0t|�}td|j�tt|j��nX|dkr^t|�}td|j�tt|j��n*|dkr�t|�}td|�tt|j��WdSttfk
r�td|t	j
d	�Yd
SXdS)N�lexerzHelp on the %s lexer:�	formatterzHelp on the %s formatter:�filterzHelp on the %s filter:rz
%s not found!��filer")r
�print�namer�__doc__rr�AttributeErrorr%�sys�stderr)�whatr6�clsr'r'r(�_print_help�s"r=cCs�|dkr�t�td�td�g}t�D]@\}}}}d�|�d||rXdd�|�dpZdf}|�|�q(|��|D]}td	|�qv�nB|d
k�r t�td�td�g}t�D]F}t|�}	d�|j�d|	|jr�dd�|j�dp�df}|�|�q�|��|D]}td	|��q
n�|d
k�rxt�td�td�t	�D].}
t
|
�}td|
d�tdt|���qFnV|dk�r�t�td�td�t�D].}
t|
�}td|
d�tdt|���q�dS)Nr0zLexers:z~~~~~~~z, r*z(filenames �)�z* %s
    %s %sr1zFormatters:z~~~~~~~~~~~r2zFilters:z~~~~~~~~z* z    %s�stylezStyles:)
r5r�joinr+�sortrr�aliases�	filenamesrrrr)r;�info�fullname�namesZexts�_�tup�ir<�docr6r'r'r(�_print_list�sZ�

��



rLc*Cs6
i}g}g}g}|D]J\}}|dkr0|�|�n&|dkrD|�|�n|dkrV|�|�|||<q|�dd�dk	r|t|�dS|�dd�dk	r�tdt�dS|�dd�}	|	dk	r�|r�t|tjd	�d
Stddg�|s�dd
ddg}|D]}t|�d��q�dS|�dd�}
|
dk	�rh|�s(t	|�d
k�r:t|tjd	�d
S|\}}|dk�r^t|tjd	�d
St
||�St|�}
|�dd�|D]B}z|�dd�\}}Wnt
k
�r�d|
|<Yn
X||
|<�q�|�dd�|
�d|
�d��}|
�d|
�d��}|�dd�}|dk	�r2t|�}|dk�r t}t|jd�dS|�dd�}|�dd�}|dk	�r|�dd�}|�sxt|tjd	�d
S|�s�|�r�t|tjd	�d
Sz||
d<t|f|
�}Wn8tk
�r�}zt|tjd	�WY�dSd}~XYnXt|�|�p�d��dS|dk	�rt|tjd	�d
St|�}|�dd�d}|�dd�dk	�rJd}d}|�dd�}|�r8|�r�d |k�r�z:d!|k�r�|�d!d�\}}t||f|
�}nt|f|
�}Wn:tk
�r�}ztd"|tjd	�WY�dSd}~XYnXnPzt|f|
�}Wn>ttfk
�r6}ztd"|tjd	�WY�dSd}~XYnXd}|�r�t	|�dk�rbt|tjd	�d
Sd#|k�r~td$tjd	�d
S|d}z"t|d%��}|��}W5QRXWn:tk
�r�}ztd&|tjd	�WY�dSd}~XYnX|�s�t|�\}}|�s\zt||f|
�}Wn�tk
�r�}z\d'|k�r`zt|f|
�}Wn tk
�r\tf|
�}YnXntd"|tjd	�WY�dSW5d}~XYn:tk
�r�}ztd"|tjd	�WY�dSd}~XYnXn�d#|k�rDtj d(k�r�tj!j"��}n
tj!��}|�s
t#|tj!�\}}|�s\zt|f|
�}Wn tk
�r@tf|
�}YnXn|�s\td)tjd	�d
S|D]Z\}}z|j$|f|�Wn<tk
�r�}ztd"|tjd	�WY�dSd}~XYnX�q`|�d*d�} |�dd�}|�r�|�rbd |k�rbz:d!|k�r|�d!d�\}!}"t%|!|"f|
�}nt%|f|
�}Wn:tk
�r^}ztd"|tjd	�WY�dSd}~XYnXnPzt|f|
�}Wn>ttfk
�r�}ztd"|tjd	�WY�dSd}~XYnX| �rZ|�szt&| f|
�}Wn>ttfk
�r}ztd"|tjd	�WY�dSd}~XYnXzt| d+�}#Wn:tk
�rV}ztd,|tjd	�WY�dSd}~XYnXnL|�s�d-t'j(�d.d�k�r�t)f|
�}n
t*f|
�}tj d(k�r�tj+j"}#ntj+}#|�s�| �r�||_,nt-tj+�|_,| �	sJtj.d/k�	rJ|j/d0k�	rJtj d(k�	rdd1l0m1}$|$|#|j,d2�}#d|_,zddl2}%Wnt3k
�	r2YnX|%j4j5|#ddddd3�}#|
�d4d�}&t	|&�d
k�	r�t6|t7��	r�|&d}'|&d}(t8|'|(|�}d#|k�	r�t9||||#�dSzptj d(k�	r�tj!j"�:�})n
tj!�:�})|)�	sؐ
q|�	s�t#|)tj!�d})t9|)|||#�t;|#d5��	r�|#�<��	q�WdSt=k
�
r0YdSXdS)6Nz-Oz-Pz-Fz-hrz-Vz3Pygments version %s, (c) 2006-2017 by Georg Brandl.z-Lr3�r?r0r1r2r@�sz-H)r0r1r2r!r"T�
inencoding�encoding�outencodingz-Nz-Sz-az-fFz-xz-lz.pyr*zError:z-sz5Error: -s option not usable when input file specified�rbzError: cannot read infile:z-g)�z7Error: when using -s a lexer has to be selected with -lz-o�wbzError: cannot open outfile:Z256ZTERM)Zwin32�cygwin)ZTerminalZTerminal256)�UnclosingTextIOWrapper)rP)Zconvertr#Z	autoresetZwrap�escapeinside�flush)>r+�popr5rr9r:�mainrL�rstrip�lenr=r)r$r%�getrrrCrrZget_style_defsr/�rsplitrr
r�open�read�	Exceptionr	rr�version_info�stdin�bufferr
Z
add_filterrr�os�environrr�stdoutrPr�platformr6�
pygments.utilrVZcolorama.initialise�ImportErrorZ
initialiseZwrap_stream�
isinstancerrr�readline�hasattrrX�KeyboardInterrupt)*�popts�args�usager&ZO_optsZP_optsZF_optsZopt�argZL_optZH_optr;r6Zparsed_optsZp_opt�valuerOrQZinfnr0ZS_optZa_optZf_optZfmter�errZallow_custom_lexer_formatterZ	lexername�filename�codeZinfpr-r.Zoutfnr4Z	fmternameZoutfilerVZcoloramarW�left�right�liner'r'r(�
main_inner�s�









�
�


�
�

��

rzcCszt|dfd}zt�|dd�d�\}}Wn&tjk
rTt|tjd�YdSXzt|||�WStk
�rtdt|�kr�ttjd�td	tjd�td
tjd�tdtjd�tdtjd�td	tjd�ttjd��ddl	}|j
t���}|d
��}t
|�dk�r8|d|d�d�d��dd�7}ttjd�tdtjd�t|tjd�tdtjd�YdSXdS)z(
    Main command line entry point.
    r�r"Nzl:f:F:o:O:P:LS:a:N:vhVHgsxr3rMz-vzA*****************************************************************z3An unhandled exception occurred while highlighting.z9Please report the whole traceback to the issue tracker atz8<https://bitbucket.org/birkenfeld/pygments-main/issues>.���rSz	
   (f%s)����
z*** Error while highlighting:z>*** If this is a bug you want to report, please rerun with -v.)�USAGE�getoptZGetoptErrorr5r9r:rzra�dict�	traceback�format_exception�exc_infor#r\r$)rprqror�rE�msgr'r'r(rZsH���&�rZ)6r7Z
__future__rrer9r��textwraprZpygmentsrrrirrrr	r
rZpygments.lexersrr
rrrrZpygments.lexers.specialrZpygments.formatters.latexrrZpygments.formattersrrrrrZpygments.formatters.terminalrZpygments.formatters.terminal256rZpygments.filtersrrZpygments.stylesrrrr)r/r=rLrz�argvrZr'r'r'r(�<module>s0
  N
3@