HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc
a

?�f#7�@sdZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
mZddlmZmZddlmZer�dd	lmZmZmZmZmZmZmZejZed
e�Ze�e �Z!dd�Z"d
d�Z#edddddd�Z$e
r�dndZ%dd�Z&Gdd�de'�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
�N)�configparser)�ConfigurationError�!ConfigurationFileCouldNotBeLoaded)�appdirs)�WINDOWS�
expanduser)�
ensure_dir�enum)�MYPY_CHECK_RUNNING)�Any�Dict�Iterable�List�NewType�Optional�Tuple�KindcCs*|���dd�}|�d�r&|dd�}|S)zFMake a name consistent regardless of source (environment or file)
    �_�-z--�N)�lower�replace�
startswith)�name�r�?/usr/lib/python3.9/site-packages/pip/_internal/configuration.py�_normalize_name*s
rcCs&d|vrd�|�}t|��|�dd�S)N�.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?�)�formatr�split)rZ
error_messagerrr�_disassemble_key4s��r!�user�globalZsite�envzenv-var)�USER�GLOBAL�SITE�ENV�ENV_VARzpip.inizpip.confcCspdd�t�d�D�}tj�tjt�}tj�td�t	r8dndt�}tj�t�
d�t�}tj|tj
|gtj||giS)NcSsg|]}tj�|t��qSr)�os�path�join�CONFIG_BASENAME)�.0r+rrr�
<listcomp>Ns�z+get_configuration_files.<locals>.<listcomp>Zpip�~z.pip)rZsite_config_dirsr*r+r,�sys�prefixr-rrZuser_config_dir�kindsr&r'r%)Zglobal_config_filesZsite_config_fileZlegacy_config_fileZnew_config_filerrr�get_configuration_filesLs �
�
�
�r4cs�eZdZdZd-�fdd�	Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z�ZS).�
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.
    Nc
s�tt|���tjtjtjdg}||vrJtd�d�	t
t|dd������||_||_
tjtjtjtjtjg|_ddg|_dd�|jD�|_dd�|jD�|_g|_dS)	Nz5Got invalid value for load_only - should be one of {}z, ����version�helpcSsi|]
}|g�qSrr�r.�variantrrr�
<dictcomp>�sz*Configuration.__init__.<locals>.<dictcomp>cSsi|]
}|i�qSrrr9rrrr;�s)�superr5�__init__r3r%r&r'rrr,�map�repr�isolated�	load_onlyr(r)�_override_order�_ignore_env_names�_parsers�_config�_modified_parsers)�selfr@rAZ_valid_load_only��	__class__rrr=qs(���
��zConfiguration.__init__cCs|��|js|��dS)zELoads configuration from configuration files and environment
        N)�_load_config_filesr@�_load_environment_vars�rGrrr�load�szConfiguration.loadcCs:|jdusJd��z|��dWSty4YdS0dS)z@Returns the file with highest priority in configuration
        Nz)Need to be specified a file to be editingr)rA�_get_parser_to_modify�
IndexErrorrLrrr�get_file_to_edit�s�zConfiguration.get_file_to_editcCs
|j��S)z`Returns key-value pairs like dict.items() representing the loaded
        configuration
        )�_dictionary�itemsrLrrrrR�szConfiguration.itemscCs2z|j|WSty,td�|���Yn0dS)z,Get a value from the configuration.
        �No such key - {}N)rQ�KeyErrorrr)rG�keyrrr�	get_value�szConfiguration.get_valuecCst|��|jsJ�|��\}}|durTt|�\}}|�|�sF|�|�|�|||�||j|j|<|�||�dS)z-Modify a value in the configuration.
        N)	�_ensure_have_load_onlyrArNr!�has_sectionZadd_section�setrE�_mark_as_modified)rGrU�value�fname�parser�sectionrrrr�	set_value�s


zConfiguration.set_valuecCs�|��|jsJ�||j|jvr0td�|���|��\}}|dur�t|�\}}|�|�rf|�||�sntd��|�	|�s�|�
|�|�||�|j|j|=dS)z#Unset a value in the configuration.rSNz4Fatal Internal error [id=1]. Please report as a bug.)rWrArErrrNr!rXZ
remove_optionrRZremove_sectionrZ)rGrUr\r]r^rrrr�unset_value�s"


��

zConfiguration.unset_valuec	Csl|��|jD]X\}}t�d|�ttj�|��t|d��}|�	|�Wd�q1s\0YqdS)z*Save the current in-memory state.
        z
Writing to %s�wN)
rWrF�logger�inforr*r+�dirname�open�write)rGr\r]�frrr�save�szConfiguration.savecCs$|jdurtd��t�d|j�dS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rArrb�debugrLrrrrW�s
z$Configuration._ensure_have_load_onlycCs$i}|jD]}|�|j|�q
|S)z<A dictionary representing the loaded configuration.
        )rB�updaterE)rGZretvalr:rrrrQ�s
zConfiguration._dictionarycCs�t|���}|tjdd�tjgkr4t�d�dS|��D]V\}}|D]H}|j	durp||j	krpt�d||�qH|�
||�}|j|�||f�qHq<dS)z5Loads configuration from configuration files
        rrzZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s))
�dict�iter_config_filesr3r(r*�devnullrbrirRrA�
_load_filerD�append)rG�config_filesr:�filesr\r]rrrrJ	s��z Configuration._load_config_filescCsLt�d||�|�|�}|��D]&}|�|�}|j|�|�||��q |S)Nz'For variant '%s', will try loading '%s')rbri�_construct_parserZsectionsrRrErj�_normalized_keys)rGr:r\r]r^rRrrrrn$s

zConfiguration._load_filec
Cs�t��}tj�|�r|z|�|�WnXtyLtd�t	�
d��|d��Yn0tjyz}zt|d��WYd}~n
d}~00|S)Nzcontains invalid {} charactersF)�reasonr\)�error)r�RawConfigParserr*r+�exists�read�UnicodeDecodeErrorrr�locale�getpreferredencoding�Error)rGr\r]rurrrrr/s��
 zConfiguration._construct_parsercCs"|jtj�|�d|����dS)z7Loads configuration from environment variables
        z:env:N)rEr3r)rjrs�get_environ_varsrLrrrrKFs�z$Configuration._load_environment_varscCs.i}|D] \}}|dt|�}|||<q|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)rGr^rRZ
normalizedr�valrUrrrrsNs

zConfiguration._normalized_keysccsRtj��D]B\}}|�d�o0|dd���|jv}|r
|dd���|fVq
dS)z@Returns a generator with all environmental vars with prefix PIP_ZPIP_�N)r*�environrRrrrC)rGrUr~Zshould_be_yieldedrrrr}[s
�zConfiguration.get_environ_varsccs�tj�dd�}|dur&tj|gfVntjgfVt�}tj|tjfV|job|o`tj�	|�}|rztj
|tj
fVtj|tjfVdS)zYields variant and configuration files associated with it.

        This should be treated like items of a dictionary.
        ZPIP_CONFIG_FILEN)r*r��getr3r(r4r&r@r+rwr%r')rGZconfig_filerpZshould_load_user_configrrrrlgs	�zConfiguration.iter_config_filescCs
|j|S)z#Get values present in a config file)rE)rGr:rrr�get_values_in_config�sz"Configuration.get_values_in_configcCs*|js
J�|j|j}|s"td��|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.r6)rArDr)rGZparsersrrrrN�s
�z#Configuration._get_parser_to_modifycCs"||f}||jvr|j�|�dS)N)rFro)rGr\r]Zfile_parser_tuplerrrrZ�s
zConfiguration._mark_as_modifiedcCsd�|jj|j�S)Nz{}({!r}))rrI�__name__rQrLrrr�__repr__�szConfiguration.__repr__)N)r��
__module__�__qualname__�__doc__r=rMrPrRrVr_r`rhrW�propertyrQrJrnrrrKrsr}rlr�rNrZr��
__classcell__rrrHrr5cs.
	


r5))r�rzZloggingr*r1Zpip._vendor.six.movesrZpip._internal.exceptionsrrZpip._internal.utilsrZpip._internal.utils.compatrrZpip._internal.utils.miscrr	Zpip._internal.utils.typingr
�typingrrr
rrrrrv�strrZ	getLoggerr�rbrr!r3r-r4�objectr5rrrr�<module>s6
$


