
    'jC7                    h   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSKJr  SSKJrJr  SSKJr  SSKJr  SS	KJr  SS
KJrJr  SSKJr  SSKJrJr  \R>                  " \ 5      r! " S S\RD                  5      r# " S S\#5      r$ " S S\RJ                  5      r& " S S\&5      r'g)zBase option parser setup    )annotationsN)	Generator)suppress)AnyNoReturnescape)Theme)UNKNOWN_ERROR)ConfigurationConfigurationError)
PipConsole)redact_auth_from_url	strtoboolc                     ^  \ rS rSrSrSSSSS.rSS	S
.rSU 4S jjrSS jrSS jr	SS jr
SS jrSS jrSS jrSU 4S jjrSS jrSrU =r$ )PrettyHelpFormatter   z4A prettier/less verbose help formatter for optparse.greencyanz	bold blueyellow)zoptparse.shortargszoptparse.longargszoptparse.groupszoptparse.metavar	shortargslongargs)z\s(-{1}[\w]+[\w-]*)z\s(-{2}[\w]+[\w-]*)c                v   > SUS'   SUS'   [         R                  " 5       S   S-
  US'   [        TU ]  " U0 UD6  g )N   max_help_position   indent_incrementr      width)shutilget_terminal_sizesuper__init__)selfargskwargs	__class__s      P/var/www/html/KUNJ/venv/lib/python3.13/site-packages/pip/_internal/cli/parser.pyr#   PrettyHelpFormatter.__init__)   sG    &("#%&!" 224Q7!;w$)&)    c                0   / nUR                   (       a"  UR                  SUR                   S    S35        UR                  (       a"  UR                  SUR                  S    S35        [        U5      S:  a  UR	                  SS5        UR                  5       (       ah  UR                  c   eUR                  =(       d    UR                  R                  5       nUR                  S[        UR                  5       5       S35        S	R                  U5      $ )
z=Return a comma-separated list of option strings and metavars.z[optparse.shortargs]r   z[/]z[optparse.longargs]r   z, z [optparse.metavar]<z>[/] )_short_optsappend
_long_optsleninserttakes_valuedestmetavarlowerr	   join)r$   optionoptsr4   s       r(   format_option_strings)PrettyHelpFormatter.format_option_strings0   s    KK.v/A/A!/D.ESIJKK-f.?.?.B-C3GHt9q=KK4 ;;***nn;(9(9(;GKK.vgmmo/F.GtLMwwt}r*   c           	        / nU R                   U   nU R                  U R                  -
  S-
  n[        R                  " SSU5      n[        U5      [        U5      -
  n[        U5      U:  a  SU R                  SU4-  nU R                  nOSU R                  SXF-   U4-  nSnUR                  U5        UR                  (       a  U R                  U5      n[        R                  " XR                  5      n	UR                  SUSU	S   4-  5        UR                  U	SS  V
s/ s H  n
SU R                  SU
4-  PM     sn
5        OUS	   S
:w  a  UR                  S
5        SR                  U5      $ s  sn
f )z$Overridden method with Rich support.r   z(\[[a-z.]+\])|(\[\/\])r,   z%*s%s
z	%*s%-*s  r   r   N
)option_stringshelp_positioncurrent_indentresubr0   r.   helpexpand_defaulttextwrapwrap
help_widthextendr6   )r$   r7   resultr8   	opt_widthstrippedstyle_tag_lengthindent_first	help_text
help_lineslines              r(   format_option!PrettyHelpFormatter.format_optionB   sm    ""6*&&)<)<<q@	 663R>t9s8}4x=9$ 3 3R>>D--L$"5"5r"+">"F FDLd;;++F3I!y//BJMM)|RA&GGHMM'1!"~7'5t %(:(:B'EE'57 8"XMM$wwv	7s   !E0c                2    US:X  a  gS[        U5      -   S-   $ )NOptionsr,   z[optparse.groups]z:[/]
r   )r$   headings     r(   format_heading"PrettyHelpFormatter.format_heading`   s!    i"VG_4x??r*   c                p    U R                  [        R                  " U5      S5      nS[        U5       S3nU$ )zb
Ensure there is only one newline between usage and the first heading
if there is no description.
  z
[optparse.groups]Usage:[/] r=   )indent_linesrE   dedentr	   )r$   usagecontentsmsgs       r(   format_usage PrettyHelpFormatter.format_usagee   s8    
 $$X__U%;TB-fX.>-?rB
r*   c                    U(       aq  [        U R                  S5      (       a  SnOSnUR                  S5      nUR                  5       nU R	                  [
        R                  " U5      S5      nU SU S3nU$ g)Nmainz[optparse.groups]Commands:[/]z [optparse.groups]Description:[/]r=   rY   r,   )hasattrparserlstriprstriprZ   rE   r[   )r$   descriptionlabels      r(   format_description&PrettyHelpFormatter.format_descriptionn   sv    t{{F++7: &,,T2K%,,.K++HOOK,H$OK"G2k]"5Kr*   c                (    U(       a  [        U5      $ g)Nr,   r   )r$   epilogs     r(   format_epilog!PrettyHelpFormatter.format_epilog   s    &>!r*   c                   > [        [        TU ]	  U5      5      nU R                  R	                  5        H!  u  p4[
        R                  " USU S3U5      nM#     U$ )z@Overridden HelpFormatter.expand_default() which colorizes flags.z
[optparse.z] \1[/])r	   r"   rD   
highlightsitemsrA   rB   )r$   r7   rC   regexstyler'   s        r(   rD   "PrettyHelpFormatter.expand_default   sP    eg,V45 OO113LE66%JugW!=tDD 4r*   c                t    UR                  S5       Vs/ s H  o2U-   PM	     nnSR                  U5      $ s  snf Nr=   )splitr6   )r$   textindentrP   	new_liness        r(   rZ    PrettyHelpFormatter.indent_lines   s8    /3zz$/?@/?td]/?	@yy## As   5 )r%   r   r&   r   returnNoner7   optparse.Optionr}   str)rU   r   r}   r   )r\   r   r}   r   )rg   
str | Noner}   r   )rl   r   r}   r   )rx   r   ry   r   r}   r   )__name__
__module____qualname____firstlineno____doc__stylesrp   r#   r9   rQ   rV   r_   ri   rm   rD   rZ   __static_attributes____classcell__r'   s   @r(   r   r      s]    > &#&$	F !, *J
*$<@
&$ $r*   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )UpdatingDefaultsHelpFormatter   zCustom help formatter for use in ConfigOptionParser.

