+
    &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   "o/Users/jameslopez/projects/CWCArchive/cwc-podcast/.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# )zBuild 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     ! !NN abd
!
 $JNN 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sTz 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ScFV'l6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cDj !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3JM#I422IcNI Ys 

8. Y;$$%fgg  d
 	

 $S.#. ??3S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% 
3c 
3d 
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		 	 #%%ww||G6HSx0h%% vvj11e1JJ%%++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 6S 6sTz 6d 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||BFF33s||C7H7HWW\\#0

,J
J.Sz*JJ|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% 4e 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*Jcg!h
 WW__Z077C
#6zBBg!11(())! 2 O JJ3 CBBBs   >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   zSource 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yy$$&s'7'78

:7

=	ww}}S  k
 	
 77>>#  #:3%!@AAF|gg&&s+	c		slRWW%5%5c%::3S.JJzs(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    
}}}svvV,A+BC"$FFhh\\ 	 	
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   