
    3i                        S r SSKrSSKrSSKrSSKJr  SSKrSSKJ	r	  SSK
Jr  \R                  " \5      r\R                  " 5       rS\R"                  S'   \" S	S
15      r\\4S jr\4S jr\S4S\R                  S\4S jjr\S:X  aV  SSKr\R0                  " \R2                  S9  \" \R4                  S   \" \R4                  S   5      R7                  5       5        gg)ac  
Fetch metadata from remote .conda or .tar.bz2 package.

Try to fetch less than the whole file if possible.

This module should only be used to make *partial* reads against a remote
package, typically just the ``info`` portion. If a full ``.conda`` format
package is needed, it is more efficient to download locally first and then use
the file-based API.
    N)Path   )package_streaming)	LazyCondazconda-package-streaming/0.1.0z
User-Agentzinfo/index.jsonzinfo/recipe/meta.yamlc                     [        U5      n[        XS9nU HZ  u  pVUR                  U;   a,  UR                  Xa5        UR	                  UR                  5        U(       a  MJ  UR                  5         M\     g)zt
Extract info/index.json and info/recipe/meta.yaml from url to destdir; close
url as soon as those files are found.
sessionN)setstream_conda_infonameextractremoveclose)urldestdir	checklistr	   streamtarmembers          ;lib/python3.13/site-packages/conda_package_streaming/url.pyextract_conda_infor   !   s[    
 IIs4F;;)#KK(V[[)yLLN     c              #   2  #    [        XS9u  p# [        R                  " X#5       Sh  vN   [        US5      (       a  UR	                  5         UR                  5         g N6! [        US5      (       a  UR	                  5         UR                  5         f = f7f)z]
Yield (tar, member) for conda package at url

Just "info/" for .conda, all members for tar.
r   Nrelease_conn)conda_reader_for_urlr   r   hasattrr   r   )r   r	   filenamecondas       r   r   r   1   s{      +3@OH$66xGGG5.))   	H5.))  s+   BA! AA! 2BA! !3BBFr	   fall_back_to_full_downloadc                    [         R                  R                  U 5      nUR                  R	                  SS5      Gt pEUR                  S5      (       a-  US[        S5      *  n[        XUS9nUR                  U5        XW4$ UR                  S5      (       a"  UR                  U SSS	0S
9nUR                  nXW4$ [        SU 5      e)a  
Return (name, file_like) suitable for package_streaming APIs

:param url: URL to conda package
:param session: The session to use for web requests.
:param fall_back_to_full_download: If true, fall back to downloading the entire
package instead of streaming it in the case of a specific issue where the server
incorrectly responds with 416 (Range Not Satisfiable). See LazyZipOverHTTP for
more details.
/r   z.condaN)r   z.tar.bz2T
Connectionr   )r   headerszUnsupported extension %s)urllibparseurlparsepathrsplitendswithlenr   prefetchgetraw
ValueError)	r   r	   r   
parsed_url_r   file_idr   responses	            r   r   r   C   s     &&s+J??))#q1LQ""+c(m^,5O
 	w ? 
		:	&	&;;s4,9P;Q ? 3S99r   __main__)level   )__doc__loggingsysurllib.parser$   pathlibr   requests r   
lazy_wheelr   	getLogger__name__logSessionr	   r#   	frozensetMETADATA_CHECKLISTr   r   boolr   basicConfigDEBUGargvabsolute r   r   <module>rJ      s   	  
     "!



 ?   13JKL  0B7   $+ & &-QV""JN: zgmm,sxx{D!$5$>$>$@A	 r   