+
    QV-j¯(  ã                   ó  € R t ^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIt^ RI	H
t
 ^ RIHt ^ RIHtHtHtHtHt ^RIHtHt ^RIHt . ROt]R,          tRR	 R
 lltR R ltR R ltR R ltR R ltR R ltR R lt R R lt!R R lt"R# )aÒ  Shared ``cp`` command to copy files between local paths, repositories and buckets.

This single command backs three identical CLI entry points: ``hf cp`` (top-level),
``hf repos cp`` and ``hf buckets cp``. It supports any source/destination combination
of local file, repo/bucket ``hf://`` URI, and ``-`` (stdin/stdout), with two exceptions:
- bucket-to-repo copies are not supported (server limitation), and
- local-to-local copies (use a regular ``cp`` for that).
N)Úreplace)Ú	AnnotatedÚLiteral)ÚHfApi)ÚCLIError)ÚHfUriÚSoftTemporaryDirectoryÚdisable_progress_barsÚ	is_hf_uriÚparse_hf_uri)ÚTokenOptÚ
get_hf_api)Úoutc                ó2   € V ^8„  d   QhR\         R,          /# )é   ÚcontextN)Ú	CpContext)Úformats   "Úh/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/huggingface_hub/cli/_cp.pyÚ__annotate__r   ;   s   € ÷ ñ ”Y Õ%ñ ó    c                ó   a € RR V 3R lllpV# )zéBuild the ``cp`` command function for a given alias.

The three entry points (`hf cp`, `hf repos cp`, `hf buckets cp`) share the exact same logic;
'context' only adds a guardrail on the remote endpoint type (see `_enforce_context`).
c          	      óÖ   € V ^8„  d   QhR\         \        \        P                  ! RR7      3,          R\         \        R,          \        P                  ! RR7      3,          R\        RR/# )	r   Úsrcz?Source: local file, hf:// URI (repo or bucket), or - for stdin.)ÚhelpÚdstNzEDestination: local path, hf:// URI (repo or bucket), or - for stdout.ÚtokenÚreturn)r   ÚstrÚtyperÚArgumentr   )r   s   "r   r   Úmake_cp.<locals>.__annotate__B   sl   € ÷ !ñ !ÜÜÜ�NŠNÐ aÔbðdõ
ð!ô
 Ü�$�JÜ�NŠNÐ gÔhðjõ
ð!ô ð!ð 
ñ!r   c                ó8   <€ \        SW4       \        WV4       R# )aÓ  Copy files between local paths, repositories, and buckets.

Handles uploads (local/stdin -> repo/bucket), downloads (repo/bucket -> local/stdout) and
remote-to-remote copies (repo/bucket -> repo/bucket). Bucket-to-repo and local-to-local
copies are not supported. For directories, use `hf upload`/`hf download` (repos) or
`hf buckets sync` (buckets). Remote-to-remote copies only work within the same storage
region (https://huggingface.co/docs/hub/storage-regions).
N)Ú_enforce_contextÚ_run_cp)r   r   r   r   s   &&&€r   ÚcpÚmake_cp.<locals>.cpB   s   ø€ ô& 	˜ #Ô+Ü�˜%Ö r   )NN© )r   r%   s   f r   Úmake_cpr(   ;   s   ø€ ÷!ò !ð, €Ir   c                ó\   € V ^8„  d   QhR\         R,          R\        R\        R,          RR/# )r   r   Nr   r   r   )r   r   )r   s   "r   r   r   [   s7   € ÷ rñ rœi¨$Õ.ð r´Sð r¼sÀT½zð rÈdñ rr   c                ó"  € V f   R# Ve   \        V4      '       d   TMTp\        V4      '       g   R# V R8X  d'   \        V4      P                  '       d   \        R4      hV R8X  d)   \        V4      P                  '       g   \        R4      hR# R# )a—  Guardrail for the `hf repos cp` / `hf buckets cp` aliases.

