8_dZddlmZddlZddlZddlZddlZddlmZddl m Z m Z ddl m Z mZddlmZddlmZdd lmZdd lmZmZejZe d eZerd nd ZdZedddddZejejej ej!ej"fZ#ejejej fZ$ee%Z&ddZ'd dZ(d!dZ)GddZ*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 ) annotationsN)Iterable)AnyNewType)ConfigurationError!ConfigurationFileCouldNotBeLoaded)appdirs)WINDOWS) getLogger) ensure_direnumKindzpip.inizpip.conf)versionhelpuserglobalsiteenvzenv-var)USERGLOBALSITEENVENV_VARnamestrreturnc|dd}|d}|S)zAMake a name consistent regardless of source (environment or file)_-z--)lowerreplace removeprefix)rs m/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/configuration.py_normalize_namer$5s7 ::<<  S ) )D   T " "D K list[str]c`d|vrd|d}t||ddS)N.zVKey does not contain dot separated section and key. Perhaps you wanted to use 'global.z ' instead?)rsplit)r error_messages r#_disassemble_keyr,<sO $ B15 B B B !/// ::c1  r%dict[Kind, list[str]]cdtjdD}tjt jt}tjtjdtrdndt}tjtj dt}tj |tj |gtj||giS)NcXg|]'}tj|t(S)ospathjoinCONFIG_BASENAME).0r2s r# z+get_configuration_files..Gs504 T?++r%pip~z.pip)r site_config_dirsr1r2r3sysprefixr4 expanduserr user_config_dirkindsrrr)global_config_filessite_config_filelegacy_config_filenew_config_files r#get_configuration_filesrCFs8?8PQV8W8Ww||CJ@@ 3$f gll7#:5#A#A?SSO ) %& '9 r%ceZdZdZd0d1fd Zd2d Zd3d Zd4dZd5dZd6dZ d7dZ d2dZ d2dZ e d8dZd2dZd9dZd:d Zd2d!Zd;d%Zdd*Zd?d,Zd@d.ZdAd/ZxZS)B 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. Nisolatedbool load_only Kind | NonerNonec zt|V|tvrMtddt tt||_||_ dtD|_ dtD|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, ci|]}|gSr0r0r5variants r# z*Configuration.__init__..ts-H H H #GRH H H r%ci|]}|iSr0r0rMs r#rOz*Configuration.__init__..ws'? ? ? #GR? ? ? r%)super__init__VALID_LOAD_ONLYrformatr3mapreprrFrHOVERRIDE_ORDER_parsers_config_modified_parsers)selfrFrH __class__s r#rRzConfiguration.__init__gs   Yo%E%E$GNNIIc$8899  ! "H H '5H H H  ? ? '5? ? ?  EGr%ch||js|dSdS)z !$%NOO O ;T^LLLLLr%dict[str, dict[str, Any]]c^i}tD]"}||j|#|S)z3A dictionary representing the loaded configuration.)rWrorY)r[retvalrNs r#rizConfiguration._dictionarys9 % 1 1G MM$,w/ 0 0 0 0 r%ct|}|tjddtjgkrt ddS|D]q\}}|D]i}|j (||j krt d||1| ||}|j | ||fjrdS)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)) dictiter_config_filesr>rr1devnullrrrjrH _load_filerXappend)r[ config_filesrNfilesr}r~s r#r^z Configuration._load_config_filessD224455  "1Q3 'BJ< 7 7 LLA    F*0022 ? ?NGU ? ?>-'T^2K2KLL!CUGTTT%88 g&--ufo>>>> ? ? ?r%rNrr}RawConfigParsercvtd||||}|D]r}||}|j||i|j|||||s|S)Nz'For variant '%s', will try loading '%s') rverbose_construct_parsersectionsrjrYr{ro_normalized_keys)r[rNr}r~rrjs r#rzConfiguration._load_files@'5QQQ''..(( W WGLL))E L ! , ,UB 7 7 7 L !% ( / /0E0Egu0U0U V V V V r%cNtj}tj|rrt jd} |||nE#t$rtd|d|tj $r}t|d}~wwxYw|S)NF)encodingzcontains invalid z characters)reasonr})r) configparserrr1r2existslocalegetpreferredencodingreadUnicodeDecodeErrorrError)r[r}r~locale_encodingrs r#rzConfiguration._construct_parser!s-// 7>>% E$9%@@O E EO <<<<%   7KKKK % E E E7eDDDD E sA -B" BB"c|jtjdi|jtjd|d|dS)z.Loads configuration from environment variablesz:env:N)rYr>rr{rorget_environ_varsr`s r#r_z$Configuration._load_environment_vars6sp U]#..w;;; U]#G,33  ! !'4+@+@+B+B C C     r%rrjdict[str, Any]cNi}|D]\}}|dzt|z}|||< |S)zNormalizes 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$)r[rrj normalizedrvalrks r#rzConfiguration._normalized_keys=sC  " "ID#C-/$"7"77C!JsOOr%Iterable[tuple[str, str]]c#KtjD]E\}}|dr+|dd}|t vr||fVFdS)z@Returns a generator with all environmental vars with prefix PIP_PIP_N)r1environrj startswithr ENV_NAMES_IGNORED)r[rkrrs r#rzConfiguration.get_environ_varsKst ((** $ $HC~~f%% $122w}}000)OOO  $ $r% Iterable[tuple[Kind, list[str]]]c#Ktjdd}t}tj|tjfV|j o!|otj| }|r tj |tj fVtj |tj fV|tj |gfVdStj gfVdS)aYields variant and configuration files associated with it. This should be treated like items of a dictionary. The order here doesn't affect what gets overridden. That is controlled by OVERRIDE_ORDER. However this does control the order they are displayed to the user. It's probably most ergonomic to display things in the same order as OVERRIDE_ORDER PIP_CONFIG_FILEN) r1rgetrCr>rrFr2rrrr)r[env_config_filershould_load_user_configs r#rzConfiguration.iter_config_filesTs*..):DAA.00 lL66666'+m"3#  ? ? ?9  # 7*l5:66 6 6 6j,uz22222  &)o.. . . . . .)R-     r%c|j|S)z#Get values present in a config file)rY)r[rNs r#get_values_in_configz"Configuration.get_values_in_configts|G$$r%tuple[str, RawConfigParser]cj|jsJ|j|j}|std|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.)rHrXr)r[parserss r#rdz#Configuration._get_parser_to_modifyxsF~~-/ $F  r{r%r~cX||f}||jvr|j|dSdSN)rZr)r[r}r~file_parser_tuples r#r|zConfiguration._mark_as_modifieds@"FO D$: : :  " ) )*; < < < < < ; :r%c0|jjd|jdS)N())r\__name__rir`s r#__repr__zConfiguration.__repr__s!.)AAD,<AAAAr%r)rFrGrHrIrrJ)rrJ)rrb)rrg)rkrrr)rkrrurrrJ)rkrrrJ)rr)rNrr}rrr)r}rrr)rrrjrgrr)rr)rr)rNrrr)rr)r}rr~rrrJ)rr)r __module__ __qualname____doc__rRrarfrjrtrrrrwpropertyrir^rrr_rrrrrdr|r __classcell__)r\s@r#rErEYs  GGGGGGG***** (((( B B B B....( 2 2 2 2D0MMMM    X ????.    *        $$$$    @%%%%    ==== BBBBBBBBr%rE)rrrr)rrrr&)rr-)+r __future__rrrr1r:collections.abcrtypingrrpip._internal.exceptionsrrpip._internal.utilsr pip._internal.utils.compatr pip._internal.utils.loggingr pip._internal.utils.miscr r rrrr4rr>rrrrrrWrSrrr$r,rCrEr0r%r#rs  #""""" $$$$$$('''''......11111155555555.wvs&6))J%         uz5:uy%-O*elEJ6 8  &sBsBsBsBsBsBsBsBsBsBr%