HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/pip/_internal/__pycache__/configuration.cpython-311.pyc
�

�mi�8���dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
mZddlmZddlmZdd	lmZdd
lmZmZejZede��Zerdnd
ZdZeddddd���Zejejej ej!ej"fZ#ejejej fZ$ee%��Z&dd�Z'd d�Z(d!d�Z)Gd�d��Z*dS)"aConfiguration 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)�	getLogger)�
ensure_dir�enum�Kindzpip.inizpip.conf)�version�help�user�global�site�envzenv-var)�USER�GLOBAL�SITE�ENV�ENV_VAR�name�str�returnc��|����dd��}|�d��}|S)zAMake a name consistent regardless of source (environment or file)�_�-z--)�lower�replace�removeprefix)rs �=D:\Python311\Lib\site-packages\pip/_internal/configuration.py�_normalize_namer$5s7���:�:�<�<����S�)�)�D����T�"�"�D��K��	list[str]c�`�d|vrd|�d�}t|���|�dd��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,<sR��
�$��0�
B�15�
B�
B�
B�	�!��/�/�/��:�:�c�1���r%�dict[Kind, list[str]]c���d�tjd��D��}tj�t
jt��}tj�tj�d��trdndt��}tj�tj
d��t��}tj|tj
|gtj||giS)Nc�X�g|]'}tj�|t����(S�)�os�path�join�CONFIG_BASENAME)�.0r2s  r#�
<listcomp>z+get_configuration_files.<locals>.<listcomp>Gs5�����04�����T�?�+�+���r%�pip�~z.pip)r	�site_config_dirsr1r2r3�sys�prefixr4�
expanduserr
�user_config_dir�kindsrrr)�global_config_files�site_config_file�legacy_config_file�new_config_files    r#�get_configuration_filesrCFs�����8?�8P�QV�8W�8W������w�|�|�C�J��@�@������
����3����$���f�����
�g�l�l�7�#:�5�#A�#A�?�S�S�O�
��)�
�
�%�&�
�
�'��9��r%c����eZdZdZd0d1�fd	�
Zd2d
�Zd3d�Zd4d�Zd5d�Zd6d�Z	d7d�Z
d2d�Zd2d�Ze
d8d���Zd2d�Zd9d�Zd:d �Zd2d!�Zd;d%�Zd<d'�Zd=d)�Zd>d*�Zd?d,�Zd@d.�ZdAd/�Z�xZS)B�
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�bool�	load_only�Kind | Noner�Nonec
�z��t�����|�V|tvrMtd�d�t
tt���������||_||_	d�tD��|_d�tD��|_g|_
dS)Nz5Got invalid value for load_only - should be one of {}z, c��i|]}|g��Sr0r0�r5�variants  r#�
<dictcomp>z*Configuration.__init__.<locals>.<dictcomp>ts-��H
�H
�H
�#�G�R�H
�H
�H
r%c��i|]}|i��Sr0r0rMs  r#rOz*Configuration.__init__.<locals>.<dictcomp>ws'��?
�?
�?
�#�G�R�?
�?
�?
r%)�super�__init__�VALID_LOAD_ONLYr�formatr3�map�reprrFrH�OVERRIDE_ORDER�_parsers�_config�_modified_parsers)�selfrFrH�	__class__s   �r#rRzConfiguration.__init__gs����
���������	�Y�o�%E�	�$�G�N�N��I�I�c�$��8�8�9�9�����
�
!��
�"���H
�H
�'5�H
�H
�H
��
�?
�?
�'5�?
�?
�?
���EG����r%c�h�|���|js|���dSdS)z<Loads configuration from configuration files and environmentN)�_load_config_filesrF�_load_environment_vars�r[s r#�loadzConfiguration.load|s@�����!�!�!��}�	*��'�'�)�)�)�)�)�	*�	*r%�
str | Nonec�|�|j�
Jd���	|���dS#t$rYdSwxYw)z7Returns the file with highest priority in configurationNz)Need to be specified a file to be editingr)rH�_get_parser_to_modify�
IndexErrorr`s r#�get_file_to_editzConfiguration.get_file_to_edit�sW���~�V�V�+V�V�V�V�	��-�-�/�/��2�2���	�	�	��4�4�	���s�-�
;�;�Iterable[tuple[str, Any]]c�4�|j���S)z`Returns key-value pairs like dict.items() representing the loaded
        configuration
        )�_dictionary�itemsr`s r#rjzConfiguration.items�s����%�%�'�'�'r%�keyrrc��|}t|��}	i}|j���D]}|�|���||S#t$r"t|��t