These aliases are exact duplicates of `hf cp`, so a bare `hf repos cp` could otherwise touch a
bucket (and vice versa). We validate the type of the remote side: the destination for uploads and
remote-to-remote copies, or the source when downloading to a local path / stdout. The top-level
`hf cp` (i.e. 'context' is None) accepts any combination.
NÚreposzW`hf repos cp` only works with repositories. Use `hf cp` or `hf buckets cp` for buckets.ÚbucketszW`hf buckets cp` only works with buckets. Use `hf cp` or `hf repos cp` for repositories.)r
   r   Ú	is_bucketr   )r   r   r   Úremotes   &&& r   r#   r#   [   s~   € ð ‚Ùà’_¬°3¯ª‰S¸c€FÜ�V×ÒÙØ�'Ôœl¨6Ó2×<×<Ð<ÜÐpÓqÐqØ�)Ô¤L°Ó$8×$B×$BÐ$BÜÐpÓqÐqñ %CÑr   c                ó\   € V ^8„  d   QhR\         R\         R,          R\         R,          RR/# )r   r   r   Nr   r   )r   )r   s   "r   r   r   o   s6   € ÷ !Eñ !E”ð !Eœ3 �:ð !E¬c°D­jð !E¸Tñ !Er   c                 óô  € \        VR 7      pV R8H  pVR8H  p\        V 4      pVRJ;'       d    \        V4      pV'       d:   V'       d2   Vf   Q hVP                  W4       \        P                  ! RWR7       R# V'       g9   V'       g1   Vf   \
        P                  ! R4      h\
        P                  ! R4      hV'       d$   V'       d   \        W04       R# \        W0V4       R# Vf   Q h\        W0WR7       R# ))r   Ú-NÚCopied©r   r   z?Missing destination. Provide a repo or bucket hf:// URI as DST.zVOne of SRC or DST must be a repo (hf://username/...) or bucket (hf://buckets/...) URI.)Úsrc_is_stdin)
r   r
   Ú
copy_filesr   Úresultr   ÚBadParameterÚ_download_file_to_stdoutÚ_download_file_to_localÚ_upload_file_to_remote)r   r   r   Úapir4   Údst_is_stdoutÚ	src_is_hfÚ	dst_is_hfs   &&&     r   r$   r$   o   sÔ   € Ü
˜5Ô
!€Cà˜#‘:€LØ˜3‘J€MÜ˜#“€IØ˜4�×2Ð2¤I¨c£N€I÷ —YØŠÐˆØ�‰�sÔ Ü�
Š
�8 Õ.Ù÷ ŸYØŠ;Ü×$Ò$Ð%fÓgÐgÜ× Ò Ødó
ð 	
÷
 ßÜ$ SÔ.ÙÜ ¨#Ô.Ùð Š?Ðˆ?Ü˜3 S×Dr   c                ó4   € V ^8„  d   QhR\         R\        RR/# )r   r;   r   r   N©r   r   )r   s   "r   r   r   “   s!   € ÷ 
3ñ 
3¤%ð 
3¬cð 
3°dñ 
3r   c                 ó,  € \        V4      p\        W!4      p\        4       ;_uu_ 4        \        4       ;_uu_ 4       p\        P
                  P                  WC4      p\        WV4       \        VR 4      ;_uu_ 4       pVP                  R4      ;p'       d,   \        P                  P                  P                  V4       KD   RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; i)Úrbi HèN)r   Ú_source_filenamer	   r   ÚosÚpathÚjoinÚ_download_singleÚopenÚreadÚsysÚstdoutÚbufferÚwrite)r;   r   ÚuriÚfilenameÚtmp_dirÚtmp_pathÚfÚchunks   &&      r   r8   r8   “   s¶   € Ü
