+
    3j"                       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  ^ RIHt ]'       d,   ^ RIHt ^ RIHtHt  ! R	 R
]4      t]]. ]3,          ,          t^t^t^t]P8                  R,
          ^,
          tR R lt ! R R]P>                  4      t  ! R R]PB                  4      t"RRRR/R R llt#]RRRRRRRR RR/R R ll4       t$R#   ] d
    ^ RIHt  Li ; i)a  
Tools for creating ``.conda``-format archives.

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.

Uses more disk space than ``conda-package-handling`` (temporary uncompressed
tarballs of the package contents) but accepts streams instead of just
files-on-the-filesystem.
)annotationsN)Iterator)contextmanager)Path)TYPE_CHECKING)Callable)BinaryIOProtocolc                  "    ] tR t^#tR R ltRtR# )LegacyCompressorc               (    V ^8  d   QhRRRRRRRR/# )   writerr   sizeintclosefdboolreturn )formats   ">lib/python3.14/site-packages/conda_package_streaming/create.py__annotate__LegacyCompressor.__annotate__$   s2     	 		 		
 	 	    c               	    R # Nr   )selfr   r   r   s   &&$$r   stream_writerLegacyCompressor.stream_writer$   s     r   r   N)__name__
__module____qualname____firstlineno__r   __static_attributes__r   r   r   r   r   #   s    	 	r   r   c                   V ^8  d   QhRR/# )r   tarinfoztarfile.TarInfor   )r   s   "r   r   r   ;   s       r   c                >    ^ ;V n         V n        R;V n        V n        V # )zt
Pass to ``tarfile.add(..., filter=anonymize)`` to anonymize uid/gid.

Does not anonymize mtime or any other field.
 )uidgidunamegname)r%   s   &r   	anonymizer,   ;   s%     !"!GK'+$&&GMGMNr   c                  b   a  ] tR t^Ft$ RtR]R&   R]R&   RR /R V 3R llltRV 3R	 lltR
tV ;t	# )CondaTarFilea5  
Subclass of :external+python:py:class:`tarfile.TarFile` that adds members to
a second ``info`` tar if they match ``is_info(name)``.

Create this with ``conda_builder(...)`` which sets up the component
archives, then wraps them into a ``.conda`` on exit.

Only useful for creating, not extracting ``.conda``.
tarfile.TarFileinfo_tarr   is_infoc                	$    V P                  R 4      # zinfo/
startswith)names   &r   <lambda>CondaTarFile.<lambda>X   s    T__W5r   c                   V ^8  d   QhRR/# )r   r0   r/   r   )r   s   "r   r   CondaTarFile.__annotate__T   s     	 	 "	r   c               	@   < \         SV `  ! V/ VB  Wn        W n        R # r   )super__init__r0   r1   )r   r0   r1   argskwargs	__class__s   &$$*,r   r=   CondaTarFile.__init__T   s!     	$)&) r   c                   < V P                  VP                  4      '       d   V P                  P                  WR7      # \        SV `  W4      # )aU  
Add the TarInfo object ``tarinfo`` to the archive. If ``fileobj`` is
given, it should be a binary file, and tarinfo.size bytes are read from
it and added to the archive. You can create TarInfo objects directly, or
by using ``gettarinfo()``.

