+
    {:jII                       R t ^ 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Ht ^ RIHt ^ RIHt ^R	IHt ^R
IHtHt ^RIHt ]'       d   ^ RIHtHtHt ^RIHt ]P@                  ! ]!4      t"Rt#Rt$Rt%R]#RRR]%RR4RRRRR]$/t&/ t']&PQ                  4        F*  w  t)t*]+! ]*],4      '       d   ])]']*&   K  ]* F  t-])]']-&   K
  	  K,  	  R0t.R0t/ ! R R]4      t0 ! R R]4      t1 ! R R 4      t2]'       d    ! R! R"]4      t3 ! R# R$]]R%7      t4]	 ! R& R'4      4       t5]	 ! R( R)]54      4       t6R* t7 ! R+ R,]Pp                  R-7      t9R. R/ lt:R0 R1 lt;R2 R3 lt<R# )5z_
Abstract base class for CondaIndexCache, which stores and loads repository index
information.
)annotationsN)	dataclass)Enum)Path)TYPE_CHECKING	TypedDict)
BadZipFile)package_streaming)yaml)CONDA_PACKAGE_EXTENSIONS	_checksum)	MinimalFS)IOAnyIterator)FileInfoinfo/index.jsonzinfo/icon.pngzinfo/paths.json
index_jsonaboutzinfo/about.jsonpathsreciperun_exportsinfo/run_exports.jsonpost_installinfo/post_install.jsoniconc                      ] tR t^ItRtRtR# )UpstreamStagesfs N)__name__
__module____qualname____firstlineno__LOCAL_FILE_UPSTREAM_STAGE__static_attributes__r       7lib/python3.14/site-packages/conda_index/index/cache.pyr   r   I   s     $r&   r   c                      ] tR t^NtRtRtRtR# )IndexedStagesindexedmdr   N)r    r!   r"   r#   INDEXED_STAGEMETADATA_INDEXED_STAGEr%   r   r&   r'   r)   r)   N   s    M "r&   r)   c                  ,    ] tR t^WtR tRR R lltRtR# )cacherc                	    Wn         R # Nwrapped)selfr3   s   &&r'   __init__cacher.__init__X   s    r&   Nc                   V ^8  d   QhRR/# )   returnr   r   )formats   "r'   __annotate__cacher.__annotate__[   s      S r&   c                	|    V'       d4   V P                  V4      p\        WP                   P                  V4       V# V # r1   )r3   setattrr    )r4   instobjtypevalues   &&& r'   __get__cacher.__get__[   s1    LL&ED,,//7Lr&   r2   r1   )r    r!   r"   r#   r5   rB   r%   r   r&   r'   r/   r/   W   s     r&   r/   c                  6    ] tR t^et$ R]R&   R]R&   R]R&   RtR# )	ChangedPackagestrpathzfloat | intmtimeintsizer   Nr    r!   r"   r#   __annotations__r%   r   r&   r'   rE   rE   e   s    		r&   rE   c                  :    ] tR t^jt$ RtR]R&   R]R&   R]R&   RtR# )	HasChecksumsAndSizez.
Enforce keys accessed in conda-index store()

str | Nonemd5sha256rI   rJ   r   Nr    r!   r"   r#   __doc__rL   r%   r   r&   r'   rN   rN   j   s    	 	r&   rN   )extra_itemsc                  6    ] tR t^tt$ R]R&   R]R&   R]R&   RtR# )IndexedPackageszdict[str, dict[str, Any]]packagespackages_condapackages_whlr   NrK   r   r&   r'   rV   rV   t   s    ''--++r&   rV   c                  &    ] tR t^{t$ RtR]R&   RtR# )IndexedShardz,
IndexedPackages for a single package name.
rF   namer   NrR   r   r&   r'   r[   r[   {   s     Ir&   r[   c                    V P                  R4      ;p'       d   \        P                  V4      V R&   V P                  R4      ;p'       d   \        P                  V4      V R&   V # )z!
Convert hex checksums to bytes.
rQ   rP   )getbytesfromhex)recordrQ   rP   s   &  r'   pack_recordrb      sV     H%%v% ==0xjjsc*uMr&   c                     ] tR t^tRRRRR]P
                  P                  R. R]RR/R	 R
 llt]	P                  R R l4       tR R ltR R ltR R lt]R R l4       tR R ltR R lt]R R l4       tR R ltR R ltR R  ltR;R! R" lltR# R$ lt]	P                  R% R& l4       t]	P                  R' R( l4       tR;R) R* llt]	P                  R+ R, l4       tR- R. ltR/ R0 lt]	P                  R1 R2 l4       t ]	P                  R3 R4 l4       t!]	P                  R;R5]"/R6 R7 lll4       t#]	P                  R8 R9 l4       t$R:t%R# )<BaseCondaIndexCacher   Nchannel_urlupstream_stageinclude_stagespackage_extensionsupdate_onlyFc               8    V ^8  d   QhRRRRRRRRR	RR