�sÓ
€CÜ Ó)€Hä	×	 Õ	 Ü#×%Ô%¨Ü—w‘w—|‘| GÓ6ˆHÜ˜S xÔ0Ü�h ×%Ô%¨Ø Ÿv™v jÓ1Ð1�eÖ1Ü—J‘J×%Ñ%×+Ñ+¨EÖ2ð 2÷ &÷ &÷ 
!Ñ	 ÷ &×%ú÷ &×%ú÷ 
!×	 Ð	 úsA   ©D¼A C/	Á<CÂ+CÃC/	Ã
DÃC,Ã'C/	Ã/C?Ã:DÄD	c                óN   € V ^8„  d   QhR\         R\        R\        R,          RR/# )r   r;   r   r   Nr   r@   )r   s   "r   r   r       s,   € ÷ 6ñ 6¤ð 6¬Sð 6´s¸Tµzð 6Àdñ 6r   c                 ó  € \        V4      p\        W14      pVf   TpMƒ\        P                  P	                  V4      '       g=   VP                  \        P                  4      '       g   VP                  R4      '       d!   \        P                  P                  W$4      pMTp\        P                  P                  V4      pV'       d   \        P                  ! VRR7       \        WV4       \        P                  ! RWR7       R # )NÚ/T)Úexist_okÚ
Downloadedr3   )r   rC   rD   rE   ÚisdirÚendswithÚseprF   ÚdirnameÚmakedirsrG   r   r6   )r;   r   r   rN   rO   Ú
local_pathÚ
parent_dirs   &&&    r   r9   r9       s¥   € Ü
�sÓ
€CÜ Ó)€Hà
‚{Ø‰
Ü	�‰�‰�s×	Ò	˜sŸ|™|¬B¯F©F×3Ò3°s·|±|ÀC×7HÒ7HÜ—W‘W—\‘\ #Ó0‰
àˆ
ä—‘—‘ Ó,€JßÜ
�Š�J¨Õ.ä�S˜zÔ*Ü‡J‚Jˆ| ×5r   c                ó@   € V ^8„  d   QhR\         R\        R\        RR/# )r   r;   rN   r^   r   N)r   r   r   )r   s   "r   r   r   ³   s(   € ÷ 4ñ 4œ%ð 4¤eð 4¼ð 4Àñ 4r   c           
     óâ  € VP                   '       d.   V P                  VP                  VP                  V3.RR7       R# \        P
                  P                  V4      ;'       g    Rp\        RVR7      ;_uu_ 4       pV P                  VP                  VP                  VP                  VP                  VR7      p\        P                  ! WR4       RRR4       R#   + '       g   i     R# ; i)z~Download a single file (repo or bucket) to ``local_path``.

Used by `_download_file_to_local` and `_download_file_to_stdout`.
T)Úraise_on_missing_filesÚ.z.tmp)ÚprefixÚdir)Úrepo_idÚ	repo_typerO   ÚrevisionÚ	local_dirN)r-   Údownload_bucket_filesÚidÚpath_in_reporD   rE   r\   r   Úhf_hub_downloadÚtyperh   r   )r;   rN   r^   r_   rP   Údownloaded_paths   &&&   r   rG   rG   ³   s´   € ð
 ‡}‡}€}Ø×!Ñ! #§&¡&¨C×,<Ñ,<¸jÐ+IÐ*JÐcgÐ!Öhô
 —W‘W—_‘_ ZÓ0×7Ð7°Cˆ
Ü#¨6°z×BÕBÀgØ!×1Ñ1ØŸ™ØŸ(™(Ø×)Ñ)ØŸ™Ø!ð 2ó ˆOô �JŠJ�Ô3÷ C×B×BÒBús   Á>ACÃC.	c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   rN   r   r   )r   r   )r   s   "r   r   r   Ê   s!   € ÷ /ñ /œ%ð /¤cð /¬cñ /r   c                 óÄ   € V P                   R 8X  g   VP                  R4      '       d   \        P                  ! R4      hV P                   P	                  R^4      R,          # )Ú rV   z‹Source path must include a file name, not just a repo/bucket or directory path. Use `hf download` or `hf buckets sync` to copy directories.éÿÿÿÿ)rl   rZ   r   r7   Úrsplit)rN   r   s   &&r   rC   rC   Ê   sW   € Ø
×Ñ˜2Ô §¡¨c×!2Ò!2Ü× Ò ðKó
ð 	
ð ×Ñ×"Ñ" 3¨Ó*¨2Õ.Ð.r   c          
      óL   € V ^8„  d   QhR\         R\        R\        R\        RR/# )r   r;   r   r   r4   r   N)r   r   Úbool)r   s   "r   r   r   Ó   s7   € ÷ Yñ Y¤ð Y¬Cð Y´cð YÌDð YÐUYñ Yr   c          	      óÖ  € \        V4      pV'       d¦   VP                  R 8X  g   VP                  R4      '       d   \        P                  ! R4      h\
        P                  P                  P                  4       p\        WWTP                  4       \        P                  ! RRVP                  4       R7       R# \        P                  P                  V4      '       d   \        P                  ! R4      h\        P                  P!                  V4      '       g   \        P                  ! RV 24      hVP                  pVR 8X  d!   \        P                  P#                  V4      pMGVP                  R4      '       d/   VR,           \        P                  P#                  V4      ,           pMTp\        WW4       \        P                  ! RV\%        WGR	7      P                  4       R7       R# )
