Ë
    ��h&&  ã                   óÒ   — d dl Z d dlZd dlZd dlmZ d dl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 d dlmZ d dlmZ d d	lmZmZ  e j4                  e«      Z G d
„ de
«      Zy)é    N)ÚValues)ÚAnyÚListÚOptional)ÚCommand)ÚERRORÚSUCCESS)ÚConfigurationÚKindÚget_configuration_filesÚkinds)ÚPipError)Ú
indent_log)Úget_progÚwrite_outputc                   ó>  — e Zd ZdZdZdZdd„Zdedee	   de
fd	„Zded
edee   fd„Zdedee	   ddfd„Zdedee	   ddfd„Zdedee	   ddfd„Zdedee	   ddfd„Zdedee	   ddfd„Zdeddfd„Zdd„Zdedee	   ddfd„Zdee	   de	de
defd„Zdd„Zdede	fd„Zy)ÚConfigurationCommandaó  
    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                 óP  — | j                   j                  dddd d¬«       | j                   j                  dddd	d
¬«       | j                   j                  dddd	d¬«       | j                   j                  dddd	d¬«       | j                  j                  d| j                   «       y )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    úb/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pip/_internal/commands/configuration.pyÚadd_optionsz ConfigurationCommand.add_options:   s¼   € Ø�‰× Ñ ØØØØð9ð 	!ô 		
ð 	�‰× Ñ ØØØØØ>ð 	!ô 	
ð 	�‰× Ñ ØØØØØ7ð 	!ô 	
ð 	�‰× Ñ ØØØØØFð 	!ô 	
ð 	�‰×'Ñ'¨¨4¯=©=Õ9ó    ÚoptionsÚargsc                 óÌ  — | j                   | j                  | j                  | j                  | j                  | j
                  dœ}|r|d   |vr4t        j                  ddj                  t        |«      «      «       t        S |d   }	 | j                  ||dv ¬«      }t        |j                  |¬«      | _        | j                   j#                  «        	  ||   ||dd  «       t$        S # t        $ r2}t        j                  |j                  d   «       t        cY d }~S d }~ww xY w# t        $ r2}t        j                  |j                  d   «       t        cY d }~S d }~ww xY w)	N)ÚlistÚeditÚgetÚsetÚunsetÚdebugr   zNeed an action (%s) to perform.z, )r.   r/   r0   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   r4   Úes          r&   ÚrunzConfigurationCommand.run`   sF  € à×$Ñ$Ø×'Ñ'Ø—=‘=Ø×&Ñ&Ø—_‘_Ø×,Ñ,ñ
ˆñ �t˜A‘w hÑ.Ü�L‰LØ1Ø—	‘	œ& Ó*Ó+ôô ˆLà�a‘ˆð	Ø×,Ñ,Ø VÐ/NÐ%Nð -ó ˆIô +Ø×*Ñ*°iô
ˆÔð 	×Ñ×ÑÔ!ð	ØˆH�VÑ˜W d¨1¨2 hÔ/ô
 ˆøô# ò 	Ü�L‰L˜Ÿ™ ™Ô#Ü�Lûð	ûô ò 	Ü�L‰L˜Ÿ™ ™Ô#Ü�Lûð	ús<   Â	C* ÃD( Ã*	D%Ã3'D ÄD%Ä D%Ä(	E#Ä1'EÅE#ÅE#r2   c                 ó¸  — t         j                  |j                  ft         j                  |j                  ft         j
                  |j                  ffD ��cg c]	  \  }}|r|‘Œ }}}|sN|sy t        d„ t        «       t         j
                     D «       «      rt         j
                  S t         j                  S t        |«      dk(  r|d   S t        d«      ‚c c}}w )Nc              3   óZ   K  — | ]#  }t         j                  j                  |«      –— Œ% y ­w)N)ÚosÚpathÚexists)Ú.0Úsite_config_files     r&   ú	<genexpr>z7ConfigurationCommand._determine_file.<locals>.<genexpr>œ   s&   è ø€ ò à$ô —‘—‘Ð/×0ñùs   ‚)+r5   r   zLNeed exactly one file to operate upon (--user, --site, --global) to perform.)r   ÚUSERr   ÚGLOBALr   ÚSITEr   Úanyr   Úlenr   )r%   r)   r2   ÚkeyÚvalueÚfile_optionss         r&   r@   z$ConfigurationCommand._determine_file�   sÒ   € ô —‘˜W×.Ñ.Ð/Ü—‘˜w×2Ñ2Ð3Ü—‘˜W×.Ñ.Ð/ð÷
