Ë
    ��hµ6  ã                   ó  — d Z ddlZddlZddlZddl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 ddlmZ ddlmZ ddlmZ ddlmZmZ ej2                  Z e
d	e«      Zerd
ndZdZ eddddd¬«      Zej>                  ej@                  ejB                  ejD                  ejF                  fZ$ej@                  ej>                  ejB                  fZ% ee&«      Z'dedefd„Z(dede	e   fd„Z)deee	e   f   fd„Z* G d„ d«      Z+y)a  Configuration management setup

Some terminology:
- name
  As written in config files.
- value
  Value associated with a name
- key
  Name combined with it's section (section.name)
- variant
  A single word describing where the configuration key-value pair came from
é    N)ÚAnyÚDictÚIterableÚListÚNewTypeÚOptionalÚTuple)ÚConfigurationErrorÚ!ConfigurationFileCouldNotBeLoaded)Úappdirs)ÚWINDOWS)Ú	getLogger)Ú
ensure_dirÚenumÚKindzpip.inizpip.conf)ÚversionÚhelpÚuserÚglobalÚsiteÚenvzenv-var)ÚUSERÚGLOBALÚSITEÚENVÚENV_VARÚnameÚreturnc                 ór   — | j                  «       j                  dd«      } | j                  d«      r| dd } | S )zAMake a name consistent regardless of source (environment or file)Ú_ú-z--é   N)ÚlowerÚreplaceÚ
startswith)r   s    úY/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pip/_internal/configuration.pyÚ_normalize_namer'   2   s6   € à�:‰:‹<×Ñ  SÓ)€DØ‡��tÔØ�A�BˆxˆØ€Kó    c                 óP   — d| vrd| › d�}t        |«      ‚| j                  dd«      S )Nú.zVKey does not contain dot separated section and key. Perhaps you wanted to use 'global.z
' instead?é   )r
   Úsplit)r   Úerror_messages     r&   Ú_disassemble_keyr.   :   s>   € Ø
�$�ð1Ø15°°jðBð 	ô ! Ó/Ð/Ø�:‰:�c˜1ÓÐr(   c                  ód  — t        j                  d«      D � cg c]&  } t        j                  j	                  | t
        «      ‘Œ( }} t        j                  j	                  t        j                  t
        «      }t        j                  j	                  t        j                  j                  d«      t        rdndt
        «      }t        j                  j	                  t        j                  d«      t
        «      }t        j                  |t        j                  |gt        j                  ||giS c c} w )NÚpipú~z.pip)r   Úsite_config_dirsÚosÚpathÚjoinÚCONFIG_BASENAMEÚsysÚprefixÚ
expanduserr   Úuser_config_dirÚkindsr   r   r   )r4   Úglobal_config_filesÚsite_config_fileÚlegacy_config_fileÚnew_config_files        r&   Úget_configuration_filesr@   D   sØ   € ä8?×8PÑ8PÐQVÓ8WöØ04Œ�‰�‰�Tœ?Õ+ðÐð ô —w‘w—|‘|¤C§J¡J´Ó@ÐÜŸ™Ÿ™Ü
�‰×Ñ˜3ÓÝ‰˜fÜóÐô
 —g‘g—l‘l¤7×#:Ñ#:¸5Ó#AÄ?ÓS€Oä�‰Ð)Ü�
‰
Ð%Ð&Ü�
‰
Ð'¨Ð9ðð ùòs   ˜+D-c                   óÂ  ‡ — e Zd ZdZd"dedee   ddfˆ fd„Zd#d„Zdee	   fd„Z
deee	ef      fd	„Zd
e	defd„Zd
e	deddfd„Zd
e	ddfd„Zd#d„Zd#d„Zedee	ef   fd„«       Zd#d„Zdede	defd„Zde	defd„Zd#d„Zde	deee	ef      dee	ef   fd„Zdeee	e	f      fd„Zdeeeee	   f      fd„Zdedee	ef   fd„Z dee	ef   fd„Z!de	deddfd „Z"de	fd!„Z#ˆ xZ$S )$ÚConfigurationaâ  Handles management of configuration.

    Provides an interface to accessing and managing configuration files.

    This class converts provides an API that takes "section.key-name" style
    keys and stores the value associated with it as "key-name" under the
    section "section".

    This allows for a clean interface wherein the both the section and the
    key-name are preserved in an easy to manage form in the configuration files
    and the data stored is also nice.
    NÚisolatedÚ	load_onlyr   c           
      óR  •— t         ‰| �  «        |�C|t        vr;t        dj	                  dj                  t        t        t        «      «      «      «      ‚|| _        || _	        t        D �ci c]  }|g “Œ c}| _        t        D �ci c]  }|i “Œ c}| _        g | _        y c c}w c c}w )Nz5Got invalid value for load_only - should be one of {}z, )ÚsuperÚ__init__ÚVALID_LOAD_ONLYr
   Úformatr5   ÚmapÚreprrC   rD   ÚOVERRIDE_ORDERÚ_parsersÚ_configÚ_modified_parsers)ÚselfrC   rD   ÚvariantÚ	__class__s       €r&   rG   zConfiguration.__init__e   s¬   ø€ Ü‰ÑÔàÐ  Y´oÑ%EÜ$ØG×NÑNØ—I‘Iœc¤$¬Ó8Ó9óóð ð
 !ˆŒØ"ˆŒô (6öH
