JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.opt-1.pyc

a

[��fa3�@s>dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZmZddl
mZmZddlmZddlmZddlmZddlmZmZejZe
d	e�Zer�d
ndZdZed
ddddd�Zejej ej!ej"ej#fZ$ej ejej!fZ%ee&�Z'eed�dd�Z(ee	ed�dd�Z)eee	efd�dd�Z*Gdd�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
�N)�Any�Dict�Iterable�List�NewType�Optional�Tuple)�ConfigurationError�!ConfigurationFileCouldNotBeLoaded)�appdirs)�WINDOWS)�	getLogger)�
ensure_dir�enum�Kindzpip.inizpip.conf)�version�help�user�globalZsite�envzenv-var)�USER�GLOBAL�SITE�ENV�ENV_VAR)�name�returncCs*|���dd�}|�d�r&|dd�}|S)zAMake a name consistent regardless of source (environment or file)�_�-z--�N)�lower�replace�
startswith)r�r#�?/usr/lib/python3.9/site-packages/pip/_internal/configuration.py�_normalize_name2s
r%cCs&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_messager#r#r$�_disassemble_key:s��r*�rcCstdd�t�d�D�}tj�tjt�}tj�tj�d�t	r<dndt�}tj�t�
d�t�}tj|tj
|gtj||giS)NcSsg|]}tj�|t��qSr#)�os�path�join�CONFIG_BASENAME)�.0r-r#r#r$�
<listcomp>Esz+get_configuration_files.<locals>.<listcomp>Zpip�~z.pip)rZsite_config_dirsr,r-r.�sys�prefixr/�
expanduserrZuser_config_dir�kindsrrr)Zglobal_config_filesZsite_config_fileZlegacy_config_fileZnew_config_filer#r#r$�get_configuration_filesDs�

�
�r7cs�eZdZdZd6eeedd��fdd�
Zdd�dd�Zee	d�d	d
�Z
eee	e
fd�dd�Ze	e
d
�dd�Ze	e
dd�dd�Ze	dd
�dd�Zdd�dd�Zdd�dd�Zeee	e
fd�dd��Zdd�dd�Zee	ed�dd�Ze	ed �d!d"�Zdd�d#d$�Ze	eee	e
fee	e
fd%�d&d'�Zeee	e	fd�d(d)�Zeeeee	fd�d*d+�Zeee	e
fd,�d-d.�Z ee	efd�d/d0�Z!e	edd1�d2d3�Z"e	d�d4d5�Z#�Z$S)7�
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_onlyrcsjt���|dur4|tvr4td�d�ttt�����||_||_	dd�t
D�|_dd�t
D�|_g|_
dS)Nz5Got invalid value for load_only - should be one of {}z, cSsi|]
}|g�qSr#r#�r0�variantr#r#r$�
<dictcomp>rsz*Configuration.__init__.<locals>.<dictcomp>cSsi|]
}|i�qSr#r#r;r#r#r$r=us)�super�__init__�VALID_LOAD_ONLYr	r(r.�map�reprr9r:�OVERRIDE_ORDER�_parsers�_config�_modified_parsers)�selfr9r:��	__class__r#r$r?es 
����zConfiguration.__init__r+cCs|��|js|��dS)z<Loads configuration from configuration files and environmentN)�_load_config_filesr9�_load_environment_vars�rGr#r#r$�loadzszConfiguration.loadcCs(z|��dWSty"YdS0dS)z7Returns the file with highest priority in configurationrN)�_get_parser_to_modify�
IndexErrorrLr#r#r$�get_file_to_edit�szConfiguration.get_file_to_editcCs
|j��S)z`Returns key-value pairs like dict.items() representing the loaded
        configuration
        )�_dictionary�itemsrLr#r#r$rR�szConfiguration.items)�keyrcCs2z|j|WSty,td|����Yn0dS)z#Get a value from the configuration.�No such key - N)rQ�KeyErrorr	)rGrSr#r#r$�	get_value�szConfiguration.get_value)rS�valuercCsj|��|��\}}|durJt|�\}}|�|�s<|�|�|�|||�||j|j|<|�||�dS)z$Modify a value in the configuration.N)	�_ensure_have_load_onlyrNr*�has_sectionZadd_section�setrEr:�_mark_as_modified)rGrSrW�fname�parser�sectionrr#r#r$�	set_value�s

zConfiguration.set_valuecCs�|��||j|jvr&td|����|��\}}|dur�t|�\}}|�|�r\|�||�sdtd��|�|�sx|�	|�|�
||�|j|j|=dS)z#Unset a value in the configuration.rTNz4Fatal Internal error [id=1]. Please report as a bug.)rXrEr:r	rNr*rYZ
remove_optionrRZremove_sectionr[)rGrSr\r]r^rr#r#r$�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)
rXrF�logger�inforr,r-�dirname�open�write)rGr\r]�fr#r#r$�save�szConfiguration.savecCs$|jdurtd��t�d|j�dS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)r:r	rb�debugrLr#r#r$rX�s
z$Configuration._ensure_have_load_onlycCs"i}tD]}|�|j|�q|S)z3A dictionary representing the loaded configuration.)rC�updaterE)rGZretvalr<r#r#r$rQ�szConfiguration._dictionarycCs�t|���}|tjdd�tjgkr4t�d�dS|��D]V\}}|D]H}|j	durp||j	krpt�d||�qH|�
||�}|j|�||f�qHq<dS)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_filesr6rr,�devnullrbrirRr:�
_load_filerD�append)rG�config_filesr<�filesr\r]r#r#r$rJ�s�z Configuration._load_config_files)r<r\rcCsLt�d||�|�|�}|��D]&}|�|�}|j|�|�||��q |S)Nz'For variant '%s', will try loading '%s')rb�verbose�_construct_parserZsectionsrRrErj�_normalized_keys)rGr<r\r]r^rRr#r#r$rn�s

zConfiguration._load_file)r\rc
Cs�t��}tj�|�r|z|�|�WnXtyLtd�t	�
d��|d��Yn0tjyz}zt|d��WYd}~n
d}~00|S)Nzcontains invalid {} charactersF)�reasonr\)�error)�configparser�RawConfigParserr,r-�exists�read�UnicodeDecodeErrorr
r(�locale�getpreferredencoding�Error)rGr\r]rvr#r#r$rss��
 zConfiguration._construct_parsercCs"|jtj�|�d|����dS)z.Loads configuration from environment variablesz:env:N)rEr6rrjrt�get_environ_varsrLr#r#r$rKs�z$Configuration._load_environment_vars)r^rRrcCs.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�valrSr#r#r$rt"s

zConfiguration._normalized_keysccsDtj��D]4\}}|�d�r
|dd���}|tvr
||fVq
dS)z@Returns a generator with all environmental vars with prefix PIP_ZPIP_�N)r,�environrRr"r �ENV_NAMES_IGNORED)rGrSr�rr#r#r$r0s

zConfiguration.get_environ_varsccs�tj�dd�}|dur&tj|gfVntjgfVt�}tj|tjfV|job|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��getr6rr7rr9r-ryrr)rGZconfig_filerpZshould_load_user_configr#r#r$rl9s�zConfiguration.iter_config_files)r<rcCs
|j|S)z#Get values present in a config file)rE)rGr<r#r#r$�get_values_in_configWsz"Configuration.get_values_in_configcCs |j|j}|std��|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.���)rDr:r	)rG�parsersr#r#r$rN[s�z#Configuration._get_parser_to_modify)r\r]rcCs"||f}||jvr|j�|�dS)N)rFro)rGr\r]Zfile_parser_tupler#r#r$r[is
zConfiguration._mark_as_modifiedcCs|jj�d|j�d�S)N�(�))rI�__name__rQrLr#r#r$�__repr__nszConfiguration.__repr__)N)%r��
__module__�__qualname__�__doc__�boolrrr?rM�strrPrrrrRrVr_r`rhrX�propertyrrQrJrxrnrsrKrtrrrlr�rNr[r��
__classcell__r#r#rHr$r8Ws2
	

�	r8),r�rwr|r,r3�typingrrrrrrrZpip._internal.exceptionsr	r
Zpip._internal.utilsrZpip._internal.utils.comp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