+
    {:j1=                       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HtHtHt ^ RIt^RIHtHt ^RIHtHtHtHtHtHtHt ^RIHt ^R	IH t  ]'       d	   ^R
IH!t!H"t" ]PF                  ! ]$4      t%Rt&Rt'Rt(R]&RRR](RRRRRRR]'/t)/ t*])PW                  4        F*  w  t,t-].! ]-]/4      '       d   ],]*]-&   K  ]- F  t0],]*]0&   K
  	  K,  	  R0t1R0t2 ! R R]4      t3R R lt4R# )z*
cache conda indexing metadata in sqlite.
)annotationsN)join)Path)TYPE_CHECKINGAnyIterableIterator)commonconvert_cache)BaseCondaIndexCacheIndexedPackagesIndexedShardIndexedStagesUpstreamStagescacherpack_record)clear_newline_chars)	MinimalFS)ChangedPackageHasChecksumsAndSizezinfo/index.jsonzinfo/icon.pngzinfo/paths.json
index_jsonaboutzinfo/about.jsonpathsreciperun_exportszinfo/run_exports.jsonpost_installzinfo/post_install.jsoniconc                  .  a  ] tR t^MtRRRRR]P
                  P                  R. /R V 3R llltR tR	 t	]
R
 R l4       tR t]R 4       t]R 4       tR tR tR#R ltR R ltR tR R ltR R ltR R ltR$R]/R R llltR R ltR  R! ltR"tV ;t# )%CondaIndexCachefsNchannel_urlupstream_stageinclude_stagesc               0    V ^8  d   QhRRRRRRRRR	RR