Ø#ˆG�R‰KòH
ˆŒô (6ö4
Ø#ˆG�R‰Kò4
ˆŒð EGˆÕùòH
ùò4
s   Á+
BÂ
B$c                 ó^   — | j                  «        | j                  s| j                  «        yy)z<Loads configuration from configuration files and environmentN)Ú_load_config_filesrC   Ú_load_environment_vars©rP   s    r&   ÚloadzConfiguration.loadz   s&   € à×ÑÔ!Ø�}Š}Ø×'Ñ'Õ)ð r(   c                 ón   — | j                   €J d«       ‚	 | j                  «       d   S # t        $ r Y yw xY w)z7Returns the file with highest priority in configurationNz)Need to be specified a file to be editingr   )rD   Ú_get_parser_to_modifyÚ
IndexErrorrV   s    r&   Úget_file_to_editzConfiguration.get_file_to_edit€   sC   € à�~‰~Ð)ÐVÐ+VÓVÐ)ð	Ø×-Ñ-Ó/°Ñ2Ð2øÜò 	Ùð	ús   •( ¨	4³4c                 ó6   — | j                   j                  «       S )z`Returns key-value pairs like dict.items() representing the loaded
        configuration
        )Ú_dictionaryÚitemsrV   s    r&   r^   zConfiguration.items‰   s   € ð ×Ñ×%Ñ%Ó'Ð'r(   Úkeyc                 óˆ   — |}t        |«      }	 | j                  |   S # t        $ r t        |«       t	        d|› �«      ‚w xY w)z#Get a value from the configuration.úNo such key - )r'   r]   ÚKeyErrorr.   r
   )rP   r_   Úorig_keys      r&   Ú	get_valuezConfiguration.get_value�   sU   € àˆÜ˜cÓ"ˆð	BØ×#Ñ# CÑ(Ð(øÜò 	Bô ˜SÔ!Ü$ ~°h°ZÐ%@ÓAÐAð		Bús	   � ž#AÚvaluec                 ób  — t        |«      }| j                  «        | j                  sJ ‚| j                  «       \  }}|�Ct	        |«      \  }}|j                  |«      s|j                  |«       |j                  |||«       || j                  | j                     |<   | j                  ||«       y)z$Modify a value in the configuration.N)
r'   Ú_ensure_have_load_onlyrD   rY   r.   Úhas_sectionÚadd_sectionÚsetrN   Ú_mark_as_modified)rP   r_   re   ÚfnameÚparserÚsectionr   s          r&   Ú	set_valuezConfiguration.set_value›   sŸ   € ä˜cÓ"ˆØ×#Ñ#Ô%à�~Š~Ðˆ~Ø×2Ñ2Ó4‰ˆˆvàÐÜ,¨SÓ1‰MˆG�Tð ×%Ñ% gÔ.Ø×"Ñ" 7Ô+Ø�J‰J�w  eÔ,à,1ˆ�‰�T—^‘^Ñ$ SÑ)Ø×Ñ˜u fÕ-r(   c                 óê  — |}t        |«      }| j                  «        | j                  sJ ‚|| j                  | j                     vrt	        d|› �«      ‚| j                  «       \  }}|�pt        |«      \  }}|j                  |«      r|j                  ||«      st	        d«      ‚|j                  |«      s|j                  |«       | j                  ||«       | j                  | j                     |= y)z#Unset a value in the configuration.ra   Nz4Fatal Internal error [id=1]. Please report as a bug.)r'   rg   rD   rN   r
   rY   r.   rh   Úremove_optionr^   Úremove_sectionrk   )rP   r_   rc   rl   rm   rn   r   s          r&   Úunset_valuezConfiguration.unset_value®   sæ   € àˆÜ˜cÓ"ˆØ×#Ñ#Ô%à�~Š~Ðˆ~Ø�d—l‘l 4§>¡>Ñ2Ñ2Ü$ ~°h°ZÐ%@ÓAÐAà×2Ñ2Ó4‰ˆˆvàÐÜ,¨SÓ1‰MˆG�Tà×"Ñ" 7Ô+°×0DÑ0DÀWÈdÔ0Sô )ØJóð ð
 —<‘< Ô(Ø×%Ñ% gÔ.Ø×"Ñ" 5¨&Ô1à�L‰L˜Ÿ™Ñ(¨Ñ-r(   c                 ór  — | j                  «        | j                  D ]j  \  }}t        j                  d|«       t	        t
        j                  j                  |«      «       	 t        |d«      5 }|j                  |«       ddd«       Œl y# 1 sw Y   ŒxY w# t        $ r}t        d|› d|› �«      ‚d}~ww xY w)z!Save the current in-memory state.zWriting to %sÚwNz:An error occurred while writing to the configuration file z: )rg   rO   ÚloggerÚinfor   r3   r4   ÚdirnameÚopenÚwriteÚOSErrorr
   )rP   rl   rm   ÚfÚerrors        r&   ÚsavezConfiguration.saveË   s­   € à×#Ñ#Ô%à!×3Ñ3ò 	‰MˆE�6Ü�K‰K˜¨Ô/ô ”r—w‘w—‘ uÓ-Ô.ðÜ˜% Ó%ð $¨Ø—L‘L ”O÷$øñ	÷$ð $ûäò Ü(ØPØ�g˜R ˜wð(óð ûðús0   Á"BÁ.BÂ BÂB	ÂBÂ	B6Â B1Â1B6c                 ór   — | j                   €t        d«      ‚t        j                  d| j                   «       y )Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rD   r
   rv   ÚdebugrV   s    r&   rg   z$Configuration._ensure_have_load_onlyã   s+   € Ø�>‰>Ð!Ü$Ð%NÓOÐOÜ�‰Ð;¸T¿^¹^ÕLr(   c                 ó\   — i }t         D ]   }|j                  | j                  |   «       Œ" |S )z3A dictionary representing the loaded configuration.)rL   ÚupdaterN   )rP   ÚretvalrQ   s      r&   r]   zConfiguration._dictionaryè   s4   € ð
 ˆä%ò 	1ˆGØ�M‰M˜$Ÿ,™, wÑ/Õ0ð	1ð ˆr(   c                 óº  — t        | j                  «       «      }|t        j                     dd t        j
                  gk(  rt        j                  d«       y|j                  «       D ]q  \  }}|D ]g  }| j                  �'|| j                  k7  rt        j                  d||«       Œ6| j                  ||«      }| j                  |   j                  ||f«       Œi Œs y)z,Loads configuration from configuration filesr   r+   zZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s))ÚdictÚiter_config_filesr;   r   r3   Údevnullrv   r€   r^   rD   Ú
_load_filerM   Úappend)rP   Úconfig_filesrQ   Úfilesrl   rm   s         r&   rT   z Configuration._load_config_filesô   sÍ   € ä˜D×2Ñ2Ó4Ó5ˆØœŸ	™	Ñ" 1 QÐ'¬B¯J©J¨<Ò7Ü�L‰LðAôð à*×0Ñ0Ó2ò 	?‰NˆG�UØò 
?�ð —>‘>Ð-°'¸T¿^¹^Ò2KÜ—L‘LÐ!CÀUÈGÔTØàŸ™¨°%Ó8�ð —‘˜gÑ&×-Ñ-¨u°f¨oÕ>ñ
?ñ	?r(   rQ   rl   c                 óþ   — t         j                  d||«       | j                  |«      }|j                  «       D ]A  }|j	                  |«      }| j
                  |   j                  | j                  ||«      «       ŒC |S )Nz'For variant '%s', will try loading '%s')rv   ÚverboseÚ_construct_parserÚsectionsr^   rN   r‚   Ú_normalized_keys)rP   rQ   rl   rm   rn   r^   s         r&   rˆ   zConfiguration._load_file  st   € Ü�‰Ð@À'È5ÔQØ×'Ñ'¨Ó.ˆà—‘Ó(ò 	PˆGØ—L‘L Ó)ˆEØ�L‰L˜Ñ!×(Ñ(¨×)>Ñ)>¸wÈÓ)NÕOð	Pð ˆr(   c                 óB  — t        j                  «       }t        j                  j	                  |«      r+t        j                  d«      }	 |j                  ||¬«       |S |S # t        $ r t        d|› d�|¬«      ‚t         j                  $ r}t        |¬«      ‚d }~ww xY w)NF)Úencodingzcontains invalid z characters)Úreasonrl   )r}   )ÚconfigparserÚRawConfigParserr3   r4   ÚexistsÚlocaleÚgetpreferredencodingÚreadÚUnicodeDecodeErrorr   ÚError)rP   rl   rm   Úlocale_encodingr}   s        r&   rŽ   zConfiguration._construct_parser  sŸ   € Ü×-Ñ-Ó/ˆô
 �7‰7�>‰>˜%Ô Ü$×9Ñ9¸%Ó@ˆOð
EØ—‘˜E¨O�Ô<ð ˆˆvˆøô &ò ä7Ø.¨Ð.?¸{ÐKØôð ô  ×%Ñ%ò Eä7¸eÔDÐDûðEús   Á
A! Á!,BÂBÂBc                 ó˜   — | j                   t        j                     j                  | j	                  d| j                  «       «      «       y)z.Loads configuration from environment variablesz:env:N)rN   r;   r   r‚   r�   Úget_environ_varsrV   s    r&   rU   z$Configuration._load_environment_vars*  s6   € à�‰”U—]‘]Ñ#×*Ñ*Ø×!Ñ! '¨4×+@Ñ+@Ó+BÓCõ	
r(   rn   r^   c                 óJ   — i }|D ]  \  }}|dz   t        |«      z   }|||<   Œ |S )z×Normalizes items to construct a dictionary with normalized keys.

        This routine is where the names become keys and are made the same
        regardless of source - configuration files or environment.
        r*   )r'   )rP   rn   r^   Ú
normalizedr   Úvalr_   s          r&   r�   zConfiguration._normalized_keys0  s@   € ð ˆ
Øò 	"‰IˆD�#Ø˜C‘-¤/°$Ó"7Ñ7ˆCØ!ˆJ�sŠOð	"ð Ðr(   c              #   óÀ   K  — t         j                  j                  «       D ]9  \  }}|j                  d«      sŒ|dd j	                  «       }|t
        vsŒ4||f–— Œ; y­w)z@Returns a generator with all environmental vars with prefix PIP_ÚPIP_é   N)r3   Úenvironr^   r%   r#   ÚENV_NAMES_IGNORED)rP   r_   r¡   r   s       r&   rž   zConfiguration.get_environ_vars>  sU   è ø€ äŸ
™
×(Ñ(Ó*ò 	$‰HˆC�Ø�~‰~˜fÕ%Ø˜1˜2�w—}‘}“�ØÔ0Ò0Ø ˜)“Oñ		$ùs   ‚6A¹AÁ	Ac              #   ó   K  — t         j                  j                  dd«      }t        «       }t        j
                  |t        j
                     f–— | j                   xr$ |xr t         j                  j                  |«       }|r%t        j                  |t        j                     f–— t        j                  |t        j                     f–— |�t        j                  |gf–— yt        j                  g f–— y­w)a�  Yields variant and configuration files associated with it.

        This should be treated like items of a dictionary. The order
        here doesn't affect what gets overridden. That is controlled
        by OVERRIDE_ORDER. However this does control the order they are
        displayed to the user. It's probably most ergonomic to display
        things in the same order as OVERRIDE_ORDER
        ÚPIP_CONFIG_FILEN)r3   r¥   Úgetr@   r;   r   rC   r4   r–   r   r   r   )rP   Úenv_config_filerŠ   Úshould_load_user_configs       r&   r†   zConfiguration.iter_config_filesG  sÈ   è ø€ ô Ÿ*™*Ÿ.™.Ð):¸DÓAˆÜ.Ó0ˆä�l‰l˜L¬¯©Ñ6Ð6Ò6ð '+§m¡mÐ"3ò #
ØÒ?¤§¡§¡¨Ó ?ð9
Ðñ #ä—*‘*˜l¬5¯:©:Ñ6Ð6Ò6ô �j‰j˜,¤u§z¡zÑ2Ð2Ò2àÐ&Ü—)‘)˜oÐ.Ð.Ó.ä—)‘)˜R�-Óùs   ‚C<C>c                 ó    — | j                   |   S )z#Get values present in a config file)rN   )rP   rQ   s     r&   Úget_values_in_configz"Configuration.get_values_in_configg  s   € à�|‰|˜GÑ$Ð$r(   c                 ót   — | j                   sJ ‚| j                  | j                      }|st        d«      ‚|d   S )Nz4Fatal Internal error [id=2]. Please report as a bug.éÿÿÿÿ)rD   rM   r
   )rP   Úparserss     r&   rY   z#Configuration._get_parser_to_modifyk  s?   € à�~Š~Ðˆ~Ø—-‘- §¡Ñ/ˆÙä$ØFóð ð
 �r‰{Ðr(   rm   c                 ó`   — ||f}|| j                   vr| j                   j                  |«       y y ©N)rO   r‰   )rP   rl   rm   Úfile_parser_tuples       r&   rk   zConfiguration._mark_as_modifiedy  s4   € Ø" F˜OÐØ D×$:Ñ$:Ñ:Ø×"Ñ"×)Ñ)Ð*;Õ<ð ;r(   c                 óN   — | j                   j                  › d| j                  ›d�S )Nú(ú))rR   Ú__name__r]   rV   s    r&   Ú__repr__zConfiguration.__repr__~  s'   € Ø—.‘.×)Ñ)Ð*¨!¨D×,<Ñ,<Ð+?¸qÐAÐAr(   r²   )r   N)%r·   Ú
