
    si*h                       S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJrJr  SS	KJr  SS
KJrJrJr  SSKJrJr  SSKJr  SSKJrJrJrJr  SSKJr  SSK J!r!  SSK"J#r#  \(       a  SSK$J%r%  SSKJ&r&J'r'  SSK(J)r)  \" \*5      r+/ r,\" SSSS9S'S j5       r- " S S\5      r. " S S\.5      r/S(S jr0\" SSS S9S)S! j5       r1S*S" jr2\" SS#S$S9    S+         S,S& jj5       r3g%)-z%Tools for fetching the current index.    )annotations)UserDict)	getLogger)TYPE_CHECKING)
IndexedSet   )contextvalidate_channels)
deprecated)CondaKeyErrorInvalidSpecPackagesNotFoundError)Channelall_channel_urls	MatchSpec)
EMPTY_LINKPackageCacheRecordPackageRecordPrefixRecord   )PackageCacheData)
PrefixData)
SubdirData)Iterable)AnySelf)PathTypez25.9z26.3z3Use `conda.base.context.validate_channels` instead.)addendumc                    [        U 5        g)a
  
Check if the given channel URLs are allowed by the context's allowlist.
:param channel_urls: A list of channel URLs to check against the allowlist.
:raises ChannelNotAllowed: If any URL is not in the allowlist.
:raises ChannelDenied: If any URL is in the denylist.
N)r
   )channel_urlss    0lib/python3.13/site-packages/conda/core/index.pycheck_allowlistr#   '   s     l#    c            	         \ rS rSrSrSSSSSSS\R                  S   S4	                   SS jjr\SS	 j5       r	\SS
 j5       r
\SS j5       rSSSSS.         S S jjrS!S jrS"S jr\SS j5       r\R                   S#S j5       rS$S jrS$S jrS$S jrS%S jrS&S jr      S'S jr      S'S jrS(S jrS)S jrS*S jrSrg)+Index6   a  The ``Index`` provides information about available packages from all relevant sources.

There are four types of sources for package information, namely

Channels
    represent packages available from standard sources identified with a url, mostly online,
    but can also be on a local filesystem using the ``file://`` scheme.
    Programatically, channels are represented by :class:`conda.models.channel.Channel`, their data
    is fetched using :class:`conda.core.subdir_data.SubdirData`.

    For more information see :ref:`concepts-channels`.

    Individual packages from channels are usually represented by :class:`conda.models.records.PackageRecord`.

Prefix
    represents packages that are already installed. Every :class:`Index` can be associated
    with exactly one Prefix, which is the location of one of the conda :ref:`concepts-conda-environments`.
    The package information about the installed packages is represented by :class:`conda.core.prefix_data.PrefixData`.

    Individual packages from prefixes are usually represented by :class:`conda.models.records.PrefixRecord`.

Package Cache
    represents packages that are locally unpacked, but may not be installed in the environment
    associated with this index. These are usually packages that have been installed in any environment
    of the local conda installation, but may have been removed from all environments by now.

    Individual packages from the package are usually represented by :class:`conda.models.records.PackageCacheRecord`.