RRRRR/# )r8   channel_root
Path | strsubdirrF   r   zMinimalFS | Nonere   rO   rf   rg   z	list[str]rh   ztuple[str, ...]ri   boolr   )r:   s   "r'   r;    BaseCondaIndexCache.__annotate__   sZ     %( %( %( %(
 %(  %( %( "%( ,%( %(r&   c                  W n         \        V4      V n        \        W4      V n        \        WR4      V n        WPn        W`n        Wpn        Wn        T;'       g    \        4       V n
        T;'       g    \        V4      V n        V P                  P                  4       '       g   V P                  P                  RR7       RV n        R# )a  
channel_root: directory containing platform subdir's, e.g. /clones/conda-forge
subdir: platform subdir, e.g. 'linux-64'
fs: MinimalFS (designed to wrap fsspec.spec.AbstractFileSystem); optional.
channel_url: base url if fs is used; optional.
upstream_stage: default stage from 'stat' table used to track available packages. Default is 'fs'.
update_only: skip "delete from stat where stage='fs'" operation.
z.cacheT)parentsFN)rm   r   rk   subdir_path	cache_dirrf   rg   rh   ri   r   r   rF   re   existsmkdircache_is_brand_new)	r4   rk   rm   r   re   rf   rg   rh   ri   s	   &&&$$$$$$r'   r5   BaseCondaIndexCache.__init__   s    *  .5lH=,,"4&##	&;;#l*;~~$$&&NN   . #(r&   c                   V ^8  d   QhRR/# r8   r9   Noner   )r:   s   "r'   r;   ro      s       r&   c                    R# )z'
Convert filesystem cache to database.
Nr   r4   s   &r'   convertBaseCondaIndexCache.convert       r&   c                   V ^8  d   QhRR/# ry   r   )r:   s   "r'   r;   ro      s      t r&   c                    R# )z,
Remove and close any database connections.
Nr   r|   s   &r'   closeBaseCondaIndexCache.close   r   r&   c                   V ^8  d   QhRR/# )r8   r9   rd   r   )r:   s   "r'   r;   ro      s      . r&   c                    V # )z
Return self.
r   r|   s   &r'   	__enter__BaseCondaIndexCache.__enter__   s	     r&   c                   V ^8  d   QhRR/# ry   r   )r:   s   "r'   r;   ro      s      T r&   c                &    V P                  4        R# )z
Call self.close()
N)r   )r4   exc_typeexc_valexc_tbs   &&&&r'   __exit__BaseCondaIndexCache.__exit__   s     	

r&   c                   V ^8  d   QhRR/# )r8   r9   rF   r   )r:   s   "r'   r;   ro      s       r&   c                    R# )z.
All paths must be prefixed with this string.
 r   r|   s   &r'   database_prefix#BaseCondaIndexCache.database_prefix   s    
 r&   c                    V ^8  d   QhRRRR/# )r8   fnrF   r9   r   )r:   s   "r'   r;   ro      s     - - - -r&   c                h    VP                  V P                  4      '       d   V# V P                   V 2# )z-
