
    q"hI*                     0   S 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	J
r
JrJrJrJrJr  SSKJr  SSKJrJr  SSKJrJr  \R0                  " \5      r " S S	\R6                  5      r " S
 S\5      r " S S\R<                  5      r " S S\5      r g)zBase option parser setup    N)suppress)AnyDict	GeneratorListNoReturnOptionalTuple)UNKNOWN_ERROR)ConfigurationConfigurationError)redact_auth_from_url	strtoboolc            	          ^  \ rS rSrSrS\S\SS4U 4S jjrS\R                  S\	4S	 jr
 SS\R                  S
\	S\	S\	4S jjrS\	S\	4S jrS\	S\	4S jrS\\	   S\	4S jrS\\	   S\	4S jrS\	S\	S\	4S jrSrU =r$ )PrettyHelpFormatter   z4A prettier/less verbose help formatter for optparse.argskwargsreturnNc                 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__)selfr   r   	__class__s      J/var/www/html/env/lib/python3.13/site-packages/pip/_internal/cli/parser.pyr    PrettyHelpFormatter.__init__   sG    &("#%&!" 224Q7!;w$)&)    optionc                 $    U R                  U5      $ N)_format_option_strings)r!   r&   s     r#   format_option_strings)PrettyHelpFormatter.format_option_strings   s    **622r%   mvarfmtoptsepc                 $   / nUR                   (       a  UR                  UR                   S   5        UR                  (       a  UR                  UR                  S   5        [        U5      S:  a  UR	                  SU5        UR                  5       (       aj  UR                  c   eUR                  =(       d    UR                  R                  5       nUR                  UR                  UR                  5       5      5        SR                  U5      $ )z
Return a comma-separated list of option strings and metavars.

:param option:  tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string
:param optsep:  separator
r   r    )_short_optsappend
_long_optsleninserttakes_valuedestmetavarlowerformatjoin)r!   r&   r,   r-   optsr7   s         r#   r)   *PrettyHelpFormatter._format_option_strings   s     KK**1-.KK))!,-t9q=KK6";;***nn;(9(9(;GKKw}}78wwt}r%   headingc                     US:X  a  gUS-   $ )NOptionsr/   :
 )r!   r=   s     r#   format_heading"PrettyHelpFormatter.format_heading9   s    ir%   usagec                 p    SR                  U R                  [        R                  " U5      S5      5      nU$ )zb
Ensure there is only one newline between usage and the first heading
if there is no description.
z
Usage: {}
  )r9   indent_linestextwrapdedent)r!   rD   msgs      r#   format_usage PrettyHelpFormatter.format_usage>   s/    
 $$T%6%6xu7Mt%TU
r%   descriptionc                     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mainCommandsDescription
rF   r@   r/   )hasattrparserlstriprstriprG   rH   rI   )r!   rM   labels      r#   format_description&PrettyHelpFormatter.format_descriptionF   st    t{{F++"%%,,T2K%,,.K++HOOK,H$OK"G3{m26Kr%   epilogc                     U(       a  U$ g)Nr/   rA   )r!   rZ   s     r#   format_epilog!PrettyHelpFormatter.format_epilogX   s    Mr%   textindentc                 t    UR                  S5       Vs/ s H  o2U-   PM	     nnSR                  U5      $ s  snf NrR   )splitr:   )r!   r^   r_   line	new_liness        r#   rG    PrettyHelpFormatter.indent_lines_   s8    /3zz$/?@/?td]/?	@yy## As   5rA   )z <{}>z, )__name__
__module____qualname____firstlineno____doc__r   r    optparseOptionstrr*   r)   rB   rK   r	   rX   r\   rG   __static_attributes____classcell__r"   s   @r#   r   r      s    >*c *S *T *3HOO 3 3 NRoo03GJ	4c c 
# # hsm  $HSM c $ $c $c $ $r%   r   c                   L   ^  \ rS rSrSrS\R                  S\4U 4S jjrSr	U =r
$ )UpdatingDefaultsHelpFormatterd   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
r&   r   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)rT   
isinstanceConfigOptionParser_update_defaultsdefaultsr6   getr   expand_defaultr7   rm   listreplacer   )r!   r&   default_values	help_textvalr"   s        r#   r{   ,UpdatingDefaultsHelpFormatter.expand_defaultm   s    ;;"dkk+=>>>>KK(()=)=>;;***![[1155fkkBNG*62	fnn5.#.."0!1 nd33!#%%--c3G3LM	 & r%   rA   )rf   rg   rh   ri   rj   rk   rl   rm   r{   rn   ro   rp   s   @r#   rr   rr   d   s$    X__   r%   rr   c                   t    \ rS rSrS\S\S\S\R                  4S jr\	S\
\R                     4S j5       rSrg	)
CustomOptionParser   idxr   r   r   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popr4   )r!   r   r   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   extend)r!   resis      r#   option_list_all"CustomOptionParser.option_list_all   s;     q!##AJJq}}% $ 
r%   rA   N)rf   rg   rh   ri   intr   rk   OptionGroupr   propertyr   rl   r   rn   rA   r%   r#   r   r      sQ    		"	.1					 hoo!6  r%   r   c                      ^  \ rS rSrSrSS.S\S\S\S\S	S
4
U 4S jjjrS\	R                  S\S\S	\4S jrS	\\\\4   S
S
4   4S jrS\\\4   S	\\\4   4S jrS	\	R"                  4S jrS\S	\4S jrSrU =r$ )rw      zoCustom option parser which updates its defaults by checking the
configuration files and environmental variablesF)isolatedr   namer   r   r   Nc                x   > Xl         [        U5      U l        U R                   (       d   e[        TU ]  " U0 UD6  g r(   )r   r   configr   r    )r!   r   r   r   r   r"   s        r#   r    ConfigOptionParser.__init__   s4     	#H-yyy$)&)r%   r&   keyr   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_valuerk   OptionValueErrorprintsysexit)r!   r&   r   r   excs        r#   check_default ConfigOptionParser.check_default   sK    	%%c//(( 	<SEBCHHQKK	s    A$AAc              #   p  #    SU R                   S/nU Vs0 s H  o"/ _M     nnU R                  R                  5        HS  u  pEU(       d  [        R	                  SU5        M$  UR                  SS5      u  pgXa;   d  M?  X6   R                  Xu45        MU     U H  nX6    H
  u  puXu4v   M     M     g s  snf 7f)Nglobalz:env:z7Ignoring configuration key '%s' as it's value is empty..r   )r   r   itemsloggerdebugrb   r1   )r!   override_orderr   section_itemssection_keyr   sectionr   s           r#    _get_ordered_configuration_items3ConfigOptionParser._get_ordered_configuration_items   s      #DIIw7 "0;
!/"H 	 ;
 !% 1 1 3KM &,,S!4LG(&--sj9 !4 &G)2h 3 &#;
s   B6B1AB6=9B6ry   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.r1   callbackrA   )rk   Valuesry   valuessetr   
get_optionr6   actionr   
ValueErrorerrorr   r   rv   rb   r   r   addget_opt_stringconvert_valuecallback_argscallback_kwargsgetattr)
r!   ry   	late_evalr   r   r&   vopt_strr   r   s
             r#   rx   #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_valuesrk   r   ry   r   loadr   r   r   rm   rx   copy_get_all_optionsr6   rz   rv   r   r   )r!   errry   r&   defaultr   s         r#   get_default_values%ConfigOptionParser.get_default_values  s     **??4==11	/KK ((););)=>++-F;;***ll6;;/G'3'' //1(.(:(:7(L% . x(( " 	/IImSX..	/s   D 
ED??ErJ   c                 t    U R                  [        R                  5        U R                  [        U S35        g ra   )print_usager   stderrr   r   )r!   rJ   s     r#   r   ConfigOptionParser.error$  s(    $		-C5,r%   )r   r   r   )rf   rg   rh   ri   rj   r   rm   boolr    rk   rl   r   r   r
   r   r   rx   r   r   r   r   rn   ro   rp   s   @r#   rw   rw      s    7 	** * 	*
 * 
* *HOO # C C 	5c?D$.	/8>c3h >DcN >@)HOO ),- - - -r%   rw   )!rj   loggingrk   r   r   rH   
contextlibr   typingr   r   r   r   r   r	   r
   pip._internal.cli.status_codesr   pip._internal.configurationr   r   pip._internal.utils.miscr   r   	getLoggerrf   r   IndentedHelpFormatterr   rr   OptionParserr   rw   rA   r%   r#   <module>r      s        
   H H H 8 I D			8	$O$(88 O$d$7 @.. ,L-+ L-r%   