Ë
    ð�©jâ8  ã                  óØ  — d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZmZ ej0                  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j@                  ejB                  ejD                  fZ#ej>                  ej<                  ej@                  fZ$ ee%«      Z&dd„Z'dd„Z(d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
é    )ÚannotationsN)ÚIterable)ÚAnyÚNewType)ÚConfigurationErrorÚ!ConfigurationFileCouldNotBeLoaded)Úappdirs)ÚWINDOWSÚget_locale_encoding)Ú	getLogger)Ú
ensure_dirÚenumÚKindzpip.inizpip.conf)ÚversionÚhelpÚuserÚglobalÚsiteÚenvzenv-var)ÚUSERÚGLOBALÚSITEÚENVÚENV_VARc                óh   — | j                  «       j                  dd«      } | j                  d«      } | S )zAMake a name consistent regardless of source (environment or file)Ú_ú-z--)ÚlowerÚreplaceÚremoveprefix)Únames    úb/var/www/html/streamforge-license/venv/lib/python3.12/site-packages/pip/_internal/configuration.pyÚ_normalize_namer#   4   s/   € à�:‰:‹<×Ñ  SÓ)€DØ×Ñ˜TÓ"€DØ€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   )r0   Úglobal_config_filesÚsite_config_fileÚlegacy_config_fileÚnew_config_files        r"   Úget_configuration_filesr<   E   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ˆ fd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zedd„«       Zdd„Zd d„Zd!d„Zdd„Z	 	 	 	 	 	 d"d„Zd#d„Zd$d„Zd%d„Zd&d„Zd'd„Zd(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.
    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   Úformatr1   ÚmapÚreprÚisolatedÚ	load_onlyÚOVERRIDE_ORDERÚ_parsersÚ_configÚ_modified_parsers)ÚselfrF   rG   ÚvariantÚ	__class__s       €r"   rA   zConfiguration.__init__f   s¬   ø€ Ü‰ÑÔàÐ  Y´oÑ%EÜ$ØG×NÑNØ—I‘Iœc¤$¬Ó8Ó9óóð ð
 !ˆŒØ"ˆŒô (6öH