Return filename with database prefix added.
)
startswithr   r4   r   s   &&r'   database_path!BaseCondaIndexCache.database_path   s4     ==--..I&&'t,,r&   c                    V ^8  d   QhRRRR/# )r8   rG   rF   r9   r   )r:   s   "r'   r;   ro      s     ' 's 's 'r&   c                4    VP                  R^4      R,          # )z@
Return filename with any database-specfic prefix stripped off.
/)rsplit)r4   rG   s   &&r'   
plain_pathBaseCondaIndexCache.plain_path   s     {{3"2&&r&   c                   V ^8  d   QhRR/# )r8   r9   zre.Pattern[str]r   )r:   s   "r'   r;   ro      s     5 5_ 5r&   c           	     	    R P                  R \        V P                  \        RR7       4       4      p\        P
                  ! RV R24      # )|c              3  N   "   T F  p\         P                  ! V4      x  K  	  R # 5ir1   )reescape).0	extensions   & r'   	<genexpr>:BaseCondaIndexCache._package_section_re.<locals>.<genexpr>   s#      %
S	 IIi  Ss   #%T)keyreverse(z)$)joinsortedrh   lenr   compile)r4   extension_patterns   & r'   _package_section_re'BaseCondaIndexCache._package_section_re   sI    HH %
#D$;$;dS%
 
 zzA/0344r&   c                    V ^8  d   QhRRRR/# )r8   rG   rF   r9   rO   r   )r:   s   "r'   r;   ro      s     	4 	4S 	4Z 	4r&   c                	    R RRRRR/pV P                   P                  V4      pVf   R# VP                  VP                  ^4      4      # )z.tar.bz2rW   z.condazpackages.condaz.whlzpackages.whlN)r   searchr^   group)r4   rG   package_sectionsmatchs   &&  r'   package_section_for_path,BaseCondaIndexCache.package_section_for_path   sS    
&N

 ((//5=##EKKN33r&   c                    V ^8  d   QhRRRR/# )r8   r   rF   r9   z	IO[bytes]r   )r:   s   "r'   r;   ro      s     $ $s $y $r&   c                    V P                   P                  V P                  V P                  V4      pV P                   P	                  V4      # )z
Given a base package name "somepackage.conda", return an open, seekable
file object from our channel_url/subdir/fn suitable for reading that
package.
)r   r   re   rm   open)r4   r   abs_fns   && r'   r   BaseCondaIndexCache.open   s7     d..R@ww||F##r&   c               (    V ^8  d   QhRRRRRRRR/# )	r8   rk   rl   rm   rF   fn_infor   r9   0tuple[str, int, int, HasChecksumsAndSize | None]r   )r:   s   "r'   r;   ro      s,     
 
&
03
>F
	9
r&   c                >    V P                  WVP                  VR7      # )zF
fn_info: avoid having to call stat()  a second time on package file.
)stat_result)_extract_to_cacher   )r4   rk   rm   r   s   &&&&r'   extract_to_cache_info_object0BaseCondaIndexCache.extract_to_cache_info_object   s'     %%'**' & 
 	
r&   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r8   rk   rl   rm   rF   r   r   zFileInfo | Noner9   r   r   )r:   s   "r'   r;   ro   	  s<     # # # # 	#
 %# 
:#r&   c                	:   VfU   V P                   P                  V P                  V4      pV P                   P                  V4      pVR,          pVR,          pMIV P                   P                  V P                  V P
                  V4      pVP                  pVP                  pW8VR 3p	 \        P                  RW#4       V P                  W5Wx4      p
W8Wz3p	V	#   \        \        \        P                  \        \         3 d    \        P#                  RT4        T	# i ; i)NrJ   rH   zcache %s/%szError extracting %s)r   r   rr   statre   rm   st_sizest_mtimelogdebugextract_to_cache_unconditionalKeyErrorEOFErrorjsonJSONDecodeErrorr   OSError	exception)r4   rk   rm   r   r   r   	stat_dictrJ   rH   retvalr   s   &&&&&      r'   r   %BaseCondaIndexCache._extract_to_cache	  s     WW\\$"2"2B7FV,IV$Dg&EWW\\$"2"2DKKDF&&D((ED$&	5IImV0<<RUJ0F    
 	5 MM/4	5s   (,C A DDc          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r8   r   rF   r   rJ   rI   rH   r9   rN   r   )r:   s   "r'   r;   ro   .  s;     g gg"g*-g69g	gr&   c           
       a \        \        4      \        ,
          p0 Rmp/ pV P                  V4      ;_uu_ 4       o\	        \
        P                  ! VS4      4      pV EFX  w  rV
