+
    kz=j>                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIt^ R	IHt ^ R
IHt ^ RIHtHt ^ RIHtHtHt ^ RIH t  ^ RI!H"t" ^ RI#H$t$  ^ RI%H&t' ^RI*H+t+H,t, ]'       d3   ^ RI-H.t. ^ RIH/t/ ^ RI0H1t1 ^ RI2H3t3 ^ RI4H5t5 ^ RI6H7t7 ^ RI8H9t9H:t: ^RI;H<t< ]Pz                  ! R]> 24      t?] ! R R4      4       t@R tA ! R R 4      tBR#   ]( d
    ^ RI)H't'  Li ; i)!    )annotationsN)	dataclass)partial)Path)	hexdigits)NamedTemporaryFile)TYPE_CHECKING)REPODATA_FN)context)DummyExecutorThreadLimitedThreadPoolExecutor)path_to_urlremove_authsplit_anaconda_token)PackageCacheData)
SubdirData)Channel)dumps)	json_dump)empty_repodata_dictrattler_record_to_conda_record)Iterable)Self)	PathsType)BuildRepodataSubset)Shards)	MatchSpec)PackageCacheRecordPackageRecord)SolverInputStatezconda.c                  N    ] tR t^.t$ RtR]R&   R]R&   R]R&   R]R&   R	]R
&   RtR# )_ChannelRepoInfozOA dataclass mapping conda Channels, rattler.SparseRepoData, URLs and JSON pathszChannel | Nonechannelzrattler.SparseRepoDatarepostrfull_url
noauth_urlz
str | None
local_json N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r)       :lib/python3.14/site-packages/conda_rattler_solver/index.pyr"   r"   .   s!    U
  MOr1   r"   c                 $    \        \        RR4      # )z;
Flag to see whether we should check for sharded repodata.
repodata_use_shardsT)getattrr   r)   r1   r2   _is_sharded_repodata_enabledr6   9   s     71488r1   c                  
   ] tR t^@tRR]R"RR3R R llt]R R l4       t]R R l4       t	R R	 lt