Ø#ˆG�R‰KòH
ˆŒô (6ö?
Ø#ˆG�R‰Kò?
ˆŒð EGˆÕùòH
ùò?
s   Á+
BÂ
B$c                ó^   — | j                  «        | j                  s| j                  «        yy)z<Loads configuration from configuration files and environmentN)Ú_load_config_filesrF   Ú_load_environment_vars©rL   s    r"   ÚloadzConfiguration.load{   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   )rG   Ú_get_parser_to_modifyÚ
IndexErrorrR   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ÚitemsrR   s    r"   rZ   zConfiguration.itemsŠ   s   € ð ×Ñ×%Ñ%Ó'Ð'r$   c                óØ   — |}t        |«      }	 i }| j                  j                  «       D ]  }|j                  |«       Œ ||   S # t        $ r t        |«       t        d|› �«      ‚w xY w)z#Get a value from the configuration.úNo such key - )r#   rY   ÚvaluesÚupdateÚKeyErrorr*   r   )rL   ÚkeyÚorig_keyÚclean_configÚfile_valuess        r"   Ú	get_valuezConfiguration.get_value�   s€   € àˆÜ˜cÓ"ˆð		BØ+-ˆLØ#×/Ñ/×6Ñ6Ó8ò 1�Ø×#Ñ# KÕ0ð1à Ñ$Ð$øÜò 	Bô ˜SÔ!Ü$ ~°h°ZÐ%@ÓAÐAð		Bús   �6A Á#A)c                óº  — t        |«      }| j                  «        | j                  sJ ‚| j                  «       \  }}|�Ct	        |«      \  }}|j                  |«      s|j                  |«       |j                  |||«       | j                  | j                     j                  |i «       || j                  | j                     |   |<   | j                  ||«       y)z$Modify a value in the configuration.N)r#   Ú_ensure_have_load_onlyrG   rU   r*   Úhas_sectionÚadd_sectionÚsetrJ   Ú
setdefaultÚ_mark_as_modified)rL   r`   ÚvalueÚ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Ô,à�‰�T—^‘^Ñ$×/Ñ/°°rÔ:Ø38ˆ�‰�T—^‘^Ñ$ UÑ+¨CÑ0Ø×Ñ˜u fÕ-r$   c                ó€  — |}t        |«      }| j                  «        | j                  sJ ‚| j                  «       \  }}|| j                  | j                     |   vr)|| j                  | j                     vrt        d|› �«      ‚|�pt        |«      \  }}|j                  |«      r|j                  ||«      st        d«      ‚|j                  |«      s|j                  |«       | j                  ||«       	 | j                  | j                     |   |= y# t        $ r | j                  | j                     |= Y yw xY w)z#Unset a value in the configuration.r\   Nz4Fatal Internal error [id=1]. Please report as a bug.)r#   rf   rG   rU   rJ   r   r*   rg   Úremove_optionrZ   Úremove_sectionrk   r_   )rL   r`   ra   rm   rn   ro   r!   s          r"   Úunset_valuezConfiguration.unset_value³   s0  € àˆÜ˜cÓ"ˆØ×#Ñ#Ô%à�~Š~Ðˆ~Ø×2Ñ2Ó4‰ˆˆvð �t—|‘| D§N¡NÑ3°EÑ:Ñ:Ø˜4Ÿ<™<¨¯©Ñ7Ñ7ä$ ~°h°ZÐ%@ÓAÐAàÐÜ,¨SÓ1‰MˆG�Tà×"Ñ" 7Ô+°×0DÑ0DÀWÈdÔ0Sô )ØJóð ð
 —<‘< Ô(Ø×%Ñ% gÔ.Ø×"Ñ" 5¨&Ô1ð	2Ø—‘˜TŸ^™^Ñ,¨UÑ3°CÑ8øÜò 	2Ø—‘˜TŸ^™^Ñ,¨SÒ1ð	2ús   Ã9D Ä#D=Ä<D=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: )rf   rK   ÚloggerÚinfor   r/   r0   ÚdirnameÚopenÚwriteÚOSErrorr   )rL   rm   rn   Ú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)rG   r   rw   ÚdebugrR   s    r"   rf   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.)rH   r^   rJ   )rL   ÚretvalrM   s      r"   rY   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_filesr7   r   r/   Údevnullrw   r�   rZ   rG   Ú
_load_filerI   Úappend)rL   Úconfig_filesrM   Úfilesrm   rn   s         r"   rP   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$   c                óB  — t         j                  d||«       | j                  |«      }|j                  «       D ]c  }|j	                  |«      }| j
                  |   j                  |i «       | j
                  |   |   j                  | j                  ||«      «       Œe |S )Nz'For variant '%s', will try loading '%s')	rw   ÚverboseÚ_construct_parserÚsectionsrZ   rJ   rj   r^   Ú_normalized_keys)rL   rM   rm   rn   ro   rZ   s         r"   rˆ   zConfiguration._load_file  s’   € Ü�‰Ð@À'È5ÔQØ×'Ñ'¨Ó.ˆà—‘Ó(ò 	WˆGØ—L‘L Ó)ˆEØ�L‰L˜Ñ!×,Ñ,¨U°BÔ7Ø�L‰L˜Ñ! %Ñ(×/Ñ/°×0EÑ0EÀgÈuÓ0UÕVð	Wð
 ˆr$   c                ó,  — t        j                  «       }t        j                  j	                  |«      r t        «       }	 |j                  ||¬«       |S |S # t        $ r t        d|› d�|¬«      ‚t         j                  $ r}t        |¬«      ‚d }~ww xY w)N)Úencodingzcontains invalid z characters)Úreasonrm   )r~   )
ÚconfigparserÚRawConfigParserr/   r0   Úexistsr   ÚreadÚUnicodeDecodeErrorr   ÚError)rL   rm   rn   Úlocale_encodingr~   s        r"   rŽ   zConfiguration._construct_parser   s—   € Ü×-Ñ-Ó/ˆô
 �7‰7�>‰>˜%Ô Ü1Ó3ˆOð