á��Uñ
 ò ð
ˆñ 
ñ ÙØäñ ä(?Ó(AÄ%Ç*Á*Ñ(Môô ô —z‘zÐ!ä—z‘zÐ!Ü�Ó !Ò#Ø ‘?Ð"äð5ó
ð 	
ùó1
s   ÁCc                 óœ   — | j                  |dd¬«       t        | j                  j                  «       «      D ]  \  }}t	        d||«       Œ y )Nr,   r   ©Únú%s=%r)Ú_get_n_argsr?   rB   Úitemsr   ©r%   r)   r*   rT   rU   s        r&   r6   z ConfigurationCommand.list_values«   sJ   € Ø×Ñ˜˜v¨ÐÔ+ä  ×!3Ñ!3×!9Ñ!9Ó!;Ó<ò 	.‰JˆC�Ü˜ # uÕ-ñ	.r(   c                 óz   — | j                  |dd¬«      }| j                  j                  |«      }t        d|«       y )Nz
get [name]r5   rX   z%s)r[   rB   Ú	get_valuer   r]   s        r&   r8   zConfigurationCommand.get_name±   s9   € Ø×Ñ˜t \°QÐÓ7ˆØ×"Ñ"×,Ñ,¨SÓ1ˆä�T˜5Õ!r(   c                 óŠ   — | j                  |dd¬«      \  }}| j                  j                  ||«       | j                  «        y )Nzset [name] [value]é   rX   )r[   rB   Ú	set_valueÚ_save_configurationr]   s        r&   r9   z#ConfigurationCommand.set_name_value·   s@   € Ø×%Ñ% dÐ,@ÀAÐ%ÓF‰
ˆˆUØ×Ñ×$Ñ$ S¨%Ô0à× Ñ Õ"r(   c                 ó‚   — | j                  |dd¬«      }| j                  j                  |«       | j                  «        y )Nzunset [name]r5   rX   )r[   rB   Úunset_valuerc   )r%   r)   r*   rT   s       r&   r:   zConfigurationCommand.unset_name½   s9   € Ø×Ñ˜t ^°qÐÓ9ˆØ×Ñ×&Ñ& sÔ+à× Ñ Õ"r(   c                 ó„  — | j                  |dd¬«       | j                  «        t        | j                  j	                  «       «      D ]j  \  }}t        d|«       |D ]T  }t        «       5  t        j                  j                  |«      }t        d||«       |r| j                  |«       ddd«       ŒV Œl y# 1 sw Y   ŒcxY w)z9List config key-value pairs across different config filesr1   r   rX   ú%s:z%s, exists: %rN)r[   Úprint_env_var_valuesr?   rB   Úiter_config_filesr   r   rI   rJ   rK   Úprint_config_file_values)r%   r)   r*   ÚvariantÚfilesÚfnameÚfile_existss          r&   r;   z'ConfigurationCommand.list_config_valuesÃ   s´   € à×Ñ˜˜w¨!ÐÔ,à×!Ñ!Ô#ô % T×%7Ñ%7×%IÑ%IÓ%KÓLò 	?‰NˆG�UÜ˜ Ô(Øò ?�Ü“\ñ ?Ü"$§'¡'§.¡.°Ó"7�KÜ Ð!1°5¸+ÔFÙ"Ø×5Ñ5°gÔ>÷	?ð ?ñ?ñ	?÷?ð ?ús   Á)A B6Â6B?rk   c                 ó¾   — | j                   j                  |«      j                  «       D ]%  \  }}t        «       5  t	        d||«       ddd«       Œ' y# 1 sw Y   Œ2xY w)z.Get key-value pairs from the file of a variantz%s: %sN)rB   Úget_values_in_configr\   r   r   )r%   rk   ÚnamerU   s       r&   rj   z-ConfigurationCommand.print_config_file_valuesÓ   sZ   € à×-Ñ-×BÑBÀ7ÓK×QÑQÓSò 	4‰KˆD�%Ü“ñ 4Ü˜X t¨UÔ3÷4ð 4ñ	4÷4ð 4ús   ºAÁA	c                 óò   — t        dd«       t        «       5  t        | j                  j	                  «       «      D ]%  \  }}d|j                  «       › �}t        d||«       Œ' 	 ddd«       y# 1 sw Y   yxY w)z5Get key-values pairs present as environment variablesrg   Úenv_varÚPIP_rZ   N)r   r   r?   rB   Úget_environ_varsÚupper)r%   rT   rU   rs   s       r&   rh   z)ConfigurationCommand.print_env_var_valuesÙ   sk   € ä�U˜IÔ&Ü‹\ñ 	6Ü$ T×%7Ñ%7×%HÑ%HÓ%JÓKò 6‘
��UØ  §¡£ Ð.�Ü˜W g¨uÕ5ñ6÷	6÷ 	6ñ 	6ús   —AA-Á-A6c                 óz  — | j                  |«      }| j                  j                  «       }|€t        d«      ‚d|v rt        d|› �«      ‚	 t	        j
                  |› d|› d�d¬«       y # t        $ r}|j                  s||_        ‚ d }~wt        j                  $ r}t        d|j                  › �«      ‚d }~ww xY w)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_editorrB   Úget_file_to_editr   Ú