d|�����wxYw)z#Get a value from the configuration.�No such key - )r$ri�values�update�KeyErrorr,r)r[rk�orig_key�clean_config�file_valuess     r#�	get_valuezConfiguration.get_value�s������c�"�"��		B�+-�L�#�/�6�6�8�8�
1�
1���#�#�K�0�0�0�0���$�$���	B�	B�	B�
�S�!�!�!�$�%@�h�%@�%@�A�A�A�		B���s�:A�,A:�valuec���t|��}|���|jsJ�|���\}}|�St	|��\}}|�|��s|�|��|�|||��|j|j�	|i��||j|j||<|�
||��dS)z$Modify a value in the configuration.N)r$�_ensure_have_load_onlyrHrdr,�has_section�add_section�setrY�
setdefault�_mark_as_modified)r[rkru�fname�parser�sectionrs       r#�	set_valuezConfiguration.set_value�s����c�"�"���#�#�%�%�%��~�����2�2�4�4�
��v��	-�,�S�1�1�M�G�T��%�%�g�.�.�
,��"�"�7�+�+�+��J�J�w��e�,�,�,���T�^�$�/�/��r�:�:�:�38���T�^�$�U�+�C�0����u�f�-�-�-�-�-r%c��|}t|��}|���|jsJ�|���\}}||j|j|vr&||j|jvrtd|�����|��t
|��\}}|�|��r|�||��std���|�	|��s|�
|��|�||��	|j|j||=dS#t$r|j|j|=YdSwxYw)z#Unset a value in the configuration.rmNz4Fatal Internal error [id=1]. Please report as a bug.)
r$rwrHrdrYrr,rx�
remove_optionrj�remove_sectionr|rp)r[rkrqr}r~rrs       r#�unset_valuezConfiguration.unset_value�s������c�"�"���#�#�%�%�%��~�����2�2�4�4�
��v�
�t�|�D�N�3�E�:�:�	B��4�<���7�7�	B�%�%@�h�%@�%@�A�A�A��
	2�,�S�1�1�M�G�T��"�"�7�+�+�
�06�0D�0D�W�d�0S�0S�
�)�J����
�<�<��(�(�
/��%�%�g�.�.�.��"�"�5�&�1�1�1�	2���T�^�,�U�3�C�8�8�8���	2�	2�	2���T�^�,�S�1�1�1�1�	2���s�D0�0E�Ec��|���|jD]�\}}t�d|��t	t
j�|����	t|d��5}|�	|��ddd��n#1swxYwY��#t$r}td|�d|�����d}~wwxYwdS)z!Save the current in-memory state.z
Writing to %s�wNz:An error occurred while writing to the configuration file z: )rwrZ�logger�inforr1r2�dirname�open�write�OSErrorr)r[r}r~�f�errors     r#�savezConfiguration.save�s-���#�#�%�%�%�!�3�	�	�M�E�6��K�K���/�/�/�
�r�w���u�-�-�.�.�.�
��%��%�%�$���L�L��O�O�O�$�$�$�$�$�$�$�$�$�$�$����$�$�$�$����
�
�
�(�(��(�(� %�(�(��������
����	�	s<�)B'�9B�B'�B	�B'�"B	�#B'�'
C�1C�Cc�r�|j�td���t�d|j��dS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rHrr��debugr`s r#rwz$Configuration._ensure_have_load_only�s9���>�	P�$�%N�O�O�O����;�T�^�L�L�L�L�Lr%�dict[str, dict[str, Any]]c�^�i}tD]"}|�|j|���#|S)z3A dictionary representing the loaded configuration.)rWrorY)r[�retvalrNs   r#rizConfiguration._dictionary�s9��
��%�	1�	1�G��M�M�$�,�w�/�0�0�0�0��
r%c���t|�����}|tjdd�tjgkrt�d��dS|���D]q\}}|D]i}|j	�(||j	krt�d||���1|�
||��}|j|�||f���j�rdS)z,Loads configuration from configuration filesrr)zZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s))
�dict�iter_config_filesr>rr1�devnullr�r�rjrH�
_load_filerX�append)r[�config_filesrN�filesr}r~s      r#r^z Configuration._load_config_files�s���D�2�2�4�4�5�5����	�"�1�Q�3�'�B�J�<�7�	��L�L�A�
�
�
�
�F�*�0�0�2�2�	?�	?�N�G�U��

?�

?���>��'�T�^�2K���L�L�!C�U�G�T�T�T������%�8�8���
�g�&�-�-�u�f�o�>�>�>�>�

?�	?�	?r%rNrr}�RawConfigParserc�v�t�d||��|�|��}|���D]r}|�|��}|j|�|i��|j||�|�||�����s|S)Nz'For variant '%s', will try loading '%s')	r��verbose�_construct_parser�sectionsrjrYr{ro�_normalized_keys)r[rNr}r~rrjs      r#r�zConfiguration._load_files������@�'�5�Q�Q�Q��'�'��.�.�����(�(�	W�	W�G��L�L��)�)�E��L��!�,�,�U�B�7�7�7��L��!�%�(�/�/��0E�0E�g�u�0U�0U�V�V�V�V��
r%c�N�tj��}tj�|��rrtjd��}	|�||���nE#t$rtd|�d�|����tj
$r}t|����d}~wwxYw|S)NF)�encodingzcontains invalid z characters)�reasonr})r�)�configparserr�r1r2�exists�locale�getpreferredencoding�read�UnicodeDecodeErrorr�Error)r[r}r~�locale_encodingr�s     r#r�zConfiguration._construct_parser!s����-�/�/��
�7�>�>�%� � �	E�$�9�%�@�@�O�

E����E�O��<�<�<�<��%�
�
�
�7�K��K�K�K������ �%�
E�
E�
E�7�e�D�D�D�D�����
E�����
s�A � -B"�
B�B"c��|jtj�di��|jtjd�|�d|�������dS)z.Loads configuration from environment variablesz:env:N)rYr>rr{ror��get_environ_varsr`s r#r_z$Configuration._load_environment_vars6sp����U�]�#�.�.�w��;�;�;���U�]�#�G�,�3�3��!�!�'�4�+@�+@�+B�+B�C�C�	
�	
�	
�	
�	
r%rrj�dict[str, Any]c�N�i}|D]\}}|dzt|��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$)r[rrj�
normalizedr�valrks       r#r�zConfiguration._normalized_keys=sC���
��	"�	"�I�D�#��C�-�/�$�"7�"7�7�C�!�J�s�O�O��r%�Iterable[tuple[str, str]]c#��K�tj���D]E\}}|�d��r+|dd����}|t
vr||fV��FdS)z@Returns a generator with all environmental vars with prefix PIP_�PIP_�N)r1�environrj�
startswithr �ENV_NAMES_IGNORED)r[rkr�rs    r#r�zConfiguration.get_environ_varsKsv�����
�(�(�*�*�	$�	$�H�C���~�~�f�%�%�
$��1�2�2�w�}�}�����0�0�$���)�O�O�O��		$�	$r%� Iterable[tuple[Kind, list[str]]]c#��K�tj�dd��}t��}tj|tjfV�|jo!|otj�|��}|r tj	|tj	fV�tj
|tj
fV�|�tj|gfV�dStjgfV�dS)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)r1r��getrCr>rrFr2r�rrr)r[�env_config_filer��should_load_user_configs    r#r�zConfiguration.iter_config_filesTs������*�.�.�):�D�A�A��.�0�0���l�L���6�6�6�6�6�'+�m�"3�#
��?������ ?� ?�9
��#�	7��*�l�5�:�6�6�6�6�6��j�,�u�z�2�2�2�2�2��	 ��)�o�.�.�.�.�.�.�.��)�R�-�����r%c��|j|S)z#Get values present in a config file)rY)r[rNs  r#�get_values_in_configz"Configuration.get_values_in_configts���|�G�$�$r%�tuple[str, RawConfigParser]c�j�|jsJ�|j|j}|std���|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.���)rHrXr)r[�parserss  r#rdz#Configuration._get_parser_to_modifyxsG���~�����-���/���	�$�F���
�
�r�{�r%r~c�X�||f}||jvr|j�|��dSdS�N)rZr�)r[r}r~�file_parser_tuples    r#r|zConfiguration._mark_as_modified�sD��"�F�O���D�$:�:�	=��"�)�)�*;�<�<�<�<�<�	=�	=r%c�0�|jj�d|j�d�S)N�(�))r\�__name__rir`s r#�__repr__zConfiguration.__repr__�s!���.�)�A�A�D�,<�A�A�A�Ar%r�)rFrGrHrIrrJ)rrJ)rrb)rrg)rkrrr)rkrrurrrJ)rkrrrJ)rr�)rNrr}rrr�)r}rrr�)rrrjrgrr�)rr�)rr�)rNrrr�)rr�)r}rr~r�rrJ)rr)r��
__module__�__qualname__�__doc__rRrarfrjrtr�r�r�rw�propertyrir^r�r�r_r�r�r�r�rdr|r��
__classcell__)r\s@r#rErEYs���������G�G�G�G�G�G�G�**�*�*�*�����(�(�(�(�
B�
B�
B�
B�.�.�.�.�( 2� 2� 2� 2�D����0M�M�M�M�
�	�	�	��X�	�?�?�?�?�.	�	�	�	�����*
�
�
�
�����$�$�$�$� � � � �@%�%�%�%�����=�=�=�=�
B�B�B�B�B�B�B�Br%rE)rrrr)rrrr&)rr-)+r��
__future__rr�r�r1r:�collections.abcr�typingrr�pip._internal.exceptionsrr�pip._internal.utilsr	�pip._internal.utils.compatr
�pip._internal.utils.loggingr�pip._internal.utils.miscrr
r�rrr4r�r>rrrrrrWrSr�r�r$r,rCrEr0r%r#�<module>r�s�����#�"�"�"�"�"�����
�
�
�
�	�	�	�	�
�
�
�
�$�$�$�$�$�$�����������������(�'�'�'�'�'�.�.�.�.�.�.�1�1�1�1�1�1�5�5�5�5�5�5�5�5��.���w�v�s����&�6�)�)�J��%��	
��	��	�
��	�	�	����u�z�5�:�u�y�%�-�O���*�e�l�E�J�6��	��8�	�	��������������&sB�sB�sB�sB�sB�sB�sB�sB�sB�sBr%