P                  V9   Ed   VP                  V
P                  4       V	P                  V
4      pVf(   \        P                  V RV
P                   R24       Ko  VP                  4       WzP                  &   V
P                  \        8X  dH   \        P                  ! WzP                  ,          4      pVP!                  R4      f   V\"        0,
          pV
P                  V9   d0   \%        WzP                  ,          4      WzP                  &   WV,
          pV'       d   EK2  VP'                  4        \        P)                  RV4       EK[  	  R V3R llpV! 4       w  rRRR4       V'       d=   VR08w  d5   \        P)                  V R	V R
\        VP+                  4       4       24       \        P                  ! VR,          4      p VP-                  \.        4      p\3        V4      VR&   0 RmpVP5                  4        UUu/ uF  w  ppVV9  g   K  VVbK  	  ppp/ VCRXRXRV/CpV P7                  WWGV4       V#   + '       g   i     L; i  \0         d    Rp Li ; iu uppi )z
Add or replace fn into cache, disregarding whether it is already cached.

Return index.json as dict, with added size, checksums.
Nr   z was not a regular filer   z%s early closec                   V ^8  d   QhRR/# )r8   r9   zIterator[str]r   )r:   s   "r'   r;   HBaseCondaIndexCache.extract_to_cache_unconditional.<locals>.__annotate__`  s     8 8} 8r&   c               3  `   <"   R F"  p SP                  ^ 4       \        SV 4      x  K$  	  R# 5i)zB
Use utility function that accepts open file instead of filename.
N)rP   rQ   )seekr   )	algorithmfileobjs    r'   	checksumsEBaseCondaIndexCache.extract_to_cache_unconditional.<locals>.checksums`  s*      "1ILLO#GY77 "1s   +.r   z	 missing z has r   r   r   rP   rQ   rJ   >   info/meta.yamlinfo/recipe/meta.yamlinfo/recipe/meta.yaml.rendered>
   ucsarchrH   binstarmachineplatform
