
    *,h\                     h   d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	 ddl
mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZ ddlmZ ddlmZmZ dd	lmZm Z m!Z!m"Z"m#Z# dd
l$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z. d Z/d Z0d Z1d Z2d Z3d Z4 G d dejj                        Z5ejl                  fdZ7y)z
    pygments.cmdline
    ~~~~~~~~~~~~~~~~

    Command line interface.

    :copyright: Copyright 2006-2023 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                 0   i }| s|S | D ]v  }|j                         s|j                  d      }|D ]M  }|j                         }	 |j                  dd      \  }}|j                         }|j                         }|||<   O x |S # t        $ r d||<   Y dw xY w)N,=   T)stripsplit
ValueError)o_strsoptso_stro_argso_argo_keyo_vals          ^/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pip/_vendor/pygments/cmdline.py_parse_optionsr1   !   s    D ${{}S! 		$EKKME$${{32u $U		$	$ K	  #"U#s   5BBBc                     g }| s|S | D ]L  }d|v r3|j                  dd      \  }}|j                  |t        |g      f       :|j                  |i f       N |S )N:r%   )r'   appendr1   )f_strsfiltersf_strfnamefoptss        r0   _parse_filtersr:   6   sh    G (%< ;;sA.LE5NNE>5'#:;<NNE2;'( N    c                     	 | dk(  rBt        |      }t        d|j                  z         t        t        |j                               y| dk(  rBt        |      }t        d|j                  z         t        t        |j                               y| dk(  r7t        |      }t        d|z         t        t        |j                               y# t        t        f$ r! t        d| z  t        j                  	       Y y
w xY w)NlexerzHelp on the %s lexer:	formatterzHelp on the %s formatter:filterzHelp on the %s filter:r   z%s not found!filer%   )r   printnamer   __doc__r   r   AttributeErrorr(   sysstderr)whatrC   clss      r0   _print_helprJ   C   s    7?#D)C)CHH45&%&  [ &t,C-89&%&
 	 X#D)C*T12&%&J' o$3::6s   AC 	AC <C -C=<C=c                    | dk(  rt                t        d       t        d       g }t               D ]L  \  }}}}dj                  |      dz   ||xr ddj                  |      z   dz   xs df}|j                  |       N |j	                          |D ]  }t        d	|z          y | d
k(  rt                t        d       t        d       g }t               D ]p  }t        |      }	dj                  |j                        dz   |	|j                  xr! ddj                  |j                        z   dz   xs df}|j                  |       r |j	                          |D ]  }t        d	|z          y | dk(  rct                t        d       t        d       t               D ]5  }
t        |
      }t        d|
z   dz          t        dt        |      z         7 y | dk(  rct                t        d       t        d       t               D ]5  }
t        |
      }t        d|
z   dz          t        dt        |      z         7 y y )Nr=   zLexers:z~~~~~~~z, r3   z(filenames ) z* %s
    %s %sr>   zFormatters:z~~~~~~~~~~~r?   zFilters:z~~~~~~~~z* z    %sstylezStyles:)rB   r   joinr4   sortr   r   aliases	filenamesr   r   r    r!   )rH   infofullnamenamesexts_tupirI   docrC   s              r0   _print_listr[   W   s0   wii(6(8 	$HeT199U#C'AMDIIdO;cAGRICKK	 			 	+A$)*	+ 
	mm%' 	C$S)C99S[[)C/cmm 7B 499S]]#;;cA7HEGICKK		
 			 	+A$)*	+ 
	jj#% 	6D#D)C$+#$(/445	6
 
ii"$ 	6D#D)C$+#$(/445	6 
r;   c                    dd l }i }d| v r$i }t               D ]  \  }}}}|||d||<    ||d<   d| v rHi }t               D ]4  }t        |      }	|j                  |j
                  |	d||j                  <   6 ||d<   d| v r1i }t               D ]  }
t        |
      }d	t        |      i||
<    ||d
<   d| v r1i }t               D ]  }
t        |
      }d	t        |      i||
