
    q"h&&                         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  S SK	J
r
  S SKJrJr  S SKJrJrJrJr  S SKJr  S SKJr  S S	KJrJr  \ R4                  " \5      r " S
 S\
5      rg)    N)Values)AnyListOptional)Command)ERRORSUCCESS)ConfigurationKindget_configuration_fileskinds)PipError)
indent_log)get_progwrite_outputc                   b   \ rS rSrSrSrSrSS jrS\S	\	\
   S\4S
 jrS\S\S\\   4S jrS\S	\	\
   SS4S jrS\S	\	\
   SS4S jrS\S	\	\
   SS4S jrS\S	\	\
   SS4S jrS\S	\	\
   SS4S jrS\SS4S jrSS jrS\S	\	\
   SS4S jrS	\	\
   S\
S\S\4S jrSS jrS\S\
4S jrSrg)ConfigurationCommand   a  
Manage local and global configuration.

Subcommands:

- list: List the active configuration (or from the file specified)
- edit: Edit the configuration file in an editor
- get: Get the value associated with command.option
- set: Set the command.option=value
- unset: Unset the value associated with command.option
- debug: List the configuration files and values defined under them

Configuration keys should be dot separated command and option name,
with the special prefix "global" affecting any command. For example,
"pip config set global.index-url https://example.org/" would configure
the index url for all commands, but "pip config set download.timeout 10"
would configure a 10 second timeout only for "pip download" commands.

If none of --user, --global and --site are passed, a virtual
environment configuration file is used if one is active and the file
exists. Otherwise, all modifications happen to the user file by
default.
Ta$  
        %prog [<file-option>] list
        %prog [<file-option>] [--editor <editor-path>] edit

        %prog [<file-option>] get command.option
        %prog [<file-option>] set command.option value
        %prog [<file-option>] unset command.option
        %prog [<file-option>] debug
    returnNc                 8   U R                   R                  SSSS SS9  U R                   R                  SSSS	S
