
    q"h6                        S r SSKrSSKrSSKrSSKrSSKJrJrJrJ	r	J
r
Jr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  \R2                  r\
" S	\5      r\(       a  S
OSrSr\" SSSSSS9r\R>                  \R@                  \RB                  \RD                  \RF                  4r$\R@                  \R>                  \RB                  4r%\" \&5      r'S\S\4S jr(S\S\	\   4S jr)S\\\	\   4   4S jr* " S S5      r+g)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                 |    U R                  5       R                  SS5      n U R                  S5      (       a  U SS n U $ )zAMake a name consistent regardless of source (environment or file)_-z--   N)lowerreplace
startswith)r   s    M/var/www/html/env/lib/python3.13/site-packages/pip/_internal/configuration.py_normalize_namer'   2   s9    ::<S)DtABxK    c                 T    SU ;  a  SU  S3n[        U5      eU R                  SS5      $ )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>    
$115jB 	 !//::c1r(   c                  v   [         R                  " S5       V s/ s H'  n [        R                  R	                  U [
        5      PM)     nn [        R                  R	                  [        R                  [
        5      n[        R                  R	                  [        R                  R                  S5      [        (       a  SOS[
        5      n[        R                  R	                  [         R                  " S5      [
        5      n[        R                  U[        R                  U/[        R                  X4/0$ s  sn f )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?8P8PQV8W8WT?+8W   ww||CJJ@
3f
 ggll7#:#:5#A?SO)

%&

'9 s   .D6c                     ^  \ rS rSrSrS$S\S\\   SS4U 4S jjjrS%S jr	S\\
   4S	 jrS\\\
\4      4S
 jr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 jr\S\\
\4   4S j5       rS%S jrS\S\
S\4S jrS\
S\4S jrS%S jrS\
S\\\
\4      S\\
\4   4S jrS\\\
\
4      4S jrS\\\\\
   4      4S jr S\S\\
\4   4S jr!S\\
\4   4S jr"S\
S \SS4S! jr#S\
4S" jr$S#r%U =r&$ )&ConfigurationW   a  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           
      \  > [         TU ]  5         UbE  U[        ;  a;  [        SR	                  SR                  [        [        [        5      5      5      5      eXl        X l	        [         Vs0 s H  o3/ _M     snU l        [         Vs0 s H  o30 _M     snU l        / U l        g s  snf s  snf )Nz5Got invalid value for load_only - should be one of {}z, )super__init__VALID_LOAD_ONLYr
   formatr5   mapreprrD   rE   OVERRIDE_ORDER_parsers_config_modified_parsers)selfrD   rE   variant	__class__s       r&   rH   Configuration.__init__e   s     Yo%E$GNNIIc$89 
 !" (6H
'5GRK~H
 (64
'5GRK~4
 EGH
4
s   ,B$B)c                 h    U R                  5         U R                  (       d  U R                  5         gg)z<Loads configuration from configuration files and environmentN)_load_config_filesrD   _load_environment_varsrQ   s    r&   loadConfiguration.loadz   s&    !}}'') r(   c                 r    U R                   c   S5       e U R                  5       S   $ ! [         a     gf = f)z7Returns the file with highest priority in configurationNz)Need to be specified a file to be editingr   )rE   _get_parser_to_modify
IndexErrorrX   s    r&   get_file_to_editConfiguration.get_file_to_edit   sC    ~~)V+VV)	--/22 		s   ) 
66c                 6    U R                   R                  5       $ )zPReturns key-value pairs like dict.items() representing the loaded
configuration
)_dictionaryitemsrX   s    r&   rb   Configuration.items   s     %%''r(   keyc                     Un[        U5      n U R                  U   $ ! [         a    [        U5        [	        SU 35      ef = f)z#Get a value from the configuration.No such key - )r'   ra   KeyErrorr.   r
   )rQ   rd   orig_keys      r&   	get_valueConfiguration.get_value   sU    c"	B##C(( 	B S!$~hZ%@AA		Bs	    $Avaluec                 n   [        U5      nU R                  5         U R                  (       d   eU R                  5       u  p4UbF  [	        U5      u  pVUR                  U5      (       d  UR                  U5        UR                  XVU5        X R                  U R                     U'   U R                  X45        g)z$Modify a value in the configuration.N)
r'   _ensure_have_load_onlyrE   r\   r.   has_sectionadd_sectionsetrO   _mark_as_modified)rQ   rd   rk   fnameparsersectionr   s          r&   	set_valueConfiguration.set_value   s    c"##%~~~224,S1MG %%g..""7+JJwe,,1T^^$S)u-r(   c                    Un[        U5      nU R                  5         U R                  (       d   eXR                  U R                     ;  a  [	        SU 35      eU R                  5       u  p4Ub|  [        U5      u  pVUR                  U5      (       a  UR                  XV5      (       d  [	        S5      eUR                  U5      (       d  UR                  U5        U R                  X45        U R                  U R                     U	 g)z#Unset a value in the configuration.rf   Nz4Fatal Internal error [id=1]. Please report as a bug.)r'   rm   rE   rO   r
   r\   r.   rn   remove_optionrb   remove_sectionrq   )rQ   rd   rh   rr   rs   rt   r   s          r&   unset_valueConfiguration.unset_value   s    c"##%~~~ll4>>22$~hZ%@AA224,S1MG""7++0D0DW0S0S )J 
 <<((%%g.""51LL(-r(   c                    U R                  5         U R                   Hj  u  p[        R                  SU5        [	        [
        R                  R                  U5      5         [        US5       nUR                  U5        SSS5        Ml     g! , (       d  f       M~  = f! [         a  n[        SU SU 35      eSnAff = f)z!Save the current in-memory state.zWriting to %swNz:An error occurred while writing to the configuration file z: )rm   rP   loggerinfor   r3   r4   dirnameopenwriteOSErrorr
   )rQ   rr   rs   ferrors        r&   saveConfiguration.save   s    ##%!33MEKK/ rwwu-.%%LLO &% 4 &% (PgRw( s6   !B-B?B
B	BB
B>(B99B>c                 t    U R                   c  [        S5      e[        R                  SU R                   5        g )Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rE   r
   r~   debugrX   s    r&   rm   $Configuration._ensure_have_load_only   s+    >>!$%NOO;T^^Lr(   c                 `    0 n[          H!  nUR                  U R                  U   5        M#     U$ )z3A dictionary representing the loaded configuration.)rM   updaterO   )rQ   retvalrR   s      r&   ra   Configuration._dictionary   s/    
 %GMM$,,w/0 & r(   c                    [        U R                  5       5      nU[        R                     SS [        R
                  /:X  a  [        R                  S5        gUR                  5        Hr  u  p#U Hg  nU R                  b'  X R                  :w  a  [        R                  SXB5        M7  U R                  X$5      nU R                  U   R                  XE45        Mi     Mt     g)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   devnullr~   r   rb   rE   
_load_filerN   append)rQ   config_filesrR   filesrr   rs   s         r&   rV    Configuration._load_config_files   s    D2245		"1Q'BJJ<7LLA *002NG >>-'^^2KLL!CUT8 g&--uo>  3r(   rR   rr   c                     [         R                  SX5        U R                  U5      nUR                  5        HA  nUR	                  U5      nU R
                  U   R                  U R                  XE5      5        MC     U$ )Nz'For variant '%s', will try loading '%s')r~   verbose_construct_parsersectionsrb   rO   r   _normalized_keys)rQ   rR   rr   rs   rt   rb   s         r&   r   Configuration._load_file  si    @'Q''.(GLL)ELL!(()>)>w)NO ) r(   c                 @   [         R                  " 5       n[        R                  R	                  U5      (       a(  [
        R                  " S5      n UR                  XS9  U$ U$ ! [         a    [        SU S3US9e[         R                   a  n[        US9eS nAff = f)NF)encodingzcontains invalid z characters)reasonrr   )r   )configparserRawConfigParserr3   r4   existslocalegetpreferredencodingreadUnicodeDecodeErrorr   Error)rQ   rr   rs   locale_encodingr   s        r&   r   Configuration._construct_parser  s    --/
 77>>%  $99%@O
EE< v & 7..?{K   %% E7eDDEs   A$ $+B	BBc                     U R                   [        R                     R                  U R	                  SU R                  5       5      5        g)z.Loads configuration from environment variablesz:env:N)rO   r;   r   r   r   get_environ_varsrX   s    r&   rW   $Configuration._load_environment_vars*  s6    U]]#**!!'4+@+@+BC	
r(   rt   rb   c                 J    0 nU H  u  pEUS-   [        U5      -   nXSU'   M     U$ )zNormalizes 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'   )rQ   rt   rb   
normalizedr   valrd   s          r&   r   Configuration._normalized_keys0  s7     
IDC-/$"77C!sO  r(   c              #      #    [         R                  R                  5        HA  u  pUR                  S5      (       d  M  USS R	                  5       nU[
        ;  d  M<  X24v   MC     g7f)z@Returns a generator with all environmental vars with prefix PIP_PIP_   N)r3   environrb   r%   r#   ENV_NAMES_IGNORED)rQ   rd   r   r   s       r&   r   Configuration.get_environ_vars>  sN     

((*HC~~f%%12w}}00)O	 +s   8A'A'
A'c              #   0  #    [         R                  R                  SS5      n[        5       n[        R
                  U[        R
                     4v   U R                  (       + =(       a-    U=(       a    [         R                  R                  U5      (       + nU(       a%  [        R                  U[        R                     4v   [        R                  U[        R                     4v   Ub  [        R                  U/4v   g[        R                  / 4v   g7f)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   rD   r4   r   r   r   r   )rQ   env_config_filer   should_load_user_configs       r&   r   Configuration.iter_config_filesG  s      **..):DA.0llL666 '+mm"3 #
? ?9
 #**l5::666 jj,uzz222&))o...))R-s   DDc                      U R                   U   $ )z#Get values present in a config file)rO   )rQ   rR   s     r&   get_values_in_config"Configuration.get_values_in_configg  s    ||G$$r(   c                     U R                   (       d   eU R                  U R                      nU(       d  [        S5      eUS   $ )Nz4Fatal Internal error [id=2]. Please report as a bug.)rE   rN   r
   )rQ   parserss     r&   r\   #Configuration._get_parser_to_modifyk  s?    ~~~--/$F 
 r{r(   rs   c                 `    X4nX0R                   ;  a  U R                   R                  U5        g g N)rP   r   )rQ   rr   rs   file_parser_tuples       r&   rq   Configuration._mark_as_modifiedy  s0    "O$:$::""))*;< ;r(   c                 P    U R                   R                   SU R                  < S3$ )N())rS   __name__ra   rX   s    r&   __repr__Configuration.__repr__~  s'    ..))*!D,<,<+?qAAr(   )rO   rP   rN   rD   rE   r   )r   N)'r   
__module____qualname____firstlineno____doc__boolr   r   rH   rY   strr^   r   r	   r   rb   ri   ru   rz   r   rm   propertyr   ra   rV   r   r   r   rW   r   r   r   r   r   r\   rq   r   __static_attributes____classcell__)rS   s   @r&   rB   rB   W   s   G G(4. GD G G**(3- (xc3h0 (
BS 
BS 
B.S . . .&.s .t .:0M
 	T#s(^ 	 	?.$ s  s  *
#+E#s(O#<	c3h$(5c?"; $ 8E$S	/,B#C  @%D %T#s(^ %uS/-A'B =s =O = =
B# 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   rM   rI   r   r~   r'   r.   r@   rB    r(   r&   <module>r      s     	 
 F F F ( . 1 5..vs&)J%  				 uzz5::uyy%--O**ellEJJ6	8	# # 3 49 dDIo!6 &hB hBr(   