__module__Ú__qualname__Ú__doc__Úboolr   r   rG   rW   Ústrr[   r   r	   r   r^   rd   ro   rs   r~   rg   Úpropertyr   r]   rT   r•   rˆ   rŽ   rU   r�   rž   r   r†   r­   rY   rk   r¸   Ú__classcell__)rR   s   @r&   rB   rB   W   sÃ  ø„ ññG ð G°(¸4±.ð GÈDõ Gó**ð (¨3¡-ó ð(�x  c¨3 h¡Ñ0ó (ð
B˜Sð 
B Só 
Bð.˜Sð .¨ð .°ó .ð&.˜sð . tó .ó:ó0Mð
 ð	˜T # s (™^ò 	ó ð	ó?ð. $ð ¨sð °ó ð sð ¨ó ó*
ðØðØ#+¨E°#°s°(©OÑ#<ðà	ˆc�3ˆh‰óð$ (¨5°°c°©?Ñ";ó $ð  8¨E°$¸¸S¹	°/Ñ,BÑ#Có  ð@%¨Dð %°T¸#¸s¸(±^ó %ð u¨S°/Ð-AÑ'Bó ð= sð =°Oð =Èó =ð
B˜#÷ Br(   rB   ),r»   r”   r—   r3   r7   Útypingr   r   r   r   r   r   r	   Úpip._internal.exceptionsr
   r   Úpip._internal.utilsr   Úpip._internal.utils.compatr   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   r   r•   r½   r   r6   r¦   r;   r   r   r   r   r   rL   rH   r·   rv   r'   r.   r@   rB   © r(   r&   ú<module>rÇ      s  ðñó Û Û 	Û 
ß F× FÑ F÷õ (Ý .Ý 1ß 5à×.Ñ.€Ùˆv�sÓ€á&‘)¨J€Ø%Ð ñ 	Ø	ØØ	ØØô	€ð —‘˜uŸz™z¨5¯:©:°u·y±yÀ%Ç-Á-ÐO€Ø—*‘*˜eŸl™l¨E¯J©JÐ6€á	�8Ó	€ð˜#ð  #ó ð˜3ð  4¨¡9ó ð  d¨D°©I oÑ!6ó ÷&hBò hBr(   