subprocessÚ
check_callÚFileNotFoundErrorÚfilenameÚCalledProcessErrorÚ
returncode)r%   r)   r*   r   rm   rE   s         r&   r7   z#ConfigurationCommand.open_in_editorá   sÃ   € Ø×'Ñ'¨Ó0ˆà×"Ñ"×3Ñ3Ó5ˆØˆ=ÜÐBÓCÐCØ�E‰\ô ØGÈÀwÐOóð ð	VÜ×!Ñ! V H¨B¨u¨g°QÐ"7¸tÖDøÜ ò 	Ø—:’:Ø#�”
ØûÜ×,Ñ,ò 	VÜÐEÀaÇlÁlÀ^ÐTÓUÐUûð	Vús$   ÁA* Á*	B:Á3BÂB:ÂB5Â5B:ÚexamplerY   c                 ót   — t        |«      |k7  rd|› dt        «       › d|› d�}t        |«      ‚|dk(  r|d   S |S )zAHelper to make sure the command got the right number of argumentsz-Got unexpected number of arguments, expected z. (example: "z config z")r5   r   )rS   r   r   )r%   r*   r‚   rY   Úmsgs        r&   r[   z ConfigurationCommand._get_n_args÷   sT   € äˆt‹9˜Š>à?À¸sð CÜ&›j˜\¨°'°¸"ð>ð ô ˜3“-Ðà�Š6Ø˜‘7ˆNàˆKr(   c                 ó”   — 	 | j                   j                  «        y # t        $ r! t        j	                  d«       t        d«      ‚w xY w)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)rB   ÚsaveÚ	Exceptionr<   Ú	exceptionr   r$   s    r&   rc   z(ConfigurationCommand._save_configuration  sG   € ð	.Ø×Ñ×#Ñ#Õ%øÜò 	.Ü×ÑØLôô Ð,Ó-Ð-ð		.ús	   ‚ �*Ac                 óÜ   — |j                   �|j                   S dt        j                  v rt        j                  d   S dt        j                  v rt        j                  d   S t        d«      ‚)NÚVISUALÚEDITORz"Could not determine editor to use.)r   rI   Úenvironr   )r%   r)   s     r&   rz   z&ConfigurationCommand._determine_editor  sX   € Ø�>‰>Ð%Ø—>‘>Ð!ØœŸ™Ñ#Ü—:‘:˜hÑ'Ð'ØœŸ™Ñ#Ü—:‘:˜hÑ'Ð'äÐ?Ó@Ð@r(   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úignore_require_venvÚusager'   r   r   ÚstrÚintrF   Úboolr   r   r@   r6   r8   r9   r:   r;   rj   rh   r7   r   r[   rc   rz   © r(   r&   r   r      si  „ ñð0 Ðð€Eó$:ðL+˜6ð +¨¨c©ð +°só +ðZ
 vð 
¸4ð 
ÀHÈTÁNó 
ð<. 6ð .°°c±ð .¸tó .ð" ð "¨d°3©ið "¸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   )ÚloggingrI   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¡      sT   ðÛ Û 	Û Ý ß &Ñ &å 2ß 9÷ó õ .Ý 2ß ;à	ˆ×	Ñ	˜8Ó	$€ôBA˜7õ BAr(   