If ``self.is_info(tarinfo.name)`` returns ``True``, add ``tarinfo`` to
``self.info_tar`` instead.
)fileobj)r1   r6   r0   addfiler<   )r   r%   rC   r@   s   &&&r   rD   CondaTarFile.addfile_   s?     <<%%==(((BB7?744r   )r0   r1   r   )
r   r    r!   r"   __doc____annotations__r=   rD   r#   __classcell__r@   s   @r   r.   r.   F   s4     	 6		 	5 5r   r.   c                  4   a  ] tR t^otRtR^ /V 3R lltRtV ;t# )	_ZstdFilez
ZstdFile adding pledged_input_size.

For the older zstandard binding, a pledged size was important for
decompression memory usage. Check if that is still true in compression.zstd.
pledged_input_sizec               	^   < \         SV `  ! V/ VB  V P                  P                  V4       R # r   )r<   r=   _compressorset_pledged_input_size)r   rL   r>   r?   r@   s   &$*,r   r=   _ZstdFile.__init__w   s*    $)&)//0BCr   r   )r   r    r!   r"   rF   r=   r#   rH   rI   s   @r   rK   rK   o   s    D D Dr   rK   compression_levelcompression_threadsc               (    V ^8  d   QhRRRRRRRR/# )r   rL   r   
compressor LegacyCompressorOrFactory | NonerQ   
int | NonerR   r   )r   s   "r   r   r   |   s4     # # # 1	#
 "# $#r   c          	     |   Vec   Vf   Ve   Rp\        V4      h\        V4      '       d   V! 4       MTp\        VR4      '       g   Rp\        V4      hVP	                  V VRR7      # Vf   \
        pVf   \        p\        V RV\        P                  P                  V\        P                  P                  V/R7      # )NzD`compressor` overrides `compression_level` and `compression_threads`r   z*compressor must provide stream_writer(...)F)r   r   w)moderL   options)
ValueErrorcallablehasattr	TypeErrorr   ZSTD_COMPRESS_LEVELZSTD_COMPRESS_THREADSrK   zstdCompressionParameterrQ   
nb_workers)outputrL   rT   rQ   rR   msglegacy_compressors   &$$$$  r   _open_writerrg   |   s     (,?,KXCS/!,4Z,@,@JLj(/::>CC.  ..# / 
 	
  /"3-%%779J%%002E
	 r   rT   r1   c                $    V P                  R 4      # r3   r4   )filenames   &r   r7   r7      s    h6I6I'6Rr   encodingzutf-8c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   rT   rU   rQ   rV   rR   r1   zCallable[[str], bool]r   zIterator[CondaTarFile]r   )r   s   "r   r   r      sL     lA lA 1	lA
 "lA $lA #lA lAr   c             #    "   \        W R24      p\        P                  ! 4       ;_uu_ 4       p\        P                  ! 4       ;_uu_ 4       p	\        P                  ! VRVR7      ;_uu_ 4       p
\        V	RV
VVR7      ;_uu_ 4       pVx  V
P                  4        VP                  4        VP                  4       pV	P                  4       pVP                  ^ 4       V	P                  ^ 4       RRR4       RRR4       \        P                  ! VR\        P                  R7      ;_uu_ 4       pR\        /pVP                  R	\        P                  ! V4      4       VP!                  R
V  R2RX\"        8  R7      ;_uu_ 4       p\%        VVVVVR7      ;_uu_ 4       p\&        P(                  ! V	P*                  V4       RRR4       RRR4       VP!                  RV  R2RX\"        8  R7      ;_uu_ 4       p\%        VVVVVR7      ;_uu_ 4       p\&        P(                  ! VP*                  V4       RRR4       RRR4       RRR4       RRR4       RRR4       R#   + '       g   i     ELu; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i5i)a[  
Produce a ``TarFile`` subclass used to build a ``.conda`` package. The
subclass delegates ``addfile()`` to the ``info-`` component when ``is_info``
returns True.

When the context manager exits, ``{path}/{stem}.conda`` is written with
the component tar archives.

Args:
    stem: output filename without extension

    path: destination path for transmuted .conda package.

    compressor: Legacy ``zstandard`` compressor object (or factory
        returning one) with ``stream_writer(...)``. Mutually exclusive with
        ``compression_level`` and ``compression_threads``.

    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.

    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.

    encoding: passed to TarFile constructor. Keep default "utf-8" for valid
        .conda.

Yields:
    ``CondaTarFile``
z.condarX   )rC   rY   rj   )rC   rY   r0   r1   rj   Nx)compresslevelconda_pkg_format_versionzmetadata.jsonzpkg-z.tar.zst)force_zip64)rL   rT   rQ   rR   zinfo-)r   tempfileSpooledTemporaryFiletarfileTarFiler.   closetellseekzipfileZipFile
ZIP_STOREDCONDA_PACKAGE_FORMAT_VERSIONwritestrjsondumpsopenCONDA_ZIP64_LIMITrg   shutilcopyfileobj_file)stempathrT   rQ   rR   r1   rj   output_path	info_filepkg_filer0   pkg_tar	info_sizepkg_size
conda_filepkg_metadatapkg_file_zip
pkg_streaminfo_file_zipinfo_streams   &&$$$$$             r   conda_builderr      st    T tvV_-K%%''9%%''8 OOIC(KKx !!  
 MNNMMO!(I}}HNN1MM!) L. __!,,
 
 68TULL1IJ 4&)!),=!=     " '/)&7(;   ""8>>:>  D6*!*->!>     #!'0)&7(;  !""9??K@3
5 	( 	('
   LKKJ  *  3
 
5 	(' 	(''s   ,LK4"K!	.I.A'I.I.67K!	-AKJ"J>J/K5J;"J(0J;8K K!	K4
LI+%	I..I?9	K!	JJJ% K(J83J;;KKKK!	!K1,K44L	?	Li   )%rF   
__future__r   r}   r   rs   rq   rx   collections.abcr   
contextlibr   pathlibr   typingr   compression.zstdra   ImportErrorbackports.zstdr   r   r	   r   LegacyCompressorOrFactoryr_   r`   r{   ZIP64_LIMITr   r,   rt   r.   ZstdFilerK   rg   r   r   r   r   <module>r      s9   #      $ %   "# ()8  !18B@P<P3Q Q      ''73a7 &57?? &5R
D 
D#
 %)# '+#L lA 48	lA
 %)lA '+lA &SlA lA lAO  "!"s   C% %C54C5