<    ||d<   |j                  |t        j                         y )Nr   r=   )rQ   rR   	mimetypeslexersr>   )rQ   rR   rZ   
formattersr?   rZ   r6   rN   styles)jsonr   r   r   rQ   rR   rC   r   r   r    r!   dumprF   stdout)requested_itemsra   resultrS   rT   rU   rR   r]   rI   rZ   rC   s              r0   _print_list_as_jsonrf      sO   F/!5C5E 	1HeY	 &&DN	  xo%%' 	C$S)C;; ]]DN	  $|?"#% 	D#D)C)#.DJ	
 !y/!"$ 	D#D)C)#.DJ	
  xIIfcjj!r;   c                   & j                   r| j                          yj                  rt        dt        z         yfd}j
                  +t               }t              j                         D ]  \  }}|s	|j                  |        |j                  d       |j                  d       |r | j                  t        j                         yj                  st        ddg       h d	&j
                  D cg c]  }|j                  d
       }}t!        &fd|D              r | j                  t        j                         y|s&}j                  s|D ]  }t#        |        yt%        |       yj&                  rg |d      s | j                  t        j                         yj&                  \  }}	|dvr | j                  t        j                         yt)        ||	      S t+        j,                  xs g       }
j.                  xs g D ]  }	 |j1                  dd      \  }	}||
|	<    |
j5                  d|
j5                  d            }|
j5                  d|
j5                  d            }j6                  r6t9        j6                        }|t:        }t        |j<                  d          yj>                  rOt        j@                  jB                  jE                         }	 tG        ||      }t        |j<                  d          yjJ                  }jL                  }|jN                  }|s | j                  t        j                         yjP                  sjR                  r | j                  t        j                         y	 ||
d<   tU        |fi |
}t        |jW                  |xs d             yjL                   | j                  t        j                         ytY        jZ                  xs g       }t]        j^                        }d }jP                  }|rV|rGd|v rC	 d }d }	d|v r|ja                  dd      \  }}	d|	v rd }	|r|	rtc        ||	fi |
}ntc        |fi |
}n	 te        |fi |
}d }jR                  r{jh                  rt        dt        j                         yjR                  }	 tk        |d      5 }|jE                         }d d d        |sto        |      \  }}|s	 tq        ||fi |
}njh                  sWt        j@                  jB                  jE                         }|stu        |t        j@                        \  }}|s,	 tG        |fi |
}n|st        dt        j                         y|D ]  \  }}	  |jv                  |fi |  jx                  }jN                  }|rV|rGd|v rC	 d }d }	d|v r|ja                  dd      \  }}	d|	v rd }	|r|	rt{        ||	fi |
}nt{        |fi |
}n	 tU        |fi |
}|r|s	 t}        |fi |
}	 tk        |d      } n|sgt~        j                  j5                  d d      d!v rt        d+i |
}n9d"t~        j                  j5                  d#d      v rt        d+i |
}nt        d+i |
}t        j                  jB                  } |s(|r||_E        nt        t        j                        |_E        |sat        j                  d$v rO|j                  d%v rAt        | |j                  &      } d |_E        	 dd lJmKc mLc mM}! |!j                  | d d d'd(      } |
j5                  d)d      }"t        |"      dk(  r't        |t              r|"d   }#|"d   }$t        |#|$|      }jh                  s"	 t        ||||        |r| j                          y	 	 t        j@                  jB                  j                         }%|%snJ|stu        |%t        j@                        d   }%t        |%|||        t        | d*      r| j                          u	 |r| j                          yyc c}w # t2        $ r	 d|
|<   Y Nw xY w# tH        $ r
 t:        }Y ~w xY w# tH        $ r%}t        |t        j                         Y d }~yd }~ww xY w# tH        $ r&}t        d|t        j                         Y d }~yd }~ww xY w# tf        tH        f$ r&}t        d|t        j                         Y d }~yd }~ww xY w# 1 sw Y   5xY w# tl        $ r&}t        d|t        j                         Y d }~yd }~ww xY w# tH        $ r`}jr                  r(	 tG        |fi |
}n;# tH        $ r t;        d+i |
}Y n%w xY wt        d|t        j                         Y d }~yY d }~,d }~wtf        $ r&}t        d|t        j                         Y d }~yd }~ww xY w# tH        $ r t;        d+i |
}Y xw xY w# tH        $ r'}t        d|t        j                         Y d }~ yd }~ww xY w# tH        $ r&}t        d|t        j                         Y d }~yd }~ww xY w# tf        tH        f$ r&}t        d|t        j                         Y d }~yd }~ww xY w# tf        tH        f$ r&}t        d|t        j                         Y d }~yd }~ww xY w# tl        $ r&}t        d|t        j                         Y d }~yd }~ww xY w# t        $ r Y w xY w# |r| j                          w w xY w# t        $ r Y |r| j                          yyw xY w# |r| j                          w w xY w),Nr   uW   Pygments version %s, (c) 2006-2023 by Georg Brandl, Matthäus Chajdas and contributors.c                 ^     t         fdt              j                         D               S )Nc              3   4   K   | ]  \  }}|k7  s|  y wN ).0kvopts      r0   	<genexpr>z5main_inner.<locals>.is_only_option.<locals>.<genexpr>   s     GVaa3hqGs   )anyvarsitems)ro   argnss   `r0   is_only_optionz"main_inner.<locals>.is_only_option   s$    GtE{'8'8':GGGGr;   Lra      rM   -V>   r=   rN   r?   r>   sc              3   &   K   | ]  }|v 
 y wrj   rk   )rl   argallowed_typess     r0   rp   zmain_inner.<locals>.<genexpr>   s     9Cs-'9s   H)r=   r>   r?   r$   r%   T