R/# )   channel_rootz
Path | strsubdirstrr   zMinimalFS | Noner    
str | Noner!   r"   z	list[str] )formats   "=lib/python3.14/site-packages/conda_index/index/sqlitecache.py__annotate__CondaIndexCache.__annotate__N   sF     "
 "
 "
 "

 "
  "
 "
 ""
    c               $  < \         SV `  ! VV3RVRVRVRV/VB  \        V P                  R4      V n        V P                  P                  4       '       * V n        \        P                  RV RV RV P                   R	V P                   24       R
# )aN  
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: stage from 'stat' table used to track available packages. Default is 'fs'.
r   r    r!   r"   zcache.dbzCondaIndexCache channel_root=z	, subdir=z db_filename=z cache_is_brand_new=N)	super__init__r   	cache_dirdb_filenameexistscache_is_brand_newlogdebug)	selfr%   r&   r   r    r!   r"   kwargs	__class__s	   &&&$$$$,r+   r1   CondaIndexCache.__init__N   s    & 		
 	
 $		

 *	
 *	
 	
  
;&*&6&6&=&=&?"?		+L>6(-X\XhXhWii}  C  V  V  ~W  X	
r.   c                v    V P                    Uu/ uF  qR8w  g   K  WP                   V,          bK   	  up# u upi )z$
Remove db connection when pickled.
db__dict__)r8   ks   & r+   __getstate__CondaIndexCache.__getstate__r   s3     .2]]H]4i#==##]HHHs   66c                	    Wn         R # Nr>   )r8   ds   &&r+   __setstate__CondaIndexCache.__setstate__x   s    r.   c                   V ^8  d   QhRR/# )r$   returnzsqlite3.Connectionr)   )r*   s   "r+   r,   r-   |   s      & r.   c                    \         P                  ! \        V P                  4      4      pV;_uu_ 4        \        P
                  ! V4       \        P                  ! V4       RRR4       V#   + '       g   i     T# ; i)z%
Connection to our sqlite3 database.
N)r	   connectr'   r3   r
   createmigrate)r8   conns   & r+   r=   CondaIndexCache.db{   sY    
 ~~c$"2"234T  &!!$'   T s   -A++A<	c                r    V P                   P                  RR4      pV'       d   VP                  4        R# R# )z+
Remove and close @cached_property self.db
r=   N)r?   popclose)r8   r=   s   & r+   rR   CondaIndexCache.close   s+     ]]tT*HHJ r.   c                    R# )z.
All paths must be prefixed with this string.
 r)   r8   s   &r+   database_prefixCondaIndexCache.database_prefix   s    
 r.   c                (    V P                   R,           # )z=
Pass to LIKE to filter paths belonging to this subdir only.
%rW   rV   s   &r+   database_path_like"CondaIndexCache.database_path_like   s    
 ##c))r.   c                	"    V P                    V 2# rD   r[   )r8   fns   &&r+   database_pathCondaIndexCache.database_path   s    &&'t,,r.   c                4    VP                  R^4      R,          # )z5
path with any database-specfic prefix stripped off.
/)rsplit)r8   paths   &&r+   
plain_pathCondaIndexCache.plain_path   s     {{3"2&&r.   c                |   V P                   '       g	   V'       d   \        P                  ! V P                  \        P                  ! V P                  4      4       V P                  ;_uu_ 4        \        P
                  ! V P                  4       RRR4       V P                  4        R# R#   + '       g   i     L$; i)z$
Load filesystem cache into sqlite.
N)r5   r
   r=   extract_cache_filesystemr2   remove_prefixrR   )r8   forces   &&r+   convertCondaIndexCache.convert   ss    
 """e''66t~~F ++DGG4  JJL ',
 s   .!B++B;	c               (    V ^8  d   QhRRRRRRRR/# )	r$   r_   r'   sizeintmemberszdict[str, str | bytes]r   r   r)   )r*   s   "r+   r,   r-      s2     0 00 0
 (0 (0r.   c                   V P                  V4      pV P                  ;_uu_ 4        V F  p\        V,          pV\        9   g   VR8X  d   K$  RVRVP	                  V4      /p	V\
        8X  d   Rp
M-V	R,          e   RV RV R2p
M\        P                  R	W4       Kt   V P                  P                  W4       K  	  V P                  P                  RRVR\        P                  ! V4      /4       V P                  WcW%4       RRR4       R#   \        P                   d    \        P                  R
Y4       h i ; i  + '       g   i     R# ; i)z/
Write cache for a single package to database.
r   rf   dataz
                                INSERT OR REPLACE into icon (path, icon_png)
                                VALUES (:path, :data)
                                Nz8
                                INSERT OR REPLACE INTO z (path, z^)
                                VALUES (:path, json(:data))
                                zNo "data" key for %s/%sztable=%s parameters=%szVINSERT OR REPLACE INTO index_json (path, index_json) VALUES (:path, json(:index_json)))r`   r=   PATH_TO_TABLETABLE_NO_CACHEget	ICON_PATHr6   warningexecutesqlite3OperationalError	exceptionjsondumpsstore_index_json_stat)r8   r_   rp   mtimerr   r   r`   	have_pathtable
parametersquerys   &&&&&&     r+   storeCondaIndexCache.store   s6    **2.WWW$	%i0N*e|.C$mVW[[=ST
	)$E  '3!88=whug N!$E
 KK 92EGGOOE6+ %8 GGOOhdjj6LM
 &&dE W. // MM":EN/ WWs%   A7D=D9A
D=-D:	:D==E	c           	        V P                   p V P                  P                  RRV P                  RV P	                  V4      /4      P                  4       ^ ,          pRpT P                  P                  TRT P	                  T4      /4      P                  4       p\        T4      ^8  g   Q h/ p T^ ,          pR F>  pYx,          '       g   K  TP!                  \"        P$                  ! Yx,          4      4       K@  	  Y6R&   TP)                  R	/ 4      p	 TP!                  T	P+                  4        U
Uu/ uF  w  rR
T
,           TbK  	  upp
4       \/        TR4       \/        TR4       T'       d(   \"        P$                  ! TR,          ;'       g    R4      M/ TR&   T#   \         dp    \        P                  RT4        \        P                  ! \        Y!4      4      P                  p EL  \         d    \        P                  RT4       / u u # i ; ii ; i  \&         d    Rp EL-i ; iu upp
i   \,         d     Li ; i)z$Load all items for the chosen stage.zASELECT mtime FROM stat WHERE stage=:upstream_stage AND path=:pathr!   rf   z%s mtime not found in cachez#%s not found in load_all_from_cachea  
        SELECT
            index_json,
            about,
            post_install,
            recipe,
            run_exports
            -- icon_png
        FROM
            index_json
            LEFT JOIN about USING (path)
            LEFT JOIN post_install USING (path)
            LEFT JOIN recipe USING (path)
            LEFT JOIN run_exports USING (path)
            -- LEFT JOIN icon USING (path)
        WHERE
            index_json.path = :path
        LIMIT 2
        Nr   sourcesource_descriptionsummaryr   {})r   r   r   r   )subdir_pathr=   rz   r!   r`   fetchone	TypeErrorr6   ry   osstatr   st_mtimeFileNotFoundErrorfetchalllenupdater~   loads
IndexErrorrw   itemsAttributeError_clear_newline_chars)r8   r_   r   r   UNHOLY_UNIONrowsrt   rowcolumnr   r@   vs   &&          r+   load_all_from_cache#CondaIndexCache.load_all_from_cache   s   &&	GGOOS!4#6#6@R@RSU@VW hjE ( ww64#5#5b#9:

(* 	 4y1}}	q'CK;;KK

3; 78 L W(B'	KKfllnEndaQ)nEF 	T=1T9- ILdjj]);)C)CtDQS]{  	KK5r:[ 56??$ A2F			X  	C	 F 		sf   AF .H /H H2 0H,
H2 !H=)G))#HHHHH)(H),H2 2I ?I c                    V ^8  d   QhRRRR/# )r$   stager(   listdir_statzIterable[dict[str, Any]]r)   )r*   s   "r+   r,   r-   /  s      /Gr.   c           	     	L   T;'       g    V P                   pV P                  ;_uu_ 4        V P                  '       g+   V P                  P                  R RVRV P                  /4       V P                  P                  RV R2V4       RRR4       R#   + '       g   i     R# ; i)z<DELETE FROM stat WHERE stage=:stage AND path like :path_liker   	path_likezN
            INSERT INTO STAT (stage, path, mtime, size)
            VALUES ('z', :path, :mtime, :size)
            ON CONFLICT (stage, path) DO UPDATE SET
            mtime=excluded.mtime, size=excluded.size
            N)r!   r=   update_onlyrz   r\   executemany)r8   r   r   s   &&&r+   store_stat_state CondaIndexCache.store_stat_state/  s     ,,,,WWW ###Re[$2I2IJ GGW   WWWs   ABB#	c                   V ^8  d   QhRR/# )r$   rI   zlist[ChangedPackage]r)   )r*   s   "r+   r,   r-   E  s      "6 r.   c                n    V P                   P                  RRV P                  RV P                  /4      pV# )zv
Compare upstream to 'indexed' state.

Return packages in upstream that are changed or missing compared to 'indexed'.
a  
            WITH
            fs AS
                ( SELECT path, mtime, size, sha256, md5 FROM stat WHERE stage = :upstream_stage ),
            cached AS
                ( SELECT path, mtime, size, sha256, md5 FROM stat WHERE stage = 'indexed' )

            SELECT fs.path, fs.mtime, fs.size, fs.sha256, fs.md5,
                cached.mtime as cached_mtime, cached.size as cached_size, cached.sha256 as cached_sha256, cached.md5 as cached_md5

            FROM fs LEFT JOIN cached USING (path)

            WHERE fs.path LIKE :path_like AND
                (fs.mtime != cached.mtime OR fs.size != cached.size OR cached.path IS NULL)
            r   r!   )r=   rz   r\   r!   )r8   r   s   & r+   changed_packages CondaIndexCache.changed_packagesE  s?       T44 $"5"5!
, r.   c                   V ^8  d   QhRR/# )r$   rI   r   r)   )r*   s   "r+   r,   r-   c  s     #
 #
/ #
r.   c                   R/ R/ R/ /pV P                   .V P                  ,           pRP                  R	\        V4      ,          4      pV P                  P                  RV R2V4       FU  pVw  rV\        P                  ! V4      pV P                  V4      pVf   \        P                  RV4       KJ  WaV,          V&   KW  	  \        VR,          VR,          VR,          R7      # )
z)
Return package sections from the cache.
packagespackages.condapackages.whl,zm
            SELECT path, index_json FROM stat JOIN index_json USING (path)
            WHERE stat.stage IN (z()
            ORDER BY path
            %s has unsupported extension)r   packages_condapackages_whl?)r!   r"   r   r   r=   rz   r~   r   package_section_for_pathr6   ry   r   )r8   new_packagescheck_stagesstages_placeholdersr   rf   r   sections   &       r+   indexed_packages CondaIndexCache.indexed_packagesc  s    
 bB
 ++,t/B/BB!hhvL0A'AB 77??""5!6 7
 
C  #DJ/J33D9G:DA*4!$'
" !*-'(89%n5
 	
r.   r   c                    V ^8  d   QhRRRR/# )r$   desiredzset[str] | NonerI   zIterator[IndexedShard]r)   )r*   s   "r+   r,   r-     s     0 0 0
 
 0r.   c             #    "   V P                   .V P                  ,           pRP                  R\        V4      ,          4      p\        P
                  ! V P                  P                  RV R2V4      R 4       F  w  rVR/ R/ R/ /p\        VVR,          VR,          VR,          R7      pV F  p	V	w  rrV P                  V4      pVf   \        P                  R
V4       K5  \        P                  ! V4      p\        P                  ! T;'       g    R4      VR&   V! V4      W~,          V&   K  	  V'       d	   WQ9   g   K  Vx  K  	  R	# 5i)ze
Yield package shards as IndexedShard records.

:desired: If not None, set of desired package names.
r   zSELECT index_json.name, index_json.path, index_json.index_json, run_exports.run_exports
                FROM stat
                JOIN index_json USING (path)
                LEFT JOIN run_exports USING (path)
                WHERE stat.stage IN (z;)
                ORDER BY index_json.name, index_json.pathc                    V ^ ,          # )    r)   )r@   s   &r+   <lambda>0CondaIndexCache.indexed_shards.<locals>.<lambda>  s    adr.   r   r   r   )namer   r   r   Nr   r   r   r   )r!   r"   r   r   	itertoolsgroupbyr=   rz   r   r   r6   ry   r~   r   )r8   r   r   r   r   r   r   
shard_dictshardr   _rf   r   r   keyrecords   &&$             r+   indexed_shardsCondaIndexCache.indexed_shards  sG     ++,t/B/BB!hhvL0A'AB#++GGOO& ':%: ;:	=  
JD B "J
 !#J/)*:;'7	E 36033D9;KK >EJ/(,

;3F3F$(G}%(3F(;
%  doE
s   DE&E6E>
Ec                   V ^8  d   QhRR/# )r$   r   r   r)   )r*   s   "r+   r,   r-     s     
 
6I
r.   c           	     	    V P                   P                  R \        P                  P                   R2WW4R,          VR,          34       R# )z]INSERT OR REPLACE INTO stat (stage, path, mtime, size, sha256, md5)
                VALUES ('z', ?, ?, ?, ?, ?)sha256md5N)r=   rz   r   INDEXED_STAGEvalue)r8   r`   r   rp   r   s   &&&&&r+   r   %CondaIndexCache.store_index_json_stat  sH     	'55;;<<MQ4H)=z%?PQ	
r.   c                   V ^8  d   QhRR/# )r$   rI   zIterator[tuple[str, dict]]r)   )r*   s   "r+   r,   r-     s     : :7 :r.   c              #     "   V P                   P                  RV P                  34       F)  w  rT\        P                  ! T;'       g    R4      3x  K+  	  R# 5i)z\
Query returning run_exports data, to be formatted by
ChannelIndex.build_run_exports_data()
z
            SELECT path, run_exports FROM stat
            LEFT JOIN run_exports USING (path)
            WHERE stat.stage = ?
            ORDER BY path
            r   N)r=   rz   r!   r~   r   )r8   rf   r   s   &  r+   r   CondaIndexCache.run_exports  sR     
 "&   ""
D K$7$74899"
s   AA	A)r?   r5   r3   )FrD   )__name__
__module____qualname____firstlineno__r   LOCAL_FILE_UPSTREAM_STAGEr   r1   rA   rF   r   r=   rR   propertyrW   r\   r`   rg   rm   r   r   r   r   r   r   r   r   r   __static_attributes____classcell__)r:   s   @r+   r   r   M   s    "

  $"
 #'"
 -FFLL"
 %'"
 "
HI     * *-'0dGR,<#
J0  	0 0d
: :r.   r   c                    V ^8  d   QhRRRR/# )r$   or   rI   bytesr)   )r*   s   "r+   r,   r,     s      3 5 r.   c                .    \         P                  ! V 4      # )z%
Sidestep lack of typing in msgpack.
)msgpackpackb)r   s   &r+   packb_typedr     s     ==r.   )zinfo/recipe/meta.yamlzinfo/recipe/meta.yaml.renderedzinfo/meta.yaml)5__doc__
__future__r   r   r~   loggingr   r{   os.pathr   pathlibr   typingr   r   r   r   r   rU   r	   r
   cacher   r   r   r   r   r   r   r   r   r   r   r   r   	getLoggerr   r6   INDEX_JSON_PATHrx   
PATHS_PATHTABLE_TO_PATHru   r   r@   r   
isinstancer'   rf   rv   COMPUTEDr   r   r)   r.   r+   <module>r      s   #    	    9 9  #   ? :!#	
 /Z  *,
I& !DAq!SaD"#M$ 	 " 
 %%D:) D:Nr.   