has_prefixoperatingsystemrequires_featurestarget-triplet)setPATH_TO_TABLECOMPUTEDr   iterr	   stream_conda_infor\   removeextractfiler   warningreadINDEX_JSON_PATHr   loadsr^   	ICON_PATH_cache_reciper   r   keyspop
PATHS_PATHr   _cache_post_install_detailsitemsstore)r4   r   r   rJ   rH   wantedrecipe_want_onememberspackage_streamtarmemberreader
check_iconr   rP   rQ   raw_index_json	paths_strfilter_fieldskvfiltered_index_jsonr   r   s   &&&&&                  @r'   r   2BaseCondaIndexCache.extract_to_cache_unconditional.  sp    ]#h.
  YYr]]g!"3"E"Eb'"RSN-;;&(MM&++. __V4F~vha}<S$TU +1;;=GKK( {{o5%)ZZ0D%E
%>>&19%+yk%9F{{o5/<W[[=Q/R,!'!9v"((*II.3-  .48 8 $+KCI L f!8 99IIIfXU3w||~3F2GHI#zz'2C*DE	J/I -H	,R()
 ,113
3TQq7MDAqD3 	 
+
!+
3fD	+

 	

2UZ8c ]d  	I	$
s0   EJ-=J-7K  1KK-J=	 KKc               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r8   r   rF   rJ   rI   rH   r  zdict[str, str | bytes]r   rN   r9   rz   r   )r:   s   "r'   r;   ro     sF     
 

 
 	

 (
 (
 

r&   c                    R# )z2
Write a single package's index data to database.
Nr   )r4   r   rJ   rH   r  r   s   &&&&&&r'   r  BaseCondaIndexCache.store  r   r&   c                    V ^8  d   QhRRRR/# )r8   r   rF   r9   dict[str, Any]r   )r:   s   "r'   r;   ro     s      c n r&   c                    R# )z>
Load package data merged into a single dict for channeldata.
Nr   r   s   &&r'   load_all_from_cache'BaseCondaIndexCache.load_all_from_cache  r   r&   c                    V ^8  d   QhRRRR/# )r8   rr   zstr | Path | Noner9   rz   r   )r:   s   "r'   r;   ro     s     , ,): ,d ,r&   c                *  a a S P                   P                  S P                  S P                  4      o\        P                  RS P                  4       R V V3R llp\        P                  RS P                  4       S P                  V! 4       4       R# )zu
stat all files in subdir_path to compare against cached repodata.

subdir_path: implied from self.subdir; not used.
z
%s listdirc                   V ^8  d   QhRR/# )r8   r9   Iterator[dict[str, Any]]r   )r:   s   "r'   r;   7BaseCondaIndexCache.save_fs_state.<locals>.__annotate__  s     	 	6 	r&   c               3    <"   SP                   P                  S4       F  p V R ,          P                  SP                  4      '       g   K-  RV 9  g   RV 9  d2   V P	                  SP                   P                  V R ,          4      4       RSP                  SP                   P                  V R ,          4      4      RV P                  R4      RV R,          /x  K  	  R# 5i)r\   rH   rJ   rG   N)	r   listdirendswithrh   updater   r   basenamer^   )entryr4   
subdir_urls    r'   listdir_stat7BaseCondaIndexCache.save_fs_state.<locals>.listdir_stat  s     4V}--d.E.EFF%'6+>LLeFm!<=D..tww/?/?f/NOUYYw/E&M  5s   CC z%s save fs stateN)r   r   re   rm   r   r   store_fs_state)r4   rr   r(  r'  s   f& @r'   save_fs_state!BaseCondaIndexCache.save_fs_state  sd     WW\\$"2"2DKK@
		,,
	 	 			$dkk2LN+r&   c                    V ^8  d   QhRRRR/# )r8   stagerO   r(  r  r   )r:   s   "r'   r;   ro     s      /Gr&   c                    R# )z-
Save set of packages to a particular stage.
Nr   )r4   r.  r(  s   &&&r'   store_stat_state$BaseCondaIndexCache.store_stat_state  r   r&   c                   V ^8  d   QhRR/# r8   r(  r  r   )r:   s   "r'   r;   ro     s     
 
+C 
r&   c                Z    V P                  \        P                  P                  V4       R# )z%
Save set of packages to be indexed.
N)r0  r   r$   rA   )r4   r(  s   &&r'   r*  "BaseCondaIndexCache.store_fs_state  s#     	44::L	
r&   c                   V ^8  d   QhRR/# r3  r   )r:   s   "r'   r;   ro     s      +C r&   c           	         V Uu. uF  q"NK  	  ppV P                  \        P                  P                  V4       V F4  pV P	                  VR,          VR,          VR,          / VR,          4       K6  	  R# u upi )z
Save package metadata to cache and add write the package's index data to the
database. Useful for metadata only packages, including non-local packages.
rG   rJ   rH   repodataN)r0  r)   r-   rA   r  )r4   r(  r   statss   &&  r'   store_md_state"BaseCondaIndexCache.store_md_state  so    
 #//,$,/mBBHH%PDJJVVWZ   0s   
A7c                   V ^8  d   QhRR/# )r8   r9   zlist[ChangedPackage]r   )r:   s   "r'   r;   ro     s      "6 r&   c                    R# )zv
Compare upstream to 'indexed' state.

Return packages in upstream that are changed or missing compared to 'indexed'.
Nr   r|   s   &r'   changed_packages$BaseCondaIndexCache.changed_packages  r   r&   c                   V ^8  d   QhRR/# )r8   r9   rV   r   )r:   s   "r'   r;   ro     s      / r&   c                    R# )z7
Return all data for "monolithic repodata.json" query.
Nr   r|   s   &r'   indexed_packages$BaseCondaIndexCache.indexed_packages  r   r&   rb   c                    V ^8  d   QhRRRR/# )r8   desiredzset[str] | Noner9   zIterator[IndexedShard]r   )r:   s   "r'   r;   ro     s       
 
 r&   c                   R# )z0
indexed_shards with dataclass instead of dict.
Nr   )r4   rE  rb   s   &&$r'   indexed_shards"BaseCondaIndexCache.indexed_shards  r   r&   c                   V ^8  d   QhRR/# )r8   r9   zIterator[tuple[str, dict]]r   )r:   s   "r'   r;   ro     s      7 r&   c                    R# )z
Return run_exports data, to be formatted by
ChannelIndex.build_run_exports_data().