R#R
 R lltR R ltR R ltR R ltR$R R lltR R ltR R ltR$R R lltR R ltR R lt]R R l4       tR  tR!tR# )%RattlerIndexHelperNc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )   channelszIterable[Channel | str]subdirszIterable[str]repodata_fnr%   	pkgs_dirsr   in_statezSolverInputState | Nonebuild_repodata_subsetzBuildRepodataSubset | Noner)   )formats   "r2   __annotate__RattlerIndexHelper.__annotate__A   sF      )  	
  *  :r1   c                	   . V n         Vf   \        P                  MTV n        Vf   \        P                  MTV n        W0n        WPn        W`n        / V n	        V P                  P                  V P                  4       4       V'       dG   V P                  P                  V P                  V4       Uu/ uF  qwP                  VbK  	  up4       R # R # u upi N)_unlink_on_delr   r;   	_channelsr<   _subdirs_repodata_fnr?   r@   _indexupdate_load_channels_load_pkgs_cacher'   )selfr;   r<   r=   r>   r?   r@   infos   &&&&&&& r2   __init__RattlerIndexHelper.__init__A   s     +--5-=))8+2?' %:"354..01KK373H3H3ST3S4$&3ST Ts   0Cc                    V ^8  d   QhRRRR/# )r:   r#   r   returnr   r)   )rA   s   "r2   rB   rC   Z   s     ; ;' ;d ;r1   c           
     	   VP                   '       g   \        R V R24      hVP                   p\        R/ VP                  4       P	                  4        UUu/ uF  w  r4VR8w  g   K  W4bK  	  uppB pV ! V3V3R7      # u uppi )zChannel z" must define 'platform' attribute.platform)r;   r<   r)   )rU   
ValueErrorr   dumpitems)clsr#   subdirkvs   &&   r2   from_platform_aware_channel.RattlerIndexHelper.from_platform_aware_channelY   s~    xy0RSTT!!Yglln.B.B.DX.DdaZTQT.DXYWJ	:: Ys   A>&A>c                   V ^8  d   QhRR/# )r:   rS   zlist[Channel]r)   )rA   s   "r2   rB   rC   b   s     4 4- 4r1   c                	V    V P                    Uu. uF  p\        V4      NK  	  up# u upi rE   )rG   r   )rN   cs   & r2   r;   RattlerIndexHelper.channelsa   s"    $(NN3Nq
N333s   &c                    V ^8  d   QhRRRR/# )r:   r#   r   rS   Noner)   )rA   s   "r2   rB   rC   e   s      g $ r1   c                	8   / pVP                  R V P                  R7       Ff  pV P                  P                  4        FE  pVP                  V8X  g   K  \
        P                  RVP                  4       WVP                  &    Kd  	  Kh  	  V P                  V4      P                  4        Fm  pV P                  P                  4        FL  pVP                  VP                  8X  g   K   VP                  P                  4        VP                  Vn	         Kk  	  Ko  	  R# )Fwith_credentialsr<   zReloading repo %sN)urlsrH   rJ   valuesr'   logdebugr&   rL   r$   close)rN   r#   rh   url	repo_infonew_repo_infos   &&    r2   reload_channel!RattlerIndexHelper.reload_channele   s    <<<NC![[//1	''3.II193G3GH/6++,	 2 O "006==?M![[//1	''=+C+CCNN((*%2%7%7IN	 2 @r1   c               $    V ^8  d   QhRRRRRR/# )r:   reposz!Iterable[_ChannelRepoInfo] | Nonefilter_zcallable | NonerS   intr)   )rA   s   "r2   rB   rC   t   s(      0 ! 
	r1   c                	   ^ pVes   T;'       g    V P                   P                  4        FH  pVP                  P                  V P                  4       F  pV! V4      '       g   K  V^,          pK  	  KJ  	  V# T;'       g    V P                   P                  4        F.  pW4P                  P                  V P                  4      ,          pK0  	  V# )r   )rJ   ri   r$   load_all_records_package_formatrecord_count)rN   rs   rt   countrO   records   &&&   r2   
n_packagesRattlerIndexHelper.n_packagest   s    
 55!3!3!55"ii889M9MNFv
 O 6  55!3!3!55//0D0DEE 6r1   c                    V ^8  d   QhRRRR/# )r:   keyr%   rS   r"   r)   )rA   s   "r2   rB   rC      s        C  $4  r1   c                	    VP                  R 4      '       g   \        \        V4      4      ^ ,          pV P                  V,          # )zfile://)
startswithr   r   rJ   )rN   r   s   &&r2   get_infoRattlerIndexHelper.get_info   s6    ~~i(( '{3'78;C{{3r1   c                    V ^8  d   QhRRRR/# )r:   rm   r%   rS   ztuple[str, os.PathLike]r)   )rA   s   "r2   rB   rC      s      # *A r1   c                	   \         P                  ! V4      pVP                  '       g   \        R V 24      hR\        P
                  9   di   \        P                  P                  WP                  34      pV'       d7   VP                  \        R4      8X  d   \        P                  WP                  3 \        P                  RV4       \        W P                  R7      pVP                  P                  4       w  rVW3# )z.Channel URLs must specify a subdir! Provided: PYTEST_CURRENT_TESTinfz&Fetching %s with SubdirData.repo_fetch)r=   )r   from_urlrZ   rV   osenvironr   _cache_getrI   _mtimefloatrj   rk   
repo_fetchfetch_latest_path)rN   rm   r#   maybe_cachedsubdir_data	json_path_s   &&     r2   _fetch_channel!RattlerIndexHelper._fetch_channel   s    ""3'~~~McUSTT BJJ. &--1138I8I2JKL 3 3uU| C&&->->'?@ 			:GD 6G6GH"--??A	~r1   c               $    V ^8  d   QhRRRRRR/# )r:   rm   r%   r   rS   r"   r)   )rA   s   "r2   rB   rC      s"     
 
3 
3 
CS 
r1   c                	*   \         P                  ! V4      pVP                  R VP                  3R7      ^ ,          pVP	                  R^4      ^ ,          p\        V4      p\        P                  R8X  d   \        P                  P                  R4      '       d   \        P                  P                  R4      '       d   RP                  \        P                  ! \        ^R7      4      P                  4       pVP                   VP"                   RV R	2,          p\$        P&                  ! W'4       TpV P(                  P+                  V4       \,        P                   ! V4      p\,        P.                  ! WP                  V4      p	\1        V	VVVVR
7      # )Frf   /win32CIr    )r[   z.copy-.jsonr$   r#   r&   r'   r(   )r   r   rh   rZ   rsplitr   sysrU   r   r   r   joinrandomchoicesr   lowerparentstemshutilcopyrF   appendrattlerSparseRepoDatar"   )
rN   rm   r   r#   r'   noauth_url_sans_subdir
random_hex	path_copyrattler_channelr$   s
   &&&       r2   _json_path_to_repo_info*RattlerIndexHelper._json_path_to_repo_info   s1   ""3'\\57>>BS\TUVW
!+!2!23!:1!=O	LLG#

t$$

455 	Q!?@FFHJ!((inn-=VJ<u+UUIKK	-!I&&y1!//*@A%%o~~yQ! 
 	
r1   c                    V ^8  d   QhRRRR/# )r:   r;   zIterable[Channel | str] | NonerS   z
tuple[str]r)   )rA   s   "r2   rB   rC      s     * *,J *V` *r1   c                	@   . p\        4       pT;'       g    V P                   F  p\        V4      pVP                  R V P                  R7      pVP                  V4      '       d   KD  VP                  '       g   VP                  '       dA   V\        V4      P                  RV P                  R7      ,          pVP                  V4       K  V F-  pWs9  g   K  VP                  V4       VP                  V4       K/  	  K  	  \        \        P                  V4      4      # )Frf   T)setrG   r   rh   rH   
issupersetauthtokenrK   r   addtupledictfromkeys)rN   r;   rh   seen_noauth_cra   noauth_urlsrm   s   &&      r2   _urls_from_channels&RattlerIndexHelper._urls_from_channels   s    e,,dnn,BA&&%&OK%%k22vvv
t}}UU"";/ #)KK$OOC( # -" T]]4())r1   c                    V ^8  d   QhRRRR/# )r:   urls_to_channelzdict[str, Channel]rS   z"dict[str, _ChannelRepoInfo] | Noner)   )rA   s   "r2   rB   rC      s     > >1>	+>r1   c                F   . V P                   P                  P                  4       OV P                   P                  O5p\        P                  RV4       V P                  W!^R7      p\        P                  RVe   \        V4      MR4       Vf   R# V P                  V4      # )z
Load repository information from sharded repodata.