inencodingencodingoutencoding)r~   rN   r@   z.pyr3   zError:z5Error: -s option not usable when input file specifiedrbzError: cannot read infile:z7Error: when using -s a lexer has to be selected with -lwbzError: cannot open outfile:	COLORTERM)	truecolor24bit256TERM)win32cygwin)TerminalTerminal256)r   F)convertr&   	autoresetwrapescapeinsideflushrk   )Zhelp
print_helpVrB   r   rv   setrr   rs   adddiscardrF   rG   ra   mainrstriprq   r[   rf   r}   rJ   r1   OPr'   r(   getNr   r   rQ   Cstdinbufferreadr   r   Safl	INPUTFILEr   get_style_defsr:   Fboolxrsplitr   r   r   ry   open	Exceptionr	   r   gr
   
add_filteror   r   osenvironr   r   r   rc   r   r   platformrC   r   pip._vendor.colorama.initialise_vendorcolorama
initialisewrap_streamImportErrorlen
isinstancer   r   r   closereadlinehasattrr   KeyboardInterrupt)'parserrt   ru   arg_setrm   rn   r{   largsrH   rC   parsed_optsp_optvaluer~   r   r=   inpS_opta_optf_optfmtererrF_optsallow_custom_lexer_formatter	lexernamefilenamecodeinfninfpr8   r9   outfnoutfilecolorama_initialiser   leftrightliner|   s'    `                                    @r0   
main_innerr      so
   zzww *,78 	9H ww%K%%' 	DAqA	 	cjj) zz"dA,1GG4SC449599cjj)!Ezz !C !   & wwc"cjj)WW
d77cjj)4&& !B/K B &	&++c1-KD% !&K& {z/JKJ//-1LMK ww-egg6=EemmA wwii##%	
;E 	emmA GGEGGEcjj)77eoocjj)	#(K )%?;?E
 	e""5;B/0 ww#**% EGGMr*F $(=  E I'EY,>)#%.%5%5c1%=NHd}  $04 @3>@E 1JkJE
))C{C D77Izz#	dD! #Tyy{#
 +D1D* .tTI[I WW yy$$&9$		JD*1#D8K8
 Kzz#  u	EU,e, GGEGGE'EUN%<%*\\#q%9NHd}#4Xt D7BDE 5UJkJE
-eC{C
 25HKH	5$'G
 zz~~k"-1GG2A[A"**..44,;{;)8K8**## 'EN /szz:EN S\\%88zz00(5>>J	OII *55TU 6 OG ??>26L
<A*UN"CAQ"46 77	 dE5'2	 yy''002!5dCIIFqID$ug67G,MMO    Y	 5>  	&!%K	&.  	E	*  	#CJJ'	T ! h#**5  / h#**5# # 	.#**E	 ! 779 +D @K @( 9 ) 8K 89 (Ccjj9 h#**5 ! 1!0K01  	(Ccjj1	2 ! h#**5  / h#**5  / h#**5
  	/3::F	<  		*    ! 	 	  s  ?aa1a* b  9Ab1 <c# d( d(d( e 'g3 hAi i3 %j+ 2k# -l #l% A6l= a'&a'*a=<a= 	b.	b))b.1	c :cc #d2ddd% d( (	e1ee	g0#f>0e=<f>=ff>ff>>g0
g++g03h
h	h>h99h>	i0
i++i03j(j##j(+k :kk #	l,ll	l"!l"%l:=	mm mm m4c                       e Zd ZddZy)HelpFormatterNc                     |"	 t        j                         j                  dz
  }t        j
                  j                  | ||||       y # t        $ r Y /w xY w)Nrw   )shutilget_terminal_sizecolumnsr   argparser   __init__)selfprogindent_incrementmax_help_positionwidths        r0   r   zHelpFormatter.__init__  s\    =002::Q> 	''d4D(95	B  s   !A	 		AA)rw      N)__name__
__module____qualname__r   rk   r;   r0   r   r     s    Br;   r   c                    d}t        j                  |dt              }|j                  d      }|j	                         }|j                  ddd       |j                  d	d
d       |j                  dddd       |j                  ddd       |j                  dddd       |j                  dddd       |j                  ddd       |j                  ddd !       |j                  d"      }|j                  d#d
d$       |j                  d%d
d&       |j                  d'd
d(       |j                  d)d*dd
+       |j                  d,      }|j	                         }|j                  d-d.d/       |j                  d0d1d2d34       |j                  d5d6d7       |j                  d8d
d9       |j                  d:d;d<d=d>?       |j                  d@d
dA       |j                  dBdCd
dD       |j                  dEdFdG       |j                  | dHdI       }	 t        ||      S # t        $ r Y yJt        $ r |j                  rt        t        j                  K       t        dLt        j                  K       t        dMt        j                  K       t        dNt        j                  K       t        dOt        j                  K       t        dLt        j                  K       t        t        j                  K        dJdIl}	 |	j                  t        j                           }
|
dP   j#                         }t%        |
      dQk\  r.|dR|
dS   j'                  dT      dJ   j#                         dHdI z  z  }t        t        j                  K       t        dUt        j                  K       t        |t        j                  K       t        dVt        j                  K       Y yHw xY w)Wz(
    Main command line entry point.
    z?Highlight an input file and write the result to an output file.F)descriptionadd_helpformatter_classzMain operationz-lLEXERz~Specify the lexer to use.  (Query names with -L.)  If not given and -g is not present, the lexer is guessed from the filename.)metavarr   z-g
store_truez`Guess the lexer from the file contents, or pass through as plain text if nothing can be guessed.)actionr   z-FzFILTER[:options]r4   znAdd a filter to the token stream.  (Query names with -L.) Filter options are given after a colon if necessary.)r   r   r   z-f	FORMATTERzSpecify 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-OzOPTION=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=valuezGive 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-o
OUTPUTFILEz8Where to write the output.  Defaults to standard output.r   ?z5Where to read the input.  Defaults to standard input.)nargsr   zOperation 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.)r   defaultr   z*Special modes - do not do any highlightingz-SzSTYLE -f formatterzqPrint style definitions for STYLE for a formatter given with -f. The argument given by -a is formatter dependent.z-L*WHATzList 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   r   z-NFILENAMEzGuess 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storerw   )NAMETYPEzrPrint detailed help for the object <name> of type <type>, where <type> is one of "lexer", "formatter" or "filter".)r   r   r   r   rx   zPrint the package version.z-hz--helpzPrint this help.z-aARGzKFormatter-specific additional argument for the -S (print style sheet) mode.r%   Nr   r@   zA*****************************************************************z3An unhandled exception occurred while highlighting.z9Please report the whole traceback to the issue tracker atz.<https://github.com/pygments/pygments/issues>.   z	
   (f%s)
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   rn   rB   rF   rG   	tracebackformat_exceptionexc_infor&   r   r'   )argsdescr   	operationlexerselflagsspecial_modes_groupspecial_modesrt   r  rS   msgs               r0   r   r     sU    MD$$5BDF ))*:;I557HgO  P \3  4 (?  @ k1  2 7.  /
 nXD  E
 lG  I 3D  F %%&78E	\3  4 
\C  D 
\6  7 
x '/  
 !3346'DDFM*  
 C<  =
 j6  7
 \/  0 WA/?C  D \)  + h|  ! $$e % 
 d12h'E&%((  77szz"(,Gzz#Mzz#Bzz#(,szz")y))3<<>:2hnnt9><$r(.."6q"9"?"?"A!""EEEC3::-CJJ?c

#N::	1s   H+ +	O)6F0O)(O))8rD   r   rF   r   r   textwrapr   pip._vendor.pygmentsr   r   pip._vendor.pygments.utilr   r   r   r	   r
   r   r   pip._vendor.pygments.lexersr   r   r   r   r   r   #pip._vendor.pygments.lexers.specialr   %pip._vendor.pygments.formatters.latexr   r   pip._vendor.pygments.formattersr   r   r   r   r   (pip._vendor.pygments.formatters.terminalr   +pip._vendor.pygments.formatters.terminal256r   r   pip._vendor.pygments.filtersr   r   pip._vendor.pygments.stylesr    r!   r1   r:   rJ   r[   rf   r   r   argvr   rk   r;   r0   <module>r     s    
 
    7  P P 9 TO O F h K I*
(06f*"XL ^
BH** B hh Lr;   