o Eca3@sBdZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZejZe d eZerRd nd Zd Zed dddddZejej ej!ej"ej#fZ$ej ejej!fZ%ee&Z'dedefddZ(dede efddZ)deee effddZ*GdddZ+dS)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 N)AnyDictIterableListNewTypeOptionalTuple)ConfigurationError!ConfigurationFileCouldNotBeLoaded)appdirs)WINDOWS) getLogger) ensure_direnumKindzpip.inizpip.conf)versionhelpuserglobalZsiteenvzenv-var)USERGLOBALSITEENVENV_VARnamereturncCs*|dd}|dr|dd}|S)zAMake a name consistent regardless of source (environment or file)_-z--N)lowerreplace startswith)rr#N/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/configuration.py_normalize_name2s  r%cCs&d|vr d|}t||ddS)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*cCstddtdD}tjtjt}tjtjdt rdndt}tjt dt}t j |t j |gt j||giS)NcSsg|] }tj|tqSr#)ospathjoinCONFIG_BASENAME).0r,r#r#r$ Esz+get_configuration_files..Zpip~z.pip)r Zsite_config_dirsr+r,r-sysprefixr. expanduserr Zuser_config_dirkindsrrr)Zglobal_config_filesZsite_config_fileZlegacy_config_fileZnew_config_filer#r#r$get_configuration_filesDs   r6cseZdZdZd7dedeeddffdd Zd8dd Zdee fd d Z de e e e ffd d Zde de fddZde de ddfddZde ddfddZd8ddZd8ddZedee e ffddZd8ddZdede defd d!Zde defd"d#Zd8d$d%Zd&e d'e e e e fdee e ffd(d)Zde e e e ffd*d+Zde e eee ffd,d-Zdedee e ffd.d/Z de e effd0d1Z!de d2eddfd3d4Z"de fd5d6Z#Z$S)9 ConfigurationaHandles 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. Nisolated load_onlyrcsjt|dur|tvrtddttt||_||_ ddt D|_ ddt D|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, cSsi|]}|gqSr#r#r/variantr#r#r$ rz*Configuration.__init__..cSsi|]}|iqSr#r#r:r#r#r$r<ur=)super__init__VALID_LOAD_ONLYr r(r-mapreprr8r9OVERRIDE_ORDER_parsers_config_modified_parsers)selfr8r9 __class__r#r$r?es  zConfiguration.__init__cCs||js |dSdS)ztj |tj fVtj |tj fVdS)zYields variant and configuration files associated with it. This should be treated like items of a dictionary. ZPIP_CONFIG_FILEN) r+rgetr5rr6rr8r,ryrr)rGZ config_filerpZshould_load_user_configr#r#r$rl9s zConfiguration.iter_config_filescCs |j|S)z#Get values present in a config file)rE)rGr;r#r#r$get_values_in_configWs z"Configuration.get_values_in_configcCs |j|j}|s td|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.)rDr9r )rGZparsersr#r#r$rN[s z#Configuration._get_parser_to_modifyr]cCs&||f}||jvr|j|dSdSN)rFro)rGr\r]Zfile_parser_tupler#r#r$r[is zConfiguration._mark_as_modifiedcCs|jjd|jdS)N())rI__name__rQrLr#r#r$__repr__nszConfiguration.__repr__r)rN)%r __module__ __qualname____doc__boolrrr?rMstrrPrrrrRrVr_r`rhrXpropertyrrQrJrxrnrsrKrtr~rrlrrNr[r __classcell__r#r#rHr$r7Ws<         r7),rrwr|r+r2typingrrrrrrrZpip._internal.exceptionsr r Zpip._internal.utilsr Zpip._internal.utils.compatr Zpip._internal.utils.loggingr Zpip._internal.utils.miscrrrxrrr.rr5rrrrrrCr@rrbr%r*r6r7r#r#r#r$s: $