This is updates the defaults before expanding them, allowing
them to show up correctly in the help listing.

Also redact auth from url type options
c                4  > S nU R                   b  [        U R                   [        5      (       d   eU R                   R                  U R                   R                  5        UR
                  c   eU R                   R                  R                  UR
                  5      n[        TU ]!  U5      nU(       ac  UR                  S:X  aS  [        U[        5      (       a  U/n[        U[        5      (       d  / nU H  nUR                  U[        U5      5      nM      U$ )NURL)rd   
isinstanceConfigOptionParser_update_defaultsdefaultsr3   getr"   rD   r4   r   listreplacer   )r$   r7   default_valuesrN   valr'   s        r(   rD   ,UpdatingDefaultsHelpFormatter.expand_default   s    ;;"dkk+=>>>>KK(()=)=>;;***![[1155fkkBNG*62	fnn5.#.."0!1 nd33!#%%--c3G3LM	 & r*   r|   r   )r   r   r   r   r   rD   r   r   r   s   @r(   r   r      s     r*   r   c                  B    \ rS rSr        SS jr\SS j5       rSrg)CustomOptionParser   c                    U R                   " U0 UD6nU R                  R                  5         U R                  R                  X5        U$ )z*Insert an OptionGroup at a given position.)add_option_groupoption_groupspopr1   )r$   idxr%   r&   groups        r(   insert_option_group&CustomOptionParser.insert_option_group   sD     %%t6v6 !!#-r*   c                    U R                   SS nU R                   H  nUR                  UR                   5        M      U$ )z<Get a list of all options, including those in option groups.N)option_listr   rH   )r$   resis      r(   option_list_all"CustomOptionParser.option_list_all   s;     q!##AJJq}}% $ 
r*   r|   N)r   intr%   r   r&   r   r}   zoptparse.OptionGroup)r}   zlist[optparse.Option])r   r   r   r   r   propertyr   r   r|   r*   r(   r   r      s;    		"	.1			  r*   r   c                     ^  \ rS rSrSrSS.         SU 4S jjjrSS jr  SS jrSS jrSS	 jr	SS
 jr
SSS jjrSSS jjrSSS jjrSrU =r$ )r      zoCustom option parser which updates its defaults by checking the
configuration files and environmental variablesF)isolatedc               x   > Xl         [        U5      U l        U R                   (       d   e[        TU ]  " U0 UD6  g N)namer   configr"   r#   )r$   r   r   r%   r&   r'   s        r(   r#   ConfigOptionParser.__init__   s4     	#H-yyy$)&)r*   c                     UR                  X#5      $ ! [        R                   a.  n[        SU 35        [        R
                  " S5         S nAg S nAff = f)Nz(An error occurred during configuration:    )check_valueoptparseOptionValueErrorprintsysexit)r$   r7   keyr   excs        r(   check_default ConfigOptionParser.check_default   sK    	%%c//(( 	<SEBCHHQKK	s    A$AAc              #    #    SU R                   S/nU Vs0 s H  o"0 _M     nnU R                  R                  5        H@  u  pEUR                  5        H'  u  pgUR                  SS5      u  pX;   d  M   XsU   U	'   M)     MB     U VV
Vs0 s H5  nX#U   R                  5        V
Vs/ s H  u  pU(       d  M  X4PM     snn
_M7     nn
nnU H  nX    S h  vN   M     g s  snf s  snn
f s  snn
nf  N7f)Nglobalz:env:.r   )r   r   rq   rw   )r$   override_orderr   section_items_dict_valuesection_keyr   sectionr   kvsection_itemss                r(    _get_ordered_configuration_items3ConfigOptionParser._get_ordered_configuration_items   s     #DIIw7 "09
!/"H 	 9
 ))+HA$)KKM *00a8,7:w/4	 %2 , '
& &>&D&D&FL&Fda!6A6&FLL& 	 
 &G$--- &'9
 M
 .sL   C2CAC23C2C)$C#5C#<C)C2C0C2#C))C2c           	     &   [         R                  " U R                  5      U l        [	        5       nU R                  5        GH  u  p4U R                  SU-   5      nUc  M  UR                  c   eUR                  S;   a   [        U5      nGOzUR                  S:X  ay  [        [        5         [        U5      nSSS5        [        [        5         [        U5      nSSS5        [        U[        5      (       a  US:  a  U R                  U SU S35        OUR                  S	:X  a2  UR                  5       nU Vs/ s H  o`R!                  XSU5      PM     nnOUR                  S
:X  a  UR"                  c   eUR%                  UR                  5        UR'                  5       nUR)                  Xt5      nUR*                  =(       d    SnUR,                  =(       d    0 n	UR"                  " XWX@/UQ70 U	D6  OU R!                  XSU5      nXAUR                  '   GM     U H  n[/        U R                  U5      X'   M     SU l        U$ ! [         a    U R                  U SU S35         N`f = f! , (       d  f       GN= f! , (       d  f       GN= fs  snf )zUpdates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists).z--N)
store_truestore_falsez is not a valid value for zO option, please specify a boolean value like yes/no, true/false or 1/0 instead.countr   z option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.r.   callbackr|   )r   Valuesr   valuessetr   
get_optionr3   actionr   
ValueErrorerrorr   r   r   rw   r   r   addget_opt_stringconvert_valuecallback_argscallback_kwargsgetattr)
r$   r   	late_evalr   r   r7   r   opt_strr%   r&   s
             r(   r   #ConfigOptionParser._update_defaults  s;    oodmm4E	==?HC__TCZ0F
 ~;;***}} ==#C.C ')j)#C.C *j)c(C *!#s++sQwJJ%9# ?6 6 (*iikCFG3a))&q93G*,222fkk* //1**78++1r//52LTLVL((c:$'V[[!a @d C#DKK5HM M " JJ%9# ?5 5 *))) Hs0   ?I+I*I<9J!I'&I'*