Returns None if shards are unavailable for the given channels, in which
case the caller falls back to the standard repodata.json path.
z'build_repodata_subset root_packages: %s)repodata_versionz+build_repodata_subset returned channels: %sN)	r?   	installedkeys	requestedrj   rk   r@   list_load_repo_info_from_shards)rN   r   root_packageschannel_datas   &&  r2   _load_channel_repo_info_shards1RattlerIndexHelper._load_channel_repo_info_shards   s     T$--11668S4==;R;RS		;]K11Q 2 
 			9".":D	
 //==r1   c                    V ^8  d   QhRRRR/# )r:   r   zdict[str, Shards]rS   dict[str, _ChannelRepoInfo]r)   )rA   s   "r2   rB   rC      s     - ---	$-r1   c           	     v   / pVP                  4        EF  w  r4\        P                  ! V4      P                  p\	        WSR7      pVP                  4        F  w  rxVP                  R4      '       d   WR,          V&   K)  VP                  R4      '       d   WR,          V&   KM  VP                  RR4      P                  R4      '       g   Kv  WR	,          R
,          V&   K  	  \        VR,          4      \        VR,          4      ,           \        VR	,          R
,          4      ,           p	\        P                  RV	V4       V	^ 8  dL   \        P                  R\        VR,          4      R,          \        VR,          4      R,          ,           4       \        RRRR7      ;_uu_ 4       p
V
P                  \        V4      4       RRR4       V P                  P!                  \#        X
P$                  4      4       V P'                  W:P$                  4      pWVP(                  &   EK  	  V#   + '       g   i     Ln; i)a(  
Convert a dict[url, Shards] returned by build_repodata_subset into
the same dict[noauth_url, _ChannelRepoInfo] format used by _load_channels.
Each Shards object is serialised to a temporary repodata JSON file so that
rattler.SparseRepoData can consume it without any changes to the rattler API.
base_url.tar.bz2packagesz.condapackages.condafnr   z.whlv3whlz/_load_repo_info_from_shards: %s packages for %sz1_load_repo_info_from_shards: sample filenames: %s:N   Nr   FwsuffixdeletemodeN)rX   r   r   rZ   r   iter_recordsendswithr   lenrj   rk   r   r   writer   rF   r   r   namer   r'   )rN   r   indexrm   shardsrZ   repodatafilenamer{   r|   frO   s   &&          r2   r   .RattlerIndexHelper._load_repo_info_from_shards   s    '--/KC%%c*11F*6@H$*$7$7$9 $$Z005;Z(2&&x00;A-.x8ZZb)226:: 7=TN5)(3 %: HZ()h/012htnU+,- 
 IIA
 A~		G*-.r2T(CS:T5UVX5YY $75sKKq	(+, L&&tAFF|4//VV<D%)$//"E 0F  LKs   'H((H8c                    V ^8  d   QhRRRR/# )r:   rh   zIterable[str] | NonerS   r   r)   )rA   s   "r2   rB   rC     s      #7 C^ r1   c           
     	   Vf   V P                  4       pV P                  '       dt   V P                  '       db   \        4       '       dR   V Uu/ uF  q"\        P
                  ! V4      bK  	  ppV P                  V4      pVe   V# \        P                  R4       \        P                  '       g   \        P                  ^8X  d   \        M\        \        \        P                  R7      pV! 4       ;_uu_ 4       pVP                  V P                  V4       UUu/ uF  w  r'V\!        V4      bK  	  pppR R R 4       / p	V F*  pV P#                  VXV,          4      p
WV
P$                  &   K,  	  V	# u upi u uppi   + '       g   i     LO; i)Nz=No sharded channels available. Fall back to non-sharded path.)max_workers)r   r?   r@   r6   r   r   r   rj   rk   r   repodata_threadsr   r   r   mapr   r%   r   r'   )rN   rh   rm   r   channel_repos_infoExecutorexecutorpathjsonsr   rO   s   &&         r2   rL   !RattlerIndexHelper._load_channels  sC   <++-D ===T777<X<Z<ZEIJTcG$4$4S$99TOJ!%!D!D_!U!-))IIUV
 }}} 8 8A = 8gF^F^_ 	
 ZZ87?||DDWDWY]7^_7^S#d)^7^E_  C//U3Z@D%)$//"  + K ` Zs$   E/9 E:E4
