
    דi                        S r SSKJr  SSKrSSK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S jjrSS jrSSS jjrg)z<
Exception-compatible adapter from conda_package_streaming.
    )annotationsN)redirect_stdout)TarError)	Generator)
BadZipFile)
exceptions)extract_streampackage_streaming   c              #    #    [        U 5      R                  S5      (       a	  US/:X  d   e [        U S5       nU H  n[        R                  " XUS9v   M     S S S 5        g ! , (       d  f       g = f! [
        R                   a  n[        R                  " X5      UeS nAf[        [        [        4 a)  n[        R                  " U S[        U5       35      UeS nAff = f7f)Nz.tar.bz2pkgrb)	componentfailed with error: )strendswithopenr
   stream_conda_componentcps_exceptionsCaseInsensitiveFileSystemErrorr   OSErrorr   r   InvalidArchiveError)filename
componentsdest_dirfileobjr   es         @lib/python3.13/site-packages/conda_package_handling/streaming.py_stream_componentsr      s     
 8}j))eW$$$
^(D!W'	'>>  ( "!! 88 S77KQRRXz* ^,,X9LSQRVH7UV\]]^sW   )C"A3 !A"A3 !C""
A0,A3 /C"0A3 3CBC6$CCC"c           	        [        XUS9 H  n [        X15        M     g! [        R                   a  n[        R                  " X5      UeSnAf[
        [        [        4 a)  n[        R                  " U S[        U5       35      UeSnAff = f)a  
Extract .conda or .tar.bz2 package to dest_dir.

If it's a conda package, components may be ["pkg", "info"]

If it's a .tar.bz2 package, components must equal ["pkg"]

Internal. Skip directly to conda-package-streaming if you don't need
exception compatibility.
)r   Nr   )
r   r	   r   r   r   r   r   r   r   r   )r   r   r   streamr   s        r   _extractr"   )   s     %XHM	b6, N << 	W;;HOUVV:. 	b00=PQTUVQWPX;YZ`aa	bs    BA

B"$BBc                   [         R                  " 5       n[        X5       HA  nU H8  u  pV[        U5         UR	                  US9  S S S 5        UR                  5         M:     MC     UR                  S5        U(       a  [        UR                  5       S S9nO[        UR                  5       5      n[        SR                  U5      SS9  g ! , (       d  f       N= f)N)verboser   c                ,    U R                  S S5      S   $ )N   )split)lines    r   <lambda>_list.<locals>.<lambda>N   s    TZZa04    )key )end)ioStringIOr   r   listcloseseeksorted	readlinesprintjoin)r   r   r$   memfiler   tar_liness           r   _listr=   =   s    kkmG'=	FC )) *
 OO   > LLO 5
 w((*+	"''%.b!# *)s   C
C)r.   )r   r   r   	list[str]r   r   returnz=Generator[Generator[tuple[tarfile.TarFile, tarfile.TarInfo]]])r   r   r   r   r   r>   )T)r   r   r   r>   )__doc__
__future__r   r0   tarfile
contextlibr   r   typingr   zipfiler   conda_package_streaming.extractr   r   r	   r
   r.   r   r"   r=    r,   r   <module>rH      si    # 	  &    H M  ^^^ ^ C	^*b("r,   