I9	<
J	c                   U R                   (       d   [        R                  " U R                  5      $  U R                  R                  5         U R                  U R                  R                  5       5      nU R                  5        Hq  nUR                  c   eUR                  UR                  5      n[        U[        5      (       d  MD  UR!                  5       nUR#                  XT5      X#R                  '   Ms     [        R                  " U5      $ ! [         a)  nU R                  [        [        U5      5         SnANSnAff = f)zOverriding to make updating the defaults after instantiation of
the option parser possible, _update_defaults() does the dirty work.N)process_default_valuesr   r   r   r   loadr   r   r   r   r   copy_get_all_optionsr3   r   r   r   r   )r$   errr   r7   defaultr   s         r(   get_default_values%ConfigOptionParser.get_default_valuesA  s     **??4==11	/KK ((););)=>++-F;;***ll6;;/G'3'' //1(.(:(:7(L% . x(( " 	/IImSX..	/s   D 
ED??Ec                t    U R                  [        R                  5        U R                  [        U S35        g rv   )print_usager   stderrr   r   )r$   r^   s     r(   r   ConfigOptionParser.errorW  s(    $		-C5,r*   c                "   S[         R                  ;   =(       dU    [        [        [        R
                  R                  SS5      =(       d    S5      5      =(       d    S[        R
                  ;   n[        [        [        R                  5      X!S9$ )Nz
--no-colorPIP_NO_COLORnoNO_COLOR)themeno_colorfile)r   argvboolr   osenvironr   r   r
   r   r   )r$   r   r   s      r(   _create_console_for_help+ConfigOptionParser._create_console_for_help[  sl     CHH$ (Ibjjnn^TBJdKL(RZZ' 	
 +223h
 	
r*   c                    U R                   (       a0  U R                  U5      nUR                  U R                  5       SS9  g g NF)	highlight)r\   r   r   	get_usager$   r   consoles      r(   r   ConfigOptionParser.print_usageg  s5    ::33D9GMM$..*eM< r*   c                ~    U R                  U5      nUR                  U R                  5       R                  5       SS9  g r   )r   r   format_helprf   r  s      r(   
print_helpConfigOptionParser.print_helpl  s4    //5d&&(//1UCr*   )r   r   r   )
r%   r   r   r   r   r   r&   r   r}   r~   )r7   r   r   r   r   r   r}   r   )r}   z&Generator[tuple[str, Any], None, None])r   dict[str, Any]r}   r
  )r}   zoptparse.Values)r^   r   r}   r   r   )r   r   r}   r   )r   r   r}   r~   )r   r   r   r   r   r#   r   r   r   r   r   r   r   r  r   r   r   s   @r(   r   r      s    7 	** * 	*
 * 
* *.	/.>>@),-

=
D Dr*   r   )(r   
__future__r   loggingr   r   rA   r    r   rE   collections.abcr   
contextlibr   typingr   r   pip._vendor.rich.markupr	   pip._vendor.rich.themer
   pip._internal.cli.status_codesr   pip._internal.configurationr   r   pip._internal.utils.loggingr   pip._internal.utils.miscr   r   	getLoggerr   loggerIndentedHelpFormatterr   r   OptionParserr   r   r|   r*   r(   <module>r     s     "   	 	  
  %    * ( 8 I 2 D			8	$v$(88 v$r$7 @.. ,dD+ dDr*   