0E:4E::F
	c                    V ^8  d   QhRRRR/# )r:   r>   r   rS   zlist[_ChannelRepoInfo]r)   )rA   s   "r2   rB   rC   3  s     3 3) 38N 3r1   c                	d   . p\        R  V P                   4       4      pV EF  p\        V4      p\        V4      pVP	                  4        \        W5R7      p\        RVR7      pVP                  4        F  p	V	P                  V P                  9  d   K   \        V	P                  4       4      p
R F!  pW9   d   K  \        WR4      pVf   K  WV&   K#  	  V	P                  P                  R4      '       d   RMRpV	P                  '       d   WV,          V	P                  &   K  WV,          V	P                  &   K  	  RV3W733 F  w  r\        RRR	R
7      ;_uu_ 4       pVP                  \!        V4      4       RRR4       VP#                  \%        \&        P(                  ! \&        P*                  ! V4      VXP,                  4      \+        V4      VVVP,                  R7      4       V P.                  P#                  \1        VP,                  4      4       K  	  EK  	  V#   + '       g   i     L; i)c              3  6   "   T F  qR 8w  g   K  Vx  K  	  R# 5i)noarchNr)   ).0ss   & r2   	<genexpr>6RattlerIndexHelper._load_pkgs_cache.<locals>.<genexpr>5  s     @Ax-aas   
r   r   Nr   r   r   r   Fr   r   r   )sha256track_featureslicensesizerm   r   rU   	timestamp)nextrH   r   r   loadr   ri   rZ   r   rW   r5   r   r   r   r   r   r   r   r"   r   r   r   r   rF   r   )rN   r>   rs   rZ   r   path_as_urlpackage_cache_dataarchr   r{   record_datafieldvaluer   subdir_namer   r   s   &&               r2   rM   #RattlerIndexHelper._load_pkgs_cache3  s   @@@D%d+K!1$!7##%&vDD(KHF,335==5"6;;=1	E + #F48E(-2E*	 %+II$6$6z$B$BjHX===-83K		*+6Ifii(1 62 ,4V*<vn)M%'wu3OOSTGGIh/0 P$$33#OOK8'FF
 !( 4!,#.#$66
 ##**4<8! *N? ` ! POs   H	H/c                    V ^8  d   QhRRRR/# )r:   speczstr | MatchSpecrS   zIterable[PackageRecord]r)   )rA   s   "r2   rB   rC   h  s     = =? =/F =r1   c              #  	   "   \         P                  ! \        V4      4      pV P                  P	                  4        F3  pVP
                  P                  V.4       F  p\        V4      x  K  	  K5  	  R # 5irE   )r   r   r%   rJ   ri   r$   load_matching_recordsr   )rN   r  rO   r{   s   &&  r2   searchRattlerIndexHelper.searchh  sW       T+KK&&(D))994&A4V<< B )s   A3A5c                   V ^8  d   QhRR/# )r:   rS   zrattler.PackageFormatSelectionr)   )rA   s   "r2   rB   rC   o  s     
 
!? 
r1   c                	    \         P                  '       d   \        P                  P                  # \        P                  P
                  # rE   )r   use_only_tar_bz2r   PackageFormatSelectionONLY_TAR_BZ2PREFER_CONDA_WITH_WHL)rN   s   &r2   rx   "RattlerIndexHelper._package_formatn  s<     ''' **77	
 //EE	
r1   c                	   V P                   '       dV   V P                  P                  4        F  pVP                  P	                  4        K  	  V P                  P                  4        V P                    F  p VP                  R R7       K  	  R#   \         dL   p\        T\        P                  R7       \        T P                  \        P                  R7        Rp?Km  Rp?ii ; i)T)
missing_ok)fileN)rF   rJ   ri   r$   rl   clearunlink	Exceptionprintr   stderr)rN   rO   r   excs   &   r2   __del__RattlerIndexHelper.__del__v  s    **,		! -KK''D4t, (  4c

+dkk

334s   8BC&A C!!C&)rG   rJ   rI   rH   rF   r@   r?   r)   )NNrE   )r*   r+   r,   r-   r
   rP   classmethodr]   propertyr;   rp   r|   r   r   r   r   r   r   rL   rM   r  rx   r"  r0   r)   r1   r2   r8   r8   @   s     -1!%&!,0<@0 ; ; 4 4  &
6*.>,-^:3j= 
 

4r1   r8   )C
__future__r   loggingr   r   r   r   dataclassesr   	functoolsr   pathlibr   stringr   tempfiler   typingr	   r   conda.base.constantsr
   conda.base.contextr   conda.common.ior   r   conda.common.urlr   r   r   conda.core.package_cache_datar   conda.core.subdir_datar   conda.models.channelr   conda.common.serialize.jsonr   r   ImportErrorconda.common.serializeutilsr   r   collections.abcr   r   conda.common.pathr   conda.gateways.shardsr   conda.gateways.shards.typingr   conda.models.match_specr   conda.models.recordsr   r   stater    	getLoggerr*   rj   r"   r6   r8   r)   r1   r2   <module>rA     s    "  	   
 !    '    , & J K K : - (1> G(+931F'&
+,   9@4 @4M  101s   4C/ /C?>C?