Include every package, with a default run_exports of {} if not present
for that package.
Nr   r|   s   &r'   r   BaseCondaIndexCache.run_exports   r   r&   )rs   rv   rk   re   r   rg   rh   rm   rr   ri   rf   r1   )&r    r!   r"   r#   r   r$   rA   r   r5   abcabstractmethodr}   r   r   r   propertyr   r   r   r/   r   r   r   r   r   r   r  r  r+  r0  r*  r:  r>  rB  rb   rG  r   r%   r   r&   r'   rd   rd      s   %(
  $%( #'%( -FFLL%( %'%( /G%( "%(N 	 

  -' 5 5	4$
#JgR 	
 
 	 
,: 	 
  	  	 
 	  	  	 r&   rd   )	metaclassc                    V ^8  d   QhRRRR/# )r8   paths_json_strstr | bytesr9   rF   r   )r:   s   "r'   r;   r;     s     !1 !1 !1 !1r&   c                   R RRRRRRRRRRRRR/pV '       Ed'   \         P                  ! V 4      P                  R. 4      pV F  pVP                  R	4      '       d8   VP                  R
4      R8X  d   RVR &   MVP                  R
4      R8X  d   RVR&   R FC  pVP                  V4      '       d   K  VR,          P                  RV 24      '       g   K?  RW&   KE  	  R FZ  pVP                  V4      '       d   K  \        P                  ! VR,          RV R24      '       g   KF  RWP                  RR4      &   K\  	  K  	  \         P                  ! V4      # )binary_prefixFtext_prefix
activate.ddeactivate.dpre_link	post_link
pre_unlinkr   prefix_placeholder	file_modebinaryTtext_pathz
etc/conda/z*/.*-z.*-_)rV  rW  )zpre-linkz	post-linkz
pre-unlink)r   r   r^   r   fnmatchreplacedumps)rQ  post_install_details_jsonr   fr  pats   &     r'   r  r    sQ   ueEUe! ~

>*..w; Auu)**55%1AE-o>UU;'61?C-m<3044Q77AgJ<Q<Q $= = 48-0	 4 ?044S99googJ%uB? ? HL-kk#s.CD	 ? & ::/00r&   c                    V ^8  d   QhRRRR/# )r8   recipe_readerrR  r9   rF   r   )r:   s   "r'   r;   r;   /  s     	 	 	 	r&   c                    \         P                  ! V 4      p \        P                  ! V4      pV#   \         d<    TP                  R / 4      P                  R4       \        P                  ! T4      p T# i ; i)requirementsbuild)r
   determined_loadr   rd  	TypeErrorr^   r   )ri  recipe_jsonrecipe_json_strs   &  r'   r   r   /  sk    &&}5K2**[1
 	  2+//8**[1	2s   0 AA65A6c               $    V ^8  d   QhRRRRRR/# )r8   ra   r  
field_namerF   r9   rz   r   )r:   s   "r'   r;   r;   ;  s&     X X XC XD Xr&   c                N   W9   d,    W,          P                  4       P                  R R4      W&   R# R#   \         df     RP                  Y,          4      P                  4       P                  R R4      Y&    R#   \         d    \
        P                  RT4         R# i ; ii ; i)
 r   z,Could not _clear_newline_chars from field %sN)striprc  AttributeErrorr   rn  r   r   )ra   rr  s   &&r'   clear_newline_charsrx  ;  s    
	X!'!3!9!9!;!C!CD#!NF   	XX GGF./557??cJ "  XJJWWX	Xs'   (4 B$ 7A::!B B$B  B$)r   r   r   )=rS   
__future__r   rL  rb  r   loggingr   dataclassesr   enumr   pathlibr   typingr   r   zipfiler   conda_package_streamingr	   r   r
   utilsr   r   r   r   r   r   r   r   	getLoggerr    r   r   r   r  TABLE_TO_PATHr   r  r  r  
isinstancerF   rG   TABLE_NO_CACHEr   r   r)   r/   rE   rN   rV   r[   rb   ABCMetard   r  r   rx  r   r&   r'   <module>r     s  
 # 
    	 !   +  5  7 ((!#	
 /Z  *,
I& !DAq!SaD"#M$ 	 " 
 %%%T %
"D "	 	  
iS  , , , ?  yCKK yx!1H	Xr&   