a Rea3@s>dZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZejZe d eZerd nd Zd Zed dddddZejej ej!ej"ej#fZ$ej ejej!fZ%ee&Z'eedddZ(ee edddZ)eee efdddZ*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)versionhelpuserglobalsiteenvzenv-var)USERGLOBALSITEENVENV_VAR)namereturncCs*|dd}|dr&|dd}|S)zAMake a name consistent regardless of source (environment or file)_-z--N)lowerreplace startswith)rr$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/configuration.py_normalize_name2s  r&cCs&d|vrd|}t||ddS)N.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?)formatr split)r error_messager$r$r%_disassemble_key:sr,rcCstddtdD}tjtjt}tjtjdt rEsz+get_configuration_files..pip~z.pip)r site_config_dirsr.r/r0sysprefixr1 expanduserr user_config_dirkindsrrr)global_config_filessite_config_filelegacy_config_filenew_config_filer$r$r%get_configuration_filesDs   r@cseZdZdZd6eeeddfdd ZddddZee dd d Z e e e e fdd d Ze e d ddZe e ddddZe dd ddZddddZddddZeee e fdddZddddZee edddZe ed d!d"Zddd#d$Ze e e e e fee e fd%d&d'Ze e e e fdd(d)Ze e eee fdd*d+Zeee e fd,d-d.Z e e efdd/d0Z!e edd1d2d3Z"e dd4d5Z#Z$S)7 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. N)isolated load_onlyrcsjt|dur4|tvr4tddttt||_||_ ddt D|_ ddt D|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, cSsi|] }|gqSr$r$r2variantr$r$r% rsz*Configuration.__init__..cSsi|] }|iqSr$r$rDr$r$r%rFus)super__init__VALID_LOAD_ONLYr r)r0mapreprrBrCOVERRIDE_ORDER_parsers_config_modified_parsers)selfrBrC __class__r$r%rHes  zConfiguration.__init__r-cCs||js|dS)zs8 $