HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/pygments/__pycache__/cmdline.cpython-310.pyc
o

;j�[�@sLdZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZmZmZddlmZmZmZmZmZmZddlmZddlmZmZdd	lmZm Z m!Z!m"Z"m#Z#dd
l$m%Z%ddl&m'Z'm(Z(ddl)m*Z*m+Z+dd
l,m-Z-m.Z.dd�Z/dd�Z0dd�Z1dd�Z2dd�Z3dd�Z4Gdd�dej5�Z5ej6fdd�Z7dS)z�
    pygments.cmdline
    ~~~~~~~~~~~~~~~~

    Command line interface.

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�dedent)�__version__�	highlight)�
ClassNotFound�OptionError�docstring_headline�guess_decode�guess_decode_from_terminal�terminal_encoding�UnclosingTextIOWrapper)�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�TerminalTrueColorFormatter)�get_all_filters�find_filter_class)�get_all_styles�get_style_by_namec
Cs�i}|s|S|D]9}|��sq|�d�}|D]*}|��}z|�dd�\}}|��}|��}Wn
ty;d||<Yqw|||<qq|S)N�,�=�T)�strip�split�
ValueError)Zo_strs�optsZo_strZo_argsZo_argZo_keyZo_val�r(�D/opt/saltstack/salt/lib/python3.10/site-packages/pygments/cmdline.py�_parse_options!s&
�
�
r*cCsVg}|s|S|D] }d|vr!|�dd�\}}|�|t|g�f�q|�|if�q|S)N�:r#)r%�appendr*)Zf_strs�filtersZf_str�fname�foptsr(r(r)�_parse_filters6sr0c	Cs�zP|dkrt|�}td|j�d��tt|j��WdS|dkr7t|�}td|j�d��tt|j��WdS|dkrNt|�}td|�d��tt|j��WdSttfyft|�d	�t	j
d
�YdSw)N�lexerzHelp on the z lexer:�	formatterz formatter:�filterz filter:rz not found!��filer#)r
�print�namer�__doc__rr�AttributeErrorr&�sys�stderr)�whatr7�clsr(r(r)�_print_helpCs(	���r>cCs�|dkrGt�td�td�g}t�D] \}}}}d�|�d||r,dd�|�dp-df}|�|�q|��|D]	}td	j|��q;dS|d
kr�t�td�td�g}t�D]#}t|�}	d�|j�d|	|j	rvdd�|j	�dpwdf}|�|�q[|��|D]	}td	j|��q�dS|d
kr�t�td�td�t
�D]}
t|
�}td|
d�tdt|����q�dS|dkr�t�td�td�t�D]}
t
|
�}td|
d�tdt|����q�dSdS)Nr1zLexers:z~~~~~~~z, r+z(filenames �)�z* {}
    {} {}r2zFormatters:z~~~~~~~~~~~r3zFilters:z~~~~~~~~z* z    �stylezStyles:)r6r�joinr,�sort�formatrr�aliases�	filenamesrrrr )r<�info�fullname�namesZexts�_�tup�ir=�docr7r(r(r)�_print_listWsd��
���
�
�rNcCsddl}i}d|vr"i}t�D]\}}}}|||d�||<q||d<d|vrAi}t�D]}t|�}	|j|j|	d�||j<q+||d<d|vr]i}t�D]}
t|
�}d	t|�i||
<qJ||d
<d|vryi}t	�D]}
t
|
�}d	t|�i||
<qf||d<|�|tj
�dS)
Nrr1)rErF�	mimetypesZlexersr2)rErFrMZ
formattersr3rMr-rAZstyles)�jsonrrrrErFr7rrrr �dumpr:�stdout)Zrequested_itemsrP�resultrGrHrIrFrOr=rMr7r(r(r)�_print_list_as_json�sD�
�

�

�rTc&s�
�jr	|��dS�jrtdt�d��dS�fdd�}�jdur�t�}t����D]\}}|r5|�	|�q*|�
d�|�
d�|rJ|�tj�dS�j
sStd	d
g�hd��dd
��jD�}t�fdd�|D��rr|�tj�dS|sv�}�j
s�|D]}t|�q{dSt|�dS�jr�|d�s�|�tj�dS�j\}}	|dvr�|�tj�dSt||	�St�jp�g�}
�jp�gD]}z
|�dd�\}	}Wn
ty�d|
|<Yq�w||
|	<q�|
�d|
�d��}
|
�d|
�d��}�j�rt�j�}|dur�t}t|jd�dS�j�r,tjj �!�}zt"||
d�}Wnt#�y"t}Ynwt|jd�dS�j$}�j%}|du�r��j&}|�sE|�tj�dS�j'�sM�j(�rU|�tj�dSz||
d<t)|fi|
��}Wnt#�y~}zt|tjd�WYd}~dSd}~wwt|�*|�p�d	��dS�j%du�r�|�tj�dSt+�j,�p�g�}t-�j.�}d}�j'}|�r.|�rd|v�rz2d}d}	d|v�r�|�/dd�\}}	d|	v�r�d}	|�r�|	�r�t0||	fi|
��}nt0|fi|
��}WnEt#�y}ztd|tjd�WYd}~dSd}~wwz
t1|fi|
��}Wnt2t#f�y-}ztd|tjd�WYd}~dSd}~wwd}�j(�r�j3�rAtdtjd�dS�j(}zt4|d��}|�!�}Wd�n	1�sZwYWnt5�y|}ztd |tjd�WYd}~dSd}~ww|
�s�t6|�\}}
|�s�zt7||fi|
��}Wn�t#�y�}z5�j8�r�z
t"|fi|
��}Wn t#�y�td/i|
��}Ynwtd|tjd�WYd}~dSWYd}~nbd}~wt2�y�}ztd|tjd�WYd}~dSd}~wwnA�j3�s(tjj �!�}|
�st9|tj�\}}
|�s'z
t"|fi|
��}Wnt#�y&td/i|
��}Ynwn|�s4td!tjd�dS|D]-\}}z|j:|fi|��W�q6t#�yc}ztd|tjd�WYd}~dSd}~ww�j;}�j&}|�r�|�r�d|v�r�z2d}d}	d|v�r�|�/dd�\}}	d|	v�r�d}	|�r�|	�r�t<||	fi|
��}nt<|fi|
��}WnEt#�y�}ztd|tjd�WYd}~dSd}~wwz
t)|fi|
��}Wnt2t#f�y�}ztd|tjd�WYd}~dSd}~ww|�r@|�sz
t=|fi|
��}Wnt2t#f�y}ztd|tjd�WYd}~dSd}~wwzt4|d"�} WnNt5�y?}ztd#|tjd�WYd}~dSd}~ww|�snt>j?�d$d	�d%v�rUt@d/i|
��}nd&t>j?�d'd	�v�rgtAd/i|
��}ntBd/i|
��}tjCj } |�s�|�r||
|_DntEtjC�|_D|�s�tjFd(v�r�|jGd)v�r�tH| |jDd*�} d|_DzddlI}!Wn
tJ�y�Ynw|!jKjL| ddd+dd,�} |
�d-d	�}"tM|"�dk�r�tN|tO��r�|"d}#|"d}$tP|#|$|�}�j3�s�ztQ|||| �W|�r�| �R�dS|�r�| �R�wwzLz6	tjj �S�}%|%�sn|
�st9|%tj�d}%tQ|%||| �tT| d.��r | �U��q�WW|�r-| �R�dSdStV�yCYW|�rA| �R�dSdSw|�rL| �R�ww)0NrzPygments version uG, (c) 2006-present by Georg Brandl, Matthäus Chajdas and contributors.cs t�fdd�t����D��S)Nc3s �|]\}}|�kr|VqdS�Nr()�.0�k�v��optr(r)�	<genexpr>�s�z5main_inner.<locals>.is_only_option.<locals>.<genexpr>)�any�vars�itemsrY)�argnsrYr)�is_only_option�s z"main_inner.<locals>.is_only_option�LrP�r@�-V>r3r2r1rAcSsg|]}|�d��qS)�s)�rstrip�rV�argr(r(r)�
<listcomp>�szmain_inner.<locals>.<listcomp>c3s�|]}|�vVqdSrUr(rf)�
allowed_typesr(r)r[�s�zmain_inner.<locals>.<genexpr>�H)r1r2r3r"r#T�
inencoding�encoding�outencoding)rkrAr4z.pyr+zError:z5Error: -s option not usable when input file specified�rbzError: cannot read infile:z7Error: when using -s a lexer has to be selected with -l�wbzError: cannot open outfile:Z	COLORTERM)Z	truecolorZ24bitZ256ZTERM)�win32�cygwin)ZTerminalZTerminal256)rlF)�convertr$Z	autoreset�wrap�escapeinside�flushr()W�help�
print_help�Vr6rra�setr]r^�add�discardr:r;rP�mainr\rNrTrjr>r*�O�Pr%r&�get�NrrrE�C�stdin�buffer�readrr�S�a�f�l�	INPUTFILErZget_style_defsr0�F�bool�x�rsplitrr
rrd�open�	Exceptionrr�gr	Z
add_filter�orr�os�environrrrrRrlr
�platformr7rZcolorama.initialise�ImportErrorZ
initialiseZwrap_stream�len�
isinstancerrr�close�readline�hasattrru�KeyboardInterrupt)&�parserr_r`Zarg_setrWrXZlargsrgr<r7Zparsed_optsZp_opt�valuerkrmr1�inpZS_optZa_optZf_optZfmter�errZF_optsZallow_custom_lexer_formatterZ	lexername�filename�codeZinfn�infpr.r/ZoutfnZoutfileZcoloramart�left�right�liner()rir_r)�
main_inner�sD

�


�

�

�
��



�������
��������������


�����������
��
��	����
�r�c@seZdZddd�ZdS)�
HelpFormatterrb�NcCsF|durz	t��jd}Wn	tyYnwtj�|||||�dS)Nrb)�shutil�get_terminal_size�columnsr��argparser��__init__)�self�prog�indent_increment�max_help_position�widthr(r(r)r�s��zHelpFormatter.__init__)rbr�N)�__name__�
__module__�__qualname__r�r(r(r(r)r�sr�c	Cs�d}tj|dtd�}|�d�}|��}|jdddd�|jd	d
dd�|jd
dddd�|jdddd�|jddddd�|jddddd�|jdddd�|jddd d!�|�d"�}|jd#d
d$d�|jd%d
d&d�|jd'd
d(d�|jd)d*dd
d+�|�d,�}|��}|jd-d.d/d�|jd0d1d2d3d4�|jd5d6d7d�|jd8d
d9d�|jd:d;d<d=d>d?�|jd@d
dAd�|jdBdCd
dDd�|jdEdFdGd�|�|dHdI��}zt||�WSty�YdJSt	�yg|j
�rttj
dK�tdLtj
dK�tdMtj
dK�tdNtj
dK�tdOtj
dK�tdLtj
dK�ttj
dK��dJdIl}	|	jt���}
|
dP��}t|
�dQk�rI|dR�|
dS�dT�dJ��dHdI��7}ttj
dK�tdUtj
dK�t|tj
dK�tdVtj
dK�YdHSw)Wz(
    Main command line entry point.
    z?Highlight an input file and write the result to an output file.F)�description�add_help�formatter_classzMain operationz-lZLEXERz~Specify the lexer to use.  (Query names with -L.)  If not given and -g is not present, the lexer is guessed from the filename.)�metavarrvz-g�
store_truez`Guess the lexer from the file contents, or pass through as plain text if nothing can be guessed.)�actionrvz-FzFILTER[:options]r,znAdd a filter to the token stream.  (Query names with -L.) Filter options are given after a colon if necessary.)r�r�rvz-fZ	FORMATTERz�Specify the formatter to use.  (Query names with -L.) If not given, the formatter is guessed from the output filename, and defaults to the terminal formatter if the output is to the terminal or an unknown file extension.z-OzOPTION=value[,OPTION=value,...]zyGive options to the lexer and formatter as a comma-separated list of key-value pairs. Example: `-O bg=light,python=cool`.z-PzOPTION=valuez�Give a single option to the lexer and formatter - with this you can pass options whose value contains commas and equal signs. Example: `-P "heading=Pygments, the Python highlighter"`.z-oZ
OUTPUTFILEz8Where to write the output.  Defaults to standard output.r��?z5Where to read the input.  Defaults to standard input.)�nargsrvzOperation flagsz-vzbPrint a detailed traceback on unhandled exceptions, which is useful for debugging and bug reports.z-sa!Process lines one at a time until EOF, rather than waiting to process the entire file.  This only works for stdin, only for lexers with no line-spanning constructs, and is intended for streaming input such as you get from `tail -f`. Example usage: `tail -f sql.log | pygmentize -s -l sql`.z-xa�Allow 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.z--jsonz=Output as JSON. This can be only used in conjunction with -L.)rv�defaultr�z*Special modes - do not do any highlightingz-SzSTYLE -f formatterzqPrint style definitions for STYLE for a formatter given with -f. The argument given by -a is formatter dependent.z-L�*ZWHATz�List lexers, formatters, styles or filters -- give additional arguments for the thing(s) you want to list (e.g. "styles"), or omit them to list everything.)r�r�rvz-NZFILENAMEz�Guess and print out a lexer name based solely on the given filename. Does not take input or highlight anything. If no specific lexer can be determined, "text" is printed.z-CzXLike -N, but print out a lexer name based solely on a given content from standard input.z-H�storerb)�NAMEZTYPEzrPrint detailed help for the object <name> of type <type>, where <type> is one of "lexer", "formatter" or "filter".)r�r�r�rvrczPrint the package version.z-hz--helpzPrint this help.z-aZARGzKFormatter-specific additional argument for the -S (print style sheet) mode.r#Nrr4zA*****************************************************************z3An unhandled exception occurred while highlighting.z9Please report the whole traceback to the issue tracker atz.<https://github.com/pygments/pygments/issues>.����z	
   (f{})����
z*** Error while highlighting:z>*** If this is a bug you want to report, please rerun with -v.)r��ArgumentParserr��add_argument_group�add_mutually_exclusive_group�add_argument�
parse_argsr��BrokenPipeErrorr�rXr6r:r;�	traceback�format_exception�exc_infor$r�rDr%)�args�descr�Z	operationZlexersel�flagsZspecial_modes_groupZ
special_modesr_r�rG�msgr(r(r)r|s��
��������
���	�������������(��r|)8r8r�r:r�r��textwraprZpygmentsrrZ
pygments.utilrrrrr	r
rZpygments.lexersrr
rrrrZpygments.lexers.specialrZpygments.formatters.latexrrZpygments.formattersrrrrrZpygments.formatters.terminalrZpygments.formatters.terminal256rrZpygments.filtersrrZpygments.stylesrr r*r0r>rNrTr�r��argvr|r(r(r(r)�<module>s4
$ 
3,Q