Virtual Packages
    represent properties of the system, not actual conda packages in the normal sense. These are,
    for example, system packages that inform the solver about the operating system in use, or
    track features that can be used to steer package priority.

    Individual virtual packages are represented by special :class:`conda.models.records.PackageRecord`,
    see :meth:`conda.models.records.PackageRecord.virtual_package` and
    :meth:`conda.models.records.PackageRecord.feature`.
 TNFc
           	        [        U5      nU(       a  S/UQnU(       a  U[        R                  -  n[        U5      U l        U(       a  U(       a  [
        R                  SXC5        OUb  US4O[        R                  nX@l        Xl	        0 U l        [        5       U l
        U R                   H{  n
[        U
5      R                  SU5      nU Vs/ s H  n[        U5      PM     nnU Vs/ s H  n[        XS9PM     snU R                  U
'   U R                  R                  U5        M}     [        R!                  5         [        R#                  U R                  5        Uc  SU l        O,['        U[(        5      (       a  Xpl        O[)        U5      U l        Uc  [        R*                  (       a  SOUU l        Xl        gs  snf s  snf )a0  Initializes a new index with the desired components.

Args:
  channels: channels identified by canonical names or URLS or Channel objects;
    for more details, see :meth:`conda.models.channel.Channel.from_value`
  prepend: if ``True`` (default), add configured channel with higher priority than passed channels;
    if ``False``, do *not* add configured channels.
  platform: see ``subdirs``.
  subdirs: platform and subdirs determine the selection of subdirs in the channels;
    if both are ``None``, subdirs is taken from the configuration;
    if both are given, ``subdirs`` takes precedence and ``platform`` is ignored;
    if only ``platform`` is given, subdirs will be ``(platform, "noarch")``;
    if ``subdirs`` is given, subdirs will be ``subdirs``.
  use_local: if ``True``, add the special "local" channel for locally built packages with lowest priority.
  use_cache: if ``True``, add packages from the package cache.
  prefix: associate prefix with this index and add its packages.
  repodata_fn: filename of the repodata, default taken from config, almost always "repodata.json".
  use_system: if ``True``, add system packages, that is virtual packages defined by plugins, usually used
    to make intrinsic information about the system, such as cpu architecture or operating system, available
    to the solver.
localz#subdirs is %s, ignoring platform %sNnoarchT)repodata_fn)listr	   channelsr   	_channelslogwarningsubdirs_subdirs_repodata_fnexpanded_channelsr   urlsr   updateLAST_CHANNEL_URLSclearextendprefix_data
isinstancer   offline	use_cache
use_system)selfr/   prependplatformr3   	use_localr?   prefixr-   r@   channelr7   urlr6   expanded_channels                  r"   __init__Index.__init__]   sz   B >+(+H(((H#H-A7U.6.Bx*G'!+~~G7#((w7D9= ># > ):&(9$ +E(9&DMM'" ""))*;< & 	!  !7!78>#D
++%)&1D!*!2wI$! !?&s   F=)Gc                p     U R                   $ ! [         a    U R                  SS9   U R                   $ f = f)zdContents of the package cache if active.

Returns:
  All packages available from the package cache.
T)cache)_cache_entriesAttributeErrorreloadrA   s    r"   cache_entriesIndex.cache_entries   s<    	$&&& 	$KKdK#"""	$    55c                p     U R                   $ ! [         a    U R                  SS9   U R                   $ f = f)zrSystem packages provided by plugins.

Returns:
  Identity mapping of the available system packages in a ``dict``.
T)system)_system_packagesrN   rO   rP   s    r"   system_packagesIndex.system_packages   s<    	%((( 	%KKtK$$$$	%rS   c                p     U R                   $ ! [         a    U R                  SS9   U R                   $ f = f)zeActive tracking features.

Returns:
  Identity mapping of the local tracking features in a ``dict``.
T)features)	_featuresrN   rO   rP   s    r"   rZ   Index.features   s8    	'>>! 	'KKK&~~	'rS   )rE   rL   rZ   rU   c                  [        U S5      nU(       aB  U R                  (       a  U R                  R                  5         U(       a  U R                  5         U(       a1  [        R
                  " 5       U l        U(       a  U R                  5         U(       ah  [        R                   Vs0 s H  n[        R                  " U5      =ow_M     snU l        U(       a%  U R                  R                  U R                  5        U(       ab  [        R                   R#                  5        Vs0 s H  nX_M     snU l        U(       a&  U R                  R                  U R&                  5        gggs  snf s  snf )aw  Reload one or more of the index components.

Can be used to refresh the index with new information, for example after a new
package has been installed into the index.

Args:
  prefix: if ``True``, reload the prefix data.
  cache: if ``True``, reload the package cache.
  features: if ``True``, reload the tracking features.
  system: if ``True``, reload the system packages.
_dataN)hasattrr<   rO   "_supplement_index_dict_with_prefixr   get_all_extracted_entriesrM   !_supplement_index_dict_with_cacher	   track_featuresr   featurer[   r^   r8   rZ   plugin_managerget_virtual_package_recordsrV   rW   )	rA   rE   rL   rZ   rU   has_datatrack_featurerecpackages	            r"   rO   Index.reload   s    & 4)  '')779"2"L"L"ND668 &-%;%;%;M &--m<<B%;DN 

!!$--0  '55QQS%SG  S%D! 

!!$"6"67  %s   '"E'$E,c                    SR                  U R                  R                  5       5      nSU R                  R                   SU S3$ )N, <z(channels=[])>)joinr/   keys	__class____name__rA   r/   s     r"   __repr__Index.__repr__   s=    99T]]//124>>**+;xjDDr$   c                    [        UU R                  SU R                  SU R                  U R                  U R
                  U R                  S9	$ )a%  Create a reduced index with a subset of packages.

Can be used to create a reduced index as a subset from an existing index.

Args:
  specs: the specs that span the subset.

Returns:
  a reduced index with the same sources as this index, but limited to ``specs``
  and their dependency graph.
F)	specsr/   rB   r3   rD   r?   rE   r-   r@   )ReducedIndexr0   r4   r?   r<   r5   r@   )rA   rx   s     r"   get_reduced_indexIndex.get_reduced_index   sH     ^^MMnn##))

 
	
r$   c                t     U R                   $ ! [         a    U R                  5         U R                   s $ f = f)a  The entire index as a dict; avoid if possible.

Warning:
  This returns the entire contents of the index as a single identity mapping in
  a ``dict``. This may be convenient, but it comes at a cost because all sources
  must be fully loaded at significant overhead for :class:`~conda.models.records.PackageRecord`
  construction for **every** package.

  Hence, all uses of :attr:`data`, including all iteration over the entire index,
  is strongly discouraged.
)r^   rN   _realizerP   s    r"   data
Index.data  s3    	:: 	MMO::	s    &77c                    Xl         g N)r^   )rA   values     r"   r~   r   #  s    
r$   c                   U R                   c  gU R                   R                  5        H  nXR                  ;   a  U R                  U   nUR                  UR                  :X  aB  UR	                  S5      =(       d    [
        n[        R                  " X!US9U R                  U'   M}  UR                  nUR                  5       Ul	        U?
XR                  U'   M  XR                  U'   M     g)z8
Supplement the index with information from its prefix.
Nlinkr   )r<   iter_recordsr^   rF   getr   r   from_objectsrG   _Channel__canonical_name_PackageRecord__pkey)rA   prefix_recordcurrent_recordr   prefix_channels        r"   r`   (Index._supplement_index_dict_with_prefix'  s     # "--::<M