EØ—‘˜E¨O�Ô<ð ˆˆvˆøô &ò ä7Ø.¨Ð.?¸{ÐKØôð ô  ×%Ñ%ò Eä7¸eÔDÐDûðEús   ¿A Á,BÂBÂBc                óø   — | j                   t        j                     j                  di «       | j                   t        j                     d   j	                  | j                  d| j                  «       «      «       y)z.Loads configuration from environment variablesz:env:N)rJ   r7   r   rj   r^   r�   Úget_environ_varsrR   s    r"   rQ   z$Configuration._load_environment_vars5  sX   € à�‰”U—]‘]Ñ#×.Ñ.¨w¸Ô;Ø�‰”U—]‘]Ñ# GÑ,×3Ñ3Ø×!Ñ! '¨4×+@Ñ+@Ó+BÓCõ	
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#   )rL   ro   rZ   Ú
normalizedr!   Úvalr`   s          r"   r�   zConfiguration._normalized_keys<  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)r/   ÚenvironrZ   Ú
startswithr   ÚENV_NAMES_IGNORED)rL   r`   rŸ   r!   s       r"   rœ   zConfiguration.get_environ_varsJ  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)r/   r£   Úgetr<   r7   r   rF   r0   r–   r   r   r   )rL   Úenv_config_filerŠ   Úshould_load_user_configs       r"   r†   zConfiguration.iter_config_filesS  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)rJ   )rL   rM   s     r"   Úget_values_in_configz"Configuration.get_values_in_configs  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.éÿÿÿÿ)rG   rI   r   )rL   Úparserss     r"   rU   z#Configuration._get_parser_to_modifyw  s?   € à�~Š~Ðˆ~Ø—-‘- §¡Ñ/ˆÙä$ØFóð ð
 �r‰{Ðr$   c                ó`   — ||f}|| j                   vr| j                   j                  |«       y y ©N)rK   r‰   )rL   rm   rn   Úfile_parser_tuples       r"   rk   zConfiguration._mark_as_modified…  s4   € Ø" F˜OÐØ D×$:Ñ$:Ñ:Ø×"Ñ"×)Ñ)Ð*;Õ<ð ;r$   c                óN   — | j                   j                  › d| j                  ›d�S )Nú(ú))rN   Ú__name__rY   rR   s    r"   Ú__repr__zConfiguration.__repr__Š  s'   € Ø—.‘.×)Ñ)Ð*¨!¨D×,<Ñ,<Ð+?¸qÐAÐAr$   r±   )rF   ÚboolrG   zKind | NoneÚreturnÚNone)r¹   rº   )r¹   z
str | None)r¹   úIterable[tuple[str, Any]])r`   Ústrr¹   r   )r`   r¼   rl   r   r¹   rº   )r`   r¼   r¹   rº   )r¹   zdict[str, dict[str, Any]])rM   r   rm   r¼   r¹   r•   )rm   r¼   r¹   r•   )ro   r¼   rZ   r»   r¹   údict[str, Any])r¹   zIterable[tuple[str, str]])r¹   z Iterable[tuple[Kind, list[str]]])rM   r   r¹   r½   )r¹   ztuple[str, RawConfigParser])rm   r¼   rn   r•   r¹   rº   )r¹   r¼   )r¶   Ú
__module__Ú__qualname__Ú__doc__rA   rS   rW   rZ   rd   rp   rt   r   rf   ÚpropertyrY   rP   rˆ   rŽ   rQ   r�   rœ   r†   r¬   rU   rk   r·   Ú__classcell__)rN   s   @r"   r>   r>   X   sž   ø„ ñöGó**óó(óBó.ó( 2óDó0Mð
 ò	ó ð	ó?ó.	óó*
ðØðØ#<ðà	óó$ó ó@%óó=÷
Br$   r>   )r!   r¼   r¹   r¼   )r!   r¼   r¹   z	list[str])r¹   zdict[Kind, list[str]])+rÀ   Ú
__future__r   r”   r/   r3   Úcollections.abcr   Útypingr   r   Úpip._internal.exceptionsr   r   Úpip._internal.utilsr	   Úpip._internal.utils.compatr
   r   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   r   r•   r¼   r   r2   r¥   r7   r   r   r   r   r   rH   rB   r¶   rw   r#   r*   r<   r>   © r$   r"   ú<module>rÌ      s×   ðñõ #ã Û 	Û 
Ý $ß ÷õ (ß CÝ 1ß 5à×.Ñ.€Ùˆv�sÓ€á&‘)¨J€Ø%Ð ñ 	Ø	ØØ	ØØô	€ð —‘˜uŸz™z¨5¯:©:°u·y±yÀ%Ç-Á-ÐO€Ø—*‘*˜eŸl™l¨E¯J©JÐ6€á	�8Ó	€óóó÷&sBò sBr$   