rr   rV   zAStdin upload requires a full destination path including filename.ÚUploadedÚstdinr3   Nz]Source must be a file, not a directory. Use `hf upload` or `hf buckets sync` for directories.zSource file not found: )rl   )r   rl   rZ   r   r7   rJ   ry   rL   rI   Ú_upload_singler   r6   Úto_urirD   rE   rY   ÚisfileÚbasenamer   )r;   r   r   r4   rN   Údatard   Úremote_paths   &&&$    r   r:   r:   Ó   sT  € Ü
�sÓ
€CçØ×Ñ˜rÔ! S§\¡\°#×%6Ò%6Ü×$Ò$Ð%hÓiÐiÜ�y‰y×Ñ×$Ñ$Ó&ˆÜ�s ×'7Ñ'7Ô8Ü�
Š
�: 7°·
±
³Õ=Ùä	‡w�w‡}�}�S×ÒÜ× Ò Økó
ð 	
ô �7‰7�>‰>˜#×ÒÜ× Ò Ð#:¸3¸%Ð!@ÓAÐAà×Ñ€FØ�„|Ü—g‘g×&Ñ& sÓ+‰Ø	�‰�c×	Ò	Ø˜s•l¤R§W¡W×%5Ñ%5°cÓ%:Õ:‰àˆä�3˜SÔ.Ü‡J‚Jˆz˜s¬°Ô(N×(UÑ(UÓ(W×Xr   c          
      ób   € V ^8„  d   QhR\         R\        R\        \        ,          R\        RR/# )r   r;   rN   Úsourcer   r   N)r   r   r   Úbytes)r   s   "r   r   r   ñ   s4   € ÷ 
ñ 
œð 
¤Eð 
´3¼µ;ð 
ÌSð 
ÐUYñ 
r   c                óÔ   € VP                   '       d"   V P                  VP                  W#3.R7       R# V P                  VVVP                  VP                  VP
                  R7       R# )z4Upload a single file or bytes (to a repo or bucket).)Úadd)Úpath_or_fileobjrl   rf   rg   rh   N)r-   Úbatch_bucket_filesrk   Úupload_filern   rh   )r;   rN   r�   r   s   &&&&r   rz   rz   ñ   sT   € à
‡}‡}€}Ø×Ñ˜sŸv™v¨VÐ,AÐ+BÐÖCà�‰Ø"Ø$Ø—F‘FØ—h‘hØ—\‘\ð 	ö 	
r   )
z(hf cp hf://username/my-model/config.jsonz6hf cp hf://username/my-model/config.json ./config.jsonz8hf cp hf://datasets/username/my-dataset/data.csv ./data/z3hf cp hf://buckets/username/my-bucket/config.json -zBhf cp ./model.safetensors hf://username/my-model/model.safetensorsz9hf cp ./config.json hf://buckets/username/my-bucket/logs/z3hf cp - hf://buckets/username/my-bucket/config.jsonz;hf cp hf://username/source-model/ hf://username/dest-model/z]hf cp hf://datasets/username/my-dataset/processed/ hf://buckets/username/my-bucket/processed/zihf cp hf://buckets/username/my-bucket/logs/ hf://buckets/username/archive-bucket/  # copies contents only)r+   r,   )N)#Ú__doc__rD   rJ   Údataclassesr   Útypingr   r   r   Úhuggingface_hubr   Úhuggingface_hub.errorsr   Úhuggingface_hub.utilsr   r   r	   r
   r   Ú
_cli_utilsr   r   Ú_outputr   ÚCP_EXAMPLESr   r(   r#   r$   r8   r9   rG   rC   r:   rz   r'   r   r   Ú<module>r‘      ss   ðñó 
Û 
Ý ß %ã å !Ý +ß oÕ oç ,Ý ò€ð$ Ð&Õ'€	÷õ@rõ(!EõH
3õ6õ&4õ./õY÷<
r   