S9  U R                   R                  SSSS	SS9  U R                   R                  SSSS	SS9  U R                  R                  SU R                   5        g )Nz--editoreditorstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--globalglobal_file
store_trueFz+Use the system-wide configuration file onlyz--user	user_filez$Use the user configuration file onlyz--site	site_filez3Use the current environment configuration file onlyr   )cmd_opts
add_optionparserinsert_option_groupselfs    V/var/www/html/env/lib/python3.13/site-packages/pip/_internal/commands/configuration.pyadd_options ConfigurationCommand.add_options:   s      9 	! 		
 	  > 	! 	
 	  7 	! 	
 	  F 	! 	
 	''4==9    optionsargsc                    U R                   U R                  U R                  U R                  U R                  U R
                  S.nU(       a	  US   U;  a4  [        R                  SSR                  [        U5      5      5        [        $ US   n U R                  XS;   S9n[        UR                  US9U l        U R                   R#                  5          X4   " XSS  5        [$        $ ! [         a2  n[        R                  UR                  S   5        [        s S nA$ S nAff = f! [         a2  n[        R                  UR                  S   5        [        s S nA$ S nAff = f)	N)listeditgetsetunsetdebugr   zNeed an action (%s) to perform.z, )r0   r1   r2   r/   )
need_value)isolated	load_only   )list_valuesopen_in_editorget_nameset_name_value
unset_namelist_config_valuesloggererrorjoinsortedr   _determine_filer   r,   r
   isolated_modeconfigurationloadr	   )r&   r+   r,   handlersr   r6   es          r'   runConfigurationCommand.run`   s>   $$''==&&__,,
 tAwh.LL1		&*+ La	,,/N%N - I +**i
 	!	W12h/
 #  	LL#L	  	LL#L	s<   C) D( )
D%3'D D% D%(
E$2'EE$E$r4   c                    [         R                  UR                  4[         R                  UR                  4[         R
                  UR                  44 VVs/ s H  u  p4U(       d  M  UPM     nnnU(       dX  U(       d  g [        S [        5       [         R
                      5       5      (       a  [         R
                  $ [         R                  $ [        U5      S:X  a  US   $ [        S5      es  snnf )Nc              3   `   #    U  H$  n[         R                  R                  U5      v   M&     g 7f)N)ospathexists).0site_config_files     r'   	<genexpr>7ConfigurationCommand._determine_file.<locals>.<genexpr>   s)      (M$ /00(Ms   ,.r7   r   zLNeed exactly one file to operate upon (--user, --site, --global) to perform.)r   USERr   GLOBALr   SITEr    anyr   lenr   )r&   r+   r4   keyvaluefile_optionss         r'   rB   $ConfigurationCommand._determine_file   s     W../w223W../


   	 
  (?(A%**(M   zz!zz!!#?"5
 	
1
s   C/(C/c                     U R                  USSS9  [        U R                  R                  5       5       H  u  p4[	        SX45        M     g )Nr.   r   n%s=%r)_get_n_argsrA   rD   itemsr   r&   r+   r,   rX   rY   s        r'   r8    ConfigurationCommand.list_values   sA    v+ !3!3!9!9!;<JC#- =r*   c                 t    U R                  USSS9nU R                  R                  U5      n[        SU5        g )Nz
get [name]r7   r]   z%s)r`   rD   	get_valuer   rb   s        r'   r:   ConfigurationCommand.get_name   s9    t\Q7"",,S1T5!r*   c                     U R                  USSS9u  p4U R                  R                  X45        U R                  5         g )Nzset [name] [value]   r]   )r`   rD   	set_value_save_configurationrb   s        r'   r;   #ConfigurationCommand.set_name_value   s<    %%d,@A%F
$$S0  "r*   c                 |    U R                  USSS9nU R                  R                  U5        U R                  5         g )Nzunset [name]r7   r]   )r`   rD   unset_valuerj   )r&   r+   r,   rX   s       r'   r<   ConfigurationCommand.unset_name   s9    t^q9&&s+  "r*   c                    U R                  USSS9  U R                  5         [        U R                  R	                  5       5       Hp  u  p4[        SU5        U HY  n[        5          [        R                  R                  U5      n[        SXV5        U(       a  U R                  U5        SSS5        M[     Mr     g! , (       d  f       Mq  = f)z9List config key-value pairs across different config filesr3   r   r]   %s:z%s, exists: %rN)r`   print_env_var_valuesrA   rD   iter_config_filesr   r   rL   rM   rN   print_config_file_values)r&   r+   r,   variantfilesfnamefile_existss          r'   r=   'ConfigurationCommand.list_config_values   s    w!,!!# %T%7%7%I%I%KLNG(\"$''.."7K !15F"55g>	 "\  M "\s   %AB::
C	rt   c                     U R                   R                  U5      R                  5        H$  u  p#[        5          [	        SX#5        SSS5        M&     g! , (       d  f       M8  = f)z.Get key-value pairs from the file of a variantz%s: %sN)rD   get_values_in_configra   r   r   )r&   rt   namerY   s       r'   rs   -ConfigurationCommand.print_config_file_values   sE    --BB7KQQSKDXt3  Ts   A
A"	c                     [        SS5        [        5          [        U R                  R	                  5       5       H$  u  pSUR                  5        3n[        SX25        M&     SSS5        g! , (       d  f       g= f)z5Get key-values pairs present as environment variablesrp   env_varPIP_r_   N)r   r   rA   rD   get_environ_varsupper)r&   rX   rY   r~   s       r'   rq   )ConfigurationCommand.print_env_var_values   sX    UI&\$T%7%7%H%H%JK
 .Wg5 L \\s   AA,,
A:c                    U R                  U5      nU R                  R                  5       nUc  [        S5      eSU;   a  [        SU 35      e [        R
                  " U SU S3SS9  g ! [         a  nUR                  (       d  X5l        e S nAf[        R                   a  n[        SUR                   35      eS nAff = f)Nz%Could not determine appropriate file."z4Can not open an editor for a file name containing "
z "T)shellz(Editor Subprocess exited with exit code )
_determine_editorrD   get_file_to_editr   
subprocess
check_callFileNotFoundErrorfilenameCalledProcessError
returncode)r&   r+   r,   r   rv   rG   s         r'   r9   #ConfigurationCommand.open_in_editor   s    ''0""335=BCCE\ GwO 	V!!VHBugQ"7tD  	::#
,, 	VEall^TUU	Vs$   A+ +
C5BC$B<<Cexampler^   c                 x    [        U5      U:w  a  SU S[        5        SU S3n[        U5      eUS:X  a  US   $ U$ )zAHelper to make sure the command got the right number of argumentsz-Got unexpected number of arguments, expected z. (example: "z config z")r7   r   )rW   r   r   )r&   r,   r   r^   msgs        r'   r`    ConfigurationCommand._get_n_args   sT    t9>?s C&j\'">  3-67NKr*   c                      U R                   R                  5         g ! [         a!    [        R	                  S5        [        S5      ef = f)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)rD   save	Exceptionr>   	exceptionr   r%   s    r'   rj   (ConfigurationCommand._save_configuration  sG    	.##% 	.L ,--		.s	    +Ac                     UR                   b  UR                   $ S[        R                  ;   a  [        R                  S   $ S[        R                  ;   a  [        R                  S   $ [        S5      e)NVISUALEDITORz"Could not determine editor to use.)r   rL   environr   )r&   r+   s     r'   r   &ConfigurationCommand._determine_editor  sX    >>%>>!#::h''#::h''?@@r*   )rD   )r   N)__name__
__module____qualname____firstlineno____doc__ignore_require_venvusager(   r   r   strintrH   boolr   r   rB   r8   r:   r;   r<   r=   rs   rq   r9   r   r`   rj   r   __static_attributes__ r*   r'   r   r      si   0 E$:L+6 +c +s +Z
v 
4 
HTN 
<.6 .c .t ." "d3i "D "#f #DI #$ ##& #S	 #d #?& ?S	 ?d ? 4 4 46Vf VDI V$ V,S	 C C C 	.A AC Ar*   r   )loggingrL   r   optparser   typingr   r   r   pip._internal.cli.base_commandr   pip._internal.cli.status_codesr   r	   pip._internal.configurationr
   r   r   r   pip._internal.exceptionsr   pip._internal.utils.loggingr   pip._internal.utils.miscr   r   	getLoggerr   r>   r   r   r*   r'   <module>r      sR     	   & & 2 9  . 2 ;			8	$BA7 BAr*   