+
    3j                        R t ^ RIH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Ht ]
'       d   ^ RIHt ^R	IHt R
RRRRRRR /R R lltR
RRRRRRR /R R lltR R ltR# )a/  
Convert .tar.bz2 to .conda

Uses ``tempfile.SpooledTemporaryFile`` to buffer ``pkg-*.tar`` and
``info-*.tar``, then compress directly into an open `ZipFile` at the end.
`SpooledTemporaryFile` buffers the first 10MB of the package and its metadata in
memory, but writes out to disk for larger packages.
)annotationsN)Iterator)Path)TYPE_CHECKING)conda_builder)CondaComponentstream_conda_component)Callable)LegacyCompressorOrFactory
compressorcompression_levelcompression_threadsis_infoc                $    V P                  R 4      # zinfo/
startswithfilenames   &Alib/python3.14/site-packages/conda_package_streaming/transmute.py<lambda>r   $       h6I6I'6R    c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
   r    LegacyCompressorOrFactory | Noner   
int | Noner   r   Callable[[str], bool]returnr    )formats   "r   __annotate__r!      s>     , , 1	,
 ", $, #, 
,r   c          
        V P                  R4      '       g   Q R4       h\        P                  P                  V4      '       g   Q h\        P                  P	                  V 4      R\        R4      )  p\        V 4      p\        VVVVVVVR7      # )a  
Convert .tar.bz2 conda package to .conda-format under path.

:param package: path to .tar.bz2 conda package
:param path: destination path for transmuted .conda package
:param compressor: Legacy ``zstandard`` compressor object (or factory
    returning one) with ``stream_writer(...)``. Mutually exclusive with
    ``compression_level`` and ``compression_threads``.
:param compression_level: zstd compression level for ``compression.zstd`` or
    ``backports.zstd`` code path. Defaults to ``ZSTD_COMPRESS_LEVEL`` if not
    specified and ``compressor`` is None.
:param compression_threads: Number of zstd worker threads for
    ``compression.zstd`` or ``backports.zstd`` code path. Defaults to
    ``ZSTD_COMPRESS_THREADS`` if not specified and ``compressor`` is None.
:param is_info: A function that returns True if a file belongs in the
    ``info`` component of a `.conda` package.  ``conda-package-handling``
    (not this package ``conda-package-streaming``) uses a set of regular
    expressions to keep expected items in the info- component, while other
    items starting with ``info/`` wind up in the pkg- component.

:return: Path to transmuted package.
.tar.bz2z#can only convert .tar.bz2 to .condaN)r   r   r   r   package_stream)endswithospathisdirbasenamelenr   transmute_stream)packager'   r   r   r   r   stemr$   s   &&$$$$  r   	transmuter.      s    > J''N)NN'77==77G$%7J'78D+G4N+/% r   c                $    V P                  R 4      # r   r   r   s   &r   r   r   S   r   r   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   r   r   r   r   r   r   r   r$   z1Iterator[tuple[tarfile.TarFile, tarfile.TarInfo]]r   )r    s   "r   r!   r!   L   sF     A A 1	A
 "A $A #A FAr   c          	     6   \        W R24      p\        V VVVVVR7      ;_uu_ 4       pV FN  w  rV
P                  4       '       d#   VP                  WP	                  V
4      4       K=  VP                  V
4       KP  	  RRR4       V#   + '       g   i     T# ; i)a  
Convert (TarFile, TarInfo) iterator like those produced by
``stream_conda_component`` to .conda-format under path. Allows for more
creative data sources.

e.g. recompress ``.conda``:

.. code-block:: python

    transmute_stream(
        ...,
        package_stream=itertools.chain(
            stream_conda_component("package.conda", component=CondaComponent.pkg),
            stream_conda_component("package.conda", component=CondaComponent.info),
        ),
    )

This example could move files between the ``pkg-`` and ``info-`` components
depending on the ``is_info`` function.

:param stem: output filename without extension
:param path: destination path for transmuted .conda package
:param compressor: Legacy ``zstandard`` compressor object (or factory
    returning one) with ``stream_writer(...)``. Mutually exclusive with
    ``compression_level`` and ``compression_threads``.
:param compression_level: zstd compression level for ``compression.zstd`` or
    ``backports.zstd`` code path. Defaults to ``ZSTD_COMPRESS_LEVEL`` if not
    specified and ``compressor`` is None.
:param compression_threads: Number of zstd worker threads for
    ``compression.zstd`` or ``backports.zstd`` code path. Defaults to
    ``ZSTD_COMPRESS_THREADS`` if not specified and ``compressor`` is None.
:param is_info: A function that returns True if a file belongs in the
    ``info`` component of a `.conda` package.  ``conda-package-handling``
    (not this package ``conda-package-streaming``) uses a set of regular
    expressions to keep expected items in the info- component, while other
    items starting with ``info/`` wind up in the pkg- component.
:param package_stream: Iterator of (Tarfile, TarInfo) tuples.

:return: Path to transmuted package.
.conda)r   r   r   r   N)r   r   isfileaddfileextractfile)r-   r'   r   r   r   r   r$   output_path	conda_tartarmembers   &&$$$$$    r   r+   r+   L   s    d tvV_-K	+/
 
 
)KC}}!!&//&*AB!!&)	 *
 
 
 s   ABB	c                    V ^8  d   QhRRRR/# )r   r,   strr   r   r   )r    s   "r   r!   r!      s     ) )) 
)r   c                j   V P                  R4      '       g   Q R4       h\        P                  P                  V4      '       g   Q hV P                  R4      '       d   RMRp\        P                  P	                  V 4      R\        V4      )  pVR8X  d"   \        P                  \        P                  .pM\        P                  .p\        W R24      p\        V R4      ;_uu_ 4       p\        P                  ! VR4      ;_uu_ 4       pV Fm  p\        \        WVR7      4      p	V	 FN  w  rVP                  4       '       d#   VP                  WP!                  V4      4       K=  VP                  V4       KP  	  Ko  	  RRR4       RRR4       V#   + '       g   i     L; i  + '       g   i     T# ; i)	z
Convert .conda package to .tar.bz2 format under path.

Can recompress .tar.bz2 packages.

Args:
    package: path to .conda or .tar.bz2 package.
    path: destination path for transmuted package.

Returns:
    Path to transmuted package.
r#   r2   zUnknown extensionNrbzx:bz2)	component)r#   r2   )r%   r&   r'   r(   r)   r*   r   infopkgr   opentarfileiterr   r3   r4   r5   )r,   r'   incoming_formatfile_id
componentsr6   fileobjpkg_tarr>   streamr8   r9   s   &&          r   transmute_tar_bz2rJ      sT     233H5HH377==")"2"28"<"<h*Oggw'(?3+?*?@G("$))>+=+=>
 %(()
ty12K	gt		k7)K)Kw#I0YWXF%==??OOFOOF,CDOOF+	  & $ *L	  *L)K		 s%   ( F!A4F	<F!FF!!F2	)__doc__
__future__r   r&   rB   collections.abcr   pathlibr   typingr   creater   package_streamingr   r   r	   r
   r.   r+   rJ   r   r   r   <module>rR      s    # 	  $    ! F(1, 48	,
 %), '+, &S,^A 48	A
 %)A '+A &SAH)r   