*!%M!:!))]-B-BB ),,V4B
D0<0I0I&D1DJJ}- &3%:%:N>L>P>P>RN;%:0=JJ}- -:

=)= =r$   c                    U R                    HT  nXR                  ;   a4  U R                  U   n[        R                  " X!5      U R                  U'   MF  XR                  U'   MV     g r   )rQ   r^   r   r   )rA   pcrecr   s      r"   rb   'Index._supplement_index_dict_with_cacheO  sT    ''E

"!%E!2$6$C$C"%

5! %*

5! (r$   c                   0 U l         U R                  R                  5        H<  nU H3  nU R                   R                  S UR	                  5        5       5        M5     M>     U R                  5         U R                  (       a  U R                  5         U R                   R                  U R                  5        U R                  (       a&  U R                   R                  U R                  5        g g )Nc              3  (   #    U  H  oU4v   M
     g 7fr   r(   ).0precs     r"   	<genexpr>!Index._realize.<locals>.<genexpr>_  s     !V;U4,;Us   )r^   r/   valuesr8   r   r`   r?   rb   rZ   r@   rW   )rA   subdir_datassubdir_datas      r"   r}   Index._realize[  s    
 MM002L+

!!!V;;S;S;U!VV  , 3 	//1>>224

$--(??JJd223 r$   c                V   [        U R                  R                  5       5       H  nU Hy  nUR                  UR                  R                  :w  a  M)  [        UR                  U5      5      nU(       d  ML  [        U5      S:  a  [        US5      eUS   nU(       d  Mu  Us  s  $    M     g )Nr   z1More than one matching package found in channels.r   )	reversedr/   r   subdirrF   r.   querylenr   )rA   keyr   r   prec_candidatesr   s         r"   _retrieve_from_channelsIndex._retrieve_from_channelsg  s    $T]]%9%9%;<L+::!4!4!;!;;"&{'8'8'=">&'!+'P  'q)4K  , = r$   c                   / n[        U R                  R                  5       5       Hc  nU HZ  n[        US5      (       a&  UR                  UR
                  R                  :w  a  M:  UR                  UR                  U5      5        M\     Me     U$ )Nr   )r   r/   r   r_   r   rF   r;   r   )rA   r   precsr   r   s        r"   _retrieve_all_from_channels!Index._retrieve_all_from_channelsx  sr    $T]]%9%9%;<L+3))cjjK<O<O<V<V.V[..s34  , =
 r$   c                   U R                   (       a&  U R                   R                  UR                  S 5      OS nU(       a  X2:X  a  U(       aw  UR                  UR                  :X  a5  UR                  S5      =(       d    [        n[
        R                  " X#US9nU$ UR                  nUR                  5       Ul        U?	Un U$ UnU$ )Nr   r   )
r<   r   namerF   r   r   r   rG   r   r   )rA   r   r   prefix_precr   r   s         r"   _update_from_prefixIndex._update_from_prefix  s     ?C>N>Nd&&**388T:TX;.<<;#6#66&??62@jD'44TTRD  &1%8%8N>L>P>P>RN;#8&D  #r$   c                |    U R                    H+  nX1:X  d  M
  U(       a  [        R                  " X#5      s  $ Us  $    U$ r   )rQ   r   r   )rA   r   r   r   s       r"   _update_from_cacheIndex._update_from_cache  s9     ''E|-::4GG L ( r$   c                @   [        U[        5      (       d  [        S[        U5      5      e U R                  U   $ ! [
         a     Of = fUR                  R                  S5      (       a    U R                  U   $ ! [         a     Of = fUR                  R                  S5      (       a    U R                  U   $ ! [         a     Of = fU R                  U5      nU R                  X5      nU R                  (       a  U R                  X5      nUc  [        U45      eU$ )Nz0Can only retrieve PackageRecord objects. Got {}.__@)r=   r   	TypeErrortyper^   rN   r   
startswithrW   KeyErrorendswithrZ   r   r   r?   r   )rA   r   r   s      r"   __getitem__Index.__getitem__  s   #}--BDI 	::c?" 		88t$$++C00 88S!!}}S)) ++C0''2>>**35D<C6""s3   ; 
AA,A; ;
BB,B; ;
CCc                :     X   ng! [         [        4 a     gf = f)NTF)r   r   )rA   r   _s      r"   __contains__Index.__contains__  s(    		A%x0 		s    c                   U R                   R                  U R                   5      nUR                  R                  U R                  5        SU R                  ;   a*  U R                  S   R	                  5       UR                  S'   U$ )Nr^   )rr   __new____dict__r8   copy)rA   insts     r"   __copy__Index.__copy__  sa    ~~%%dnn5T]]+dmm#%)]]7%;%@%@%BDMM'"r$   )rM   r0   r^   r[   r5   r4   rV   r/   r6   r<   r?   r@   )r/   zIterable[str | Channel]rB   boolrC   
str | Noner3   tuple[str, ...] | NonerD   r   r?   bool | NonerE   PathType | PrefixData | Noner-   r   r@   r   returnNone)r   ztuple[PackageCacheRecord, ...])r   "dict[PackageRecord, PackageRecord])
rE   r   rL   r   rZ   r   rU   r   r   r   r   str)rx   Iterable[MatchSpec]r   ry   )r   r   r   r   r   r   )r   r   r   PackageRecord | None)r   r   r   zlist[PackageRecord])r   r   r   r   r   r   )r   r   r   r   )r   r   r   r   )r   r   )rs   
__module____qualname____firstlineno____doc__r	   repodata_fnsrI   propertyrQ   rW   rZ   rO   ru   rz   r~   setterr`   rb   r}   r   r   r   r   r   r   r   __static_attributes__r(   r$   r"   r&   r&   6   s   $P -/#*.!%/3")"6"6r": B%)B% B% 	B%
 (B% B% B% -B%  B% B% 
B%H 
# 
# 
% 
% 
 
 *8 *8 	*8
 *8 *8 
*8XE
0  $ 
[[ &:P
*
4" (<	$
 
(<
	
6r$   r&   c            	         ^  \ rS rSrSrSSSSSSS\R                  S   S4	                     SU 4S jjjrSS	 jrSS
 jr	Sr
U =r$ )ry   i  a  Index that contains a subset of available packages.

Like :class:`Index`, this makes information about packages from the same four
sources available. However, the contents of the reduced index is limited to
a subset of packages relevant to a given specification.
This works by taking into account all packages that match the given specification
together with their dependencies and their dependencies dependencies, etc.

Note:
    See :meth:`Index.get_reduced_index` for convenient construction.
r(   TNFr)   c                `   > [         TU ]  UUUUUUUU	U
5	        Xl        U R                  5         g)zInitialize a new reduced index.

Args:
  specs: the collection of specifications that span the subset of packages.
  all other args: see :class:`Index`.
N)superrI   rx   _derive_reduced_index)rA   rx   r/   rB   rC   r3   rD   r?   rE   r-   r@   rr   s              r"   rI   ReducedIndex.__init__  s@    & 	
	
 
""$r$   c                    SR                  U R                  R                  5       5      nSU R                  R                   SU R
                   SU S3$ )Nrm   rn   z(spec=z, channels=[ro   )rp   r/   rq   rr   rs   rx   rt   s     r"   ru   ReducedIndex.__repr__  sH    99T]]//124>>**+6$**\(SVWWr$   c                  ^
^^^^ [        5       n[        5       m
[        5       m[        5       m[        5       mSU
UUU4S jjmSU4S jjnU R                  (       a  U" U R                  R                  5       6   T" U R                  6   T(       d  T(       a  T(       a\  TR                  5       nT
R                  U5        [        U5      nU R                  U5      nU" U6   UR                  U5        T(       a  M\  T(       aZ  TR                  5       nTR                  U5        [        US9nU R                  U5      nU" U6   UR                  U5        T(       a  MZ  T(       a  M  T(       a  M  U Vs0 s H  owU_M     snU l
        U R                  5         U R                  (       a  U R                  5         [        5       nU R                  R                  5        H-  nUR                  / UR                  QUR                   Q75        M/     UR                  ["        R                  5        U H'  n	[$        R&                  " U	5      nXpR                  U'   M)     U R                  R                  U R(                  5        g s  snf )Nc                 
  > [        [        U 5       Hn  nUR                  S5      nU(       a  UT;  a  TR                  U5        UR                  S5      nU(       d  ML  U H  nUT;  d  M  TR                  U5        M     Mp     g)zr
Add a package name or track feature from a MatchSpec to the pending set.

:param spec: The MatchSpec to process.
r   rc   N)mapr   get_raw_valueadd)	rx   specr   rc   ftr_namecollected_namescollected_track_featurespending_namespending_track_featuress	        r"   
push_specs6ReducedIndex._derive_reduced_index.<locals>.push_specs  su     Iu-))&1D7!%%d+!%!3!34D!E!>$2#+CC266x@ %3 .r$   c                   > U  H6  n UR                   nT" UR                  /UQS UR                   5       Q76   M8     g! [         a=  n[        R                  SUR	                  5       UR
                  S   5         SnA  gSnAff = f)zs
Process a package record to collect its dependencies and features.

:param record: The package record to process.
z"Skipping %s due to InvalidSpec: %sinvalid_specNc              3  4   #    U  H  n[        US 9v   M     g7f)rc   Nr   )r   r   s     r"   r   KReducedIndex._derive_reduced_index.<locals>.push_records.<locals>.<genexpr>%  s      (=H ":(=s   )combined_dependsr   r1   r2   	record_id_kwargsr   rc   )recordsrecordr   er   s       r"   push_records8ReducedIndex._derive_reduced_index.<locals>.push_records  s     "'-'>'>$ KK%(.(=(= " # KK<((*		.1
 s   ?
B	2BBr   )rx   zMatchSpec | strr   r   )r   r   r   r   )r   setr<   r   rx   popr   r   r   r8   r^   r`   r?   rb   r   rc   rZ   r	   r   rd   rW   )rA   r   r   r   r   new_recordsfeature_nameri   known_featuresknown_featurer   r   r   r   r   s             @@@@@r"   r   "ReducedIndex._derive_reduced_index  s   ,%#&5 !$	A 	A 	2 $**779:DJJ5$((*##D)  #>>tDk*{+  - )599;(,,\: = #>>tDk*{+ )( m55. +22'33h'2
//1>>224 ::$$&C!!"FC$6$6"F"FG 'g445+M''6C!JJsO , 	

$../! 3s   0I<)r^   rx   )rx   r   r/   ztuple[str, ...]rB   r   rC   r   r3   r   rD   r   r?   r   rE   r   r-   r   r@   r   r   r   r   r   )rs   r   r   r   r   r	   r   rI   ru   r   r   __classcell__)rr   s   @r"   ry   ry     s    
 %'#*.!%/3")"6"6r": %"% "% 	%
 % (% % % -%  % % 
% %BX[0 [0r$   ry   c                v   ^ [         R                  " U5      m[        U4S jU R                  5        5       5      $ )z
Check if a distribution string matches any package in the index.

:param index: The package index.
:param dist_str: The distribution string to match against the index.
:return: True if there is a match; False otherwise.
c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )match)r   r   
match_specs     r"   r   $dist_str_in_index.<locals>.<genexpr>b  s     A.$z%%.s   !)r   from_dist_stranyr   )indexdist_strr  s     @r"   dist_str_in_indexr  Y  s,     ((2JA%,,.AAAr$   z25.3z&Use `conda.core.Index.reload` instead.c                    [        U [        5      (       a  g[        R                  R	                  5        H  nXU'   M	     g)z
Loads and populates virtual package records from conda plugins
and adds them to the provided index, unless there is a naming
conflict.
:param index: The package index to supplement.
N)r=   r&   r	   re   rf   )r  rj   s     r"   _supplement_index_with_systemr  e  s5     %))EEG g Hr$   c                 `   SSK Jn Jn  [        R                  R                  S5      u  p#X1;   a  UnO,US:X  a  gUR                  5       (       a  U [        U5         nOg[        R                  " 5       nU[        R                  :w  a  U$ SSK	n[        UR                  R                  5       5      $ )z
Determine the architecture specification name for the current environment.

:return: The architecture name if available, otherwise None.
r   )_arch_namesnon_x86_machines-zosNr   )base.contextr  r  r	   r   splitisdigitint_native_subdirarchspec.cpur   cpuhost)r  r  target_plattarget_archmachinenative_subdirarchspecs          r"   get_archspec_namer"  s  s     =&~~33C8K&							c+./**,M&8<<$$&''r$   z26.9zFUse `conda.models.channel.all_channel_urls(context.channels)` instead.Nc                    U(       a  S/[        U 5      -   n U(       a  U [        R                  -  n Ub  US4O[        R                  n[	        XS9$ )aa  
Calculate the full list of channel URLs to use based on the given parameters.

:param channel_urls: Initial list of channel URLs.
:param prepend: Whether to prepend default channels to the list.
:param platform: The target platform for the channels.
:param use_local: Whether to include the local channel.
:return: The calculated list of channel URLs.
r+   r,   )r3   )r.   r	   r/   r3   r   )r!   rB   rC   rD   r3   s        r"   calculate_channel_urlsr$    sK    ( y4#55(((&.&:x"GL::r$   )r!   	list[str]r   r   )r  zdict[Any, Any]r  r   r   r   )r  r   r   r   )r   r   )r(   TNF)
r!   z
tuple[str]rB   r   rC   r   rD   r   r   r%  )4r   
__future__r   collectionsr   loggingr   typingr   boltons.setutilsr   r  r	   r
   deprecationsr   
exceptionsr   r   r   models.channelr   r   models.match_specr   models.recordsr   r   r   r   package_cache_datar   r<   r   r   r   collections.abcr   r   r   common.pathr   rs   r1   r9   r#   r&   ry   r  r  r"  r$  r(   r$   r"   <module>r3     s&   , "      ' 5 % 
 7 ) X X 0 # #( &   

B
$
$PH PfM05 M0`	B FF%MN
! O
!(: 

U  "	;;; ; 	;
 ;
;r$   