+
    &jR                        R t ^ RIHt ^ RIt^ RIHt ^ RIHtHtH	t	H
t
 ^RIHt ^RIHtHtHtHt ^RIHt ^RIHtHt ^R	IHtHt ]P4                  ! ]4      t]! R
R7      t]P=                  R. R,OR7      R-R R ll4       tR R lt ]P=                  R. R.OR7      R/R R ll4       t!R R lt"R R lt#]P=                  RRR.R7      R0R R ll4       t$]P=                  R. R1OR7      R2R R  ll4       t%]P=                  R!. R3OR7      R4R" R# ll4       t&]P=                  R$. R5OR7      R0R% R& ll4       t']P=                  R'. R6OR7      R7R( R) ll4       t(]P=                  R*. R8OR7      ! ]! R+4      4       R# )9z7Contains commands to interact with buckets via the CLI.)	AnnotatedN)logging)BUCKET_PREFIX
BucketFileFilterMatcher_parse_bucket_uri)REPO_REGIONS)	SearchOptTokenOpt
get_hf_apityper_factory)make_cp)format_sizeprint_file_listing)OutputFormatoutz"Commands to interact with buckets.helpcreate)nameexamplesc                |   V ^8  d   QhR\         \        \        P                  ! RR7      3,          R\         \        \        P
                  ! RRR7      3,          R\         \        R,          \        P
                  ! R	R
R7      3,          R\         \        \        P
                  ! RRR7      3,          R\        RR/# )   	bucket_idzTBucket ID: bucket_name, namespace/bucket_name, or hf://buckets/namespace/bucket_namer   privatez	--privatezCreate a private bucket.regionNz--regionzdCloud region in which to create the bucket. Can be one of 'us' or 'eu'. Requires Team plan or above.exist_okz
--exist-okz3Do not raise an error if the bucket already exists.tokenreturn)r   strtyperArgumentboolOptionr   r
   )formats   "s/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/huggingface_hub/cli/buckets.py__annotate__r&   9   s     0R 0Rg	
	0R +	
	0R tw	
	0R* F	
	+0R8 90R: 
;0R    c                   \        VR7      pV P                  \        4      '       dK   \        V 4      pVP                  '       d"   \
        P                  ! RV  R\         R24      hVP                  p TP                  T V'       d   TMRVVR7      p\        P                  ! RVP                  P                  4       VP                  R7       R# )	zCreate a new bucket.r   z-Cannot specify a prefix for bucket creation: . Use namespace/bucket_name or namespace/bucket_name.N)r   r   r   zBucket created)uriurl)r   
startswithr   r   path_in_repor    BadParameteridcreate_bucketr   resultr,   to_urir-   )r   r   r   r   r   apiparsed
bucket_urls   &&&&&   r%   r   r   .   s    T 5
!CM**"9-$$?	{ K11>?UW  II	"""	 # J JJZ^^%:%:%<*..Qr'   c                0    V ^8  d   QhR\         R\        /# )r   argumentr   r   r"   )r$   s   "r%   r&   r&   l   s      C D r'   c                t    V P                  \        4      '       d   V \        \        4      R pRV9   # T pRV9   # )zFCheck if argument is a bucket ID (namespace/name) vs just a namespace.N/)r.   r   len)r9   paths   & r%   _is_bucket_idr?   l   sB    =))M*,- $; $;r'   z	list | lsc                   V ^8  d   QhR\         \        R,          \        P                  ! RR7      3,          R\         \        \        P
                  ! RRRR7      3,          R	\         \        \        P
                  ! R
RR7      3,          R\         \        \        P
                  ! RRRR7      3,          R\        R\        RR/# )r   r9   NzyNamespace (user or org) to list buckets, or bucket ID (namespace/bucket_name(/prefix) or hf://buckets/...) to list files.r   human_readablez--human-readablez-hz$Show sizes in human readable format.as_treez--treez3List files in tree format (only for listing files).	recursive--recursive-Rz0List files recursively (only for listing files).searchr   r   )r   r   r    r!   r"   r#   r	   r
   )r$   s   "r%   r&   r&      s     >
 >
d
W	
	>
 7	
	>
$ F	
	%>
2 C	
	3>
B C>
D E>
F 
G>
r'   c           	         V RJ;'       d    \        V 4      pV'       d-   Ve   \        P                  ! R4      h\        V VVVVR7       R# \	        V VVVVVR7       R# )zList buckets or files in a bucket.

When called with no argument or a namespace, lists buckets.
When called with a bucket ID (namespace/bucket_name), lists files in the bucket.
Nz'Cannot use --search when listing files.)r9   rA   rB   rC   r   )	namespacerF   rA   rB   rC   r   )r?   r    r0   _list_files_list_buckets)r9   rA   rB   rC   rF   r   is_file_modes   &&&&&& r%   list_cmdrL   u   sj    r 4'CCM(,CL$$%NOO)	
 	)	
r'   c                    V ^8  d   QhR\         R,          R\         R,          R\        R\        R\        R\         R,          RR/# )	r   rH   NrF   rA   rB   rC   r   r   r:   )r$   s   "r%   r&   r&      sZ      3  3Tz 3$J 3  3 	 3
  3 : 3 
 3r'   c                N   V'       d   \         P                  ! R4      hV'       d   \         P                  ! R4      hV e?   V P                  \        4      '       d$   V \	        \        4      R p V P                  R4      p \        VR7      pVP                  WR7       Uu. uF_  pRVP                  RVP                  R	V'       d   \        VP                  V4      MVP                  R
VP                  RVP                  /NKa  	  pp\        P                  ! VR	R/R7       R# u upi )zList buckets in a namespace.z'Cannot use --tree when listing buckets.z,Cannot use --recursive when listing buckets.Nr<   r)   )rH   rF   r1   r   sizetotal_files
created_atright)
alignments)r    r0   r.   r   r=   rstripr   list_bucketsr1   r   r   rO   rP   rQ   r   table)	rH   rF   rA   rB   rC   r   r5   bucketitemss	   &&&&&&   r%   rJ   rJ      s      !JKK  !OPP !5!5m!D!Dc-023	$$S)	
5
!C &&&J	 KF &))v~~K^<TZT_T_6--&++	
 K 
 	 IIe 12	s   %D"?D"c                f    V ^8  d   QhR\         R\        R\        R\        R\         R,          RR/# )r   r9   rA   rB   rC   r   Nr   r:   )r$   s   "r%   r&   r&      sP     c ccc c 	c
 :c 
cr'   c                F   V'       d:   \         P                  \        P                  8X  d   \        P
                  ! R4      h\        VR7      p\        V 4      p\        TP                  VP                  VP                  ;'       g    RVR7      4      p\        WqW#R7       R# )zList files in a bucket.z%Cannot use --tree with --format json.r)   NprefixrC   )rA   rB   rC   )r   moder   jsonr    r0   r   r   listlist_bucket_treer1   r/   r   )r9   rA   rB   rC   r   r5   r6   rX   s   &&&&&   r%   rI   rI      s     388|000  !HII
5
!Cx(FII&&..$ 	 	
E uWbr'   infozhf buckets info user/my-bucketz+hf buckets info hf://buckets/user/my-bucketc                x    V ^8  d   QhR\         \        \        P                  ! RR7      3,          R\        RR/# )r   r   FBucket ID: namespace/bucket_name or hf://buckets/namespace/bucket_namer   r   r   Nr   r   r    r!   r
   )r$   s   "r%   r&   r&     sD     " "Y	
	" " 
"r'   c                    \        VR7      p\        V 4      pVP                  VP                  4      p\        P
                  ! VRR7       R# )zGet info about a bucket.r)   r1   )id_keyN)r   r   bucket_infor1   r   dict)r   r   r5   r6   rW   s   &&   r%   ra   ra      s8    " 5
!Cy)F__VYY'FHHVD!r'   deletec                   V ^8  d   QhR\         \        \        P                  ! RR7      3,          R\         \        \        P
                  ! RRRR7      3,          R\         \        \        P
                  ! R	R
R7      3,          R\        RR/# )r   r   rc   r   yes--yes-ySkip confirmation prompt.
missing_okz--missing-okz3Do not raise an error if the bucket does not exist.r   r   N)r   r   r    r!   r"   r#   r
   )r$   s   "r%   r&   r&      s     .6 .6Y	
	.6 
,	
	
.6 F	
	.6, -.6. 
/.6r'   c                   V P                  \        4      '       dL   \        V 4      pVP                  '       d"   \        P
                  ! RV  R\         R24      hVP                  p M(RV 9  d"   \        P
                  ! RV  R\         R24      h\        P                  ! RV  R2VR	7       \        VR
7      pVP                  WR7       \        P                  ! RV R7       R# )zwDelete a bucket.

This deletes the entire bucket and all its contents. Use `hf buckets rm` to remove individual files.
z-Cannot specify a prefix for bucket deletion: r*   r+   r<   zInvalid bucket ID: z-. Must be in format namespace/bucket_name or z(Are you sure you want to delete bucket ''?rk   r)   )ro   zBucket deleted)r   N)r.   r   r   r/   r    r0   r1   r   confirmr   delete_bucketr3   )r   rk   ro   r   r6   r5   s   &&&&  r%   ri   ri     s    J M**"9-$$?	{ K11>?UW  II		I	  !) -;;H/I_a
 	

 KK:9+RHcR
5
!Ci7JJ95r'   zremove | rmc                Z   V ^8  d   QhR\         \        \        P                  ! RR7      3,          R\         \        \        P
                  ! RRRR7      3,          R\         \        \        P
                  ! R	R
RR7      3,          R\         \        \        P
                  ! RRR7      3,          R\         \        \        ,          R,          \        P
                  ! RR7      3,          R\         \        \        ,          R,          \        P
                  ! RR7      3,          R\        RR/# )r   r9   zBucket path: namespace/bucket_name/path or hf://buckets/namespace/bucket_name/path. With --recursive, namespace/bucket_name is also accepted to target all files.r   rC   rD   rE   z0Remove files recursively under the given prefix.rk   rl   rm   rn   dry_run	--dry-runz8Preview what would be deleted without actually deleting.includeNzQInclude only files matching pattern (can specify multiple). Requires --recursive.excludezLExclude files matching pattern (can specify multiple). Requires --recursive.r   r   r   r   r    r!   r"   r#   r_   r
   )r$   s   "r%   r&   r&   [  sB    H Ha	
	H C	
	H$ 
,	
	
%H4 K	
	5HB S	Dd	
	CHN S	D_	
	OHZ [H\ 
]Hr'   c                0  a \        V 4      pVP                  oVP                  pVR8X  d&   V'       g   \        P                  ! RS RS R24      hV'       g	   V'       d   V'       g   \        P                  ! R4      h\        VR7      p	V'       EdK   \        P                  ! R4      p
. pT	P                  ST;'       g    RR	R
7       FJ  p\        V\        4      '       g   K  VP                  V4       V
P                  R\        V4       R24       KL  	  V
P                  R\        V4       R24       V'       g	   V'       dA   \        WER7      pV Uu. uF'  qP!                  VP"                  4      '       g   K%  VNK)  	  ppMTpV Uu. uF  qP"                  NK  	  pp\%        R V 4       4      p\'        VR	R7      pV'       g   \        P(                  ! R4       R# \        V4       RV 2pV'       gT   V'       gL   \        P(                  ! RP+                  R V 4       4      4       \        P,                  ! RV RS R2RR7       V'       dL   \        P(                  ! RP+                  V3R lV 4       4      4       \        P(                  ! RV R24       R# V	P/                  SVR7       \        P0                  ! RV RS R2S\        V4      VR7       R# TpV'       g   \        P                  ! R 4      hV'       d;   \        P(                  ! R!\2         S R"V 24       \        P(                  ! R#4       R# \        P,                  ! R$V R%S R2VR7       V	P/                  SV.R7       \        P0                  ! R&VSR'7       R# u upi u upi )(zZRemove files from a bucket.

To delete an entire bucket, use `hf buckets delete` instead.
 z?No file path specified. To remove files, provide a path (e.g. 'zd/FILE') or use --recursive to remove all files. To delete the entire bucket, use `hf buckets delete z`.z,--include and --exclude require --recursive.r)   zListing files from remoteNTr[   zListing files from remote (z files))include_patternsexclude_patternsc              3   8   "   T F  qP                   x  K  	  R # 5iN)rO   ).0fs   & r%   	<genexpr>remove.<locals>.<genexpr>  s     7As   )rA   zNo files to remove.z file(s) totaling 
c              3   ,   "   T F
  pR V 2x  K  	  R# 5i)z  N )r   r>   s   & r%   r   r     s     BztD6{zs   zRemove z from 'rq   Frr   c              3   @   <"   T F  pR \          S RV 2x  K  	  R# 5i)delete: r<   N)r   )r   r>   r   s   & r%   r   r     s%     cXbPT-1TFKXbs   z
(dry run) z would be removed.)ri   zRemoved ')r   files_deletedrO   zFile path cannot be empty.r   r<   z"(dry run) 1 file would be removed.zRemove 'z' from 'zFile removed)r>   r   )r   r1   r/   r    r0   r   r   statusr`   
isinstancer   appendupdater=   doner   matchesr>   sumr   textjoinrs   batch_bucket_filesr3   r   )r9   rC   rk   rv   rx   ry   r   r6   r\   r5   r   	all_filesitemmatcherr   matched_files
file_paths
total_sizesize_strcount_label	file_pathr   s   &&&&&&&              @r%   remover   Q  s   z x(F		I  F|I   k "DDM;bR
 	
 	7I  !OPP
5
!Cy78&(	((>>T ) 
D
 $
++  & ;C	N;K7ST
 	1#i.1AIJg#WWG(1M	1__QVV5LQQ	MMM%M&34mffm
4777
z$?HH*+Z));H:F7HHTYYBzBBCKK'+gi[COHHTYYcXbccdHHz+.@ABy<

{m79+Q7j/		
 	$$%ABBHHxyk9+FGHH9:hyk)B?SIy)=

>	YGY N 5s   "N=NNmovec          	          V ^8  d   QhR\         \        \        P                  ! RR7      3,          R\         \        \        P                  ! RR7      3,          R\        RR/# )	r   from_idzMSource bucket ID: namespace/bucket_name or hf://buckets/namespace/bucket_namer   to_idzRDestination bucket ID: namespace/bucket_name or hf://buckets/namespace/bucket_namer   r   Nrd   )r$   s   "r%   r&   r&     sp     "K "K`	
	"K e	
	"K "K 
"Kr'   c                   \        V 4      pVP                  '       d"   \        P                  ! RV  R\         R24      h\        V4      pVP                  '       d"   \        P                  ! RV R\         R24      h\        VR7      pVP                  VP                  VP                  R7       \        P                  ! RVP                  VP                  R7       R# )z2Move (rename) a bucket to a new name or namespace.z)Cannot specify a prefix for bucket move: r*   r+   r)   )r   r   zBucket movedN)
r   r/   r    r0   r   r   move_bucketr1   r   r3   )r   r   r   parsed_from	parsed_tor5   s   &&&   r%   r   r     s    2 $G,K  7y A--:O;QS
 	
 "%(I  7w ?--:O;QS
 	

 5
!COOKNN),,O?JJ~{~~Y\\Jr'   syncc          #      $   V ^8  d   QhR\         \        R,          \        P                  ! RR7      3,          R\         \        R,          \        P                  ! RR7      3,          R\         \        \        P
                  ! RR7      3,          R	\         \        \        P
                  ! R
RR7      3,          R\         \        \        P
                  ! RRR7      3,          R\         \        R,          \        P
                  ! RR7      3,          R\         \        R,          \        P
                  ! RR7      3,          R\         \        \        P
                  ! RRR7      3,          R\         \        \        ,          R,          \        P
                  ! RR7      3,          R\         \        \        ,          R,          \        P
                  ! RR7      3,          R\         \        R,          \        P
                  ! RR7      3,          R\         \        \        P
                  ! RRR7      3,          R\         \        \        P
                  ! R R!R7      3,          R"\         \        \        P
                  ! R#R$R%R7      3,          R&\        R'R/# )(r   sourceNzKSource path: local directory or hf://buckets/namespace/bucket_name(/prefix)r   destzPDestination path: local directory or hf://buckets/namespace/bucket_name(/prefix)ri   z/Delete destination files not present in source.ignore_timesz--ignore-timesz;Skip files only based on size, ignoring modification times.ignore_sizesz--ignore-sizesz<Skip files only based on modification times, ignoring sizes.planz=Save sync plan to JSONL file for review instead of executing.applyz#Apply a previously saved plan file.rv   rw   z5Print sync plan to stdout as JSONL without executing.rx   z6Include files matching pattern (can specify multiple).ry   z6Exclude files matching pattern (can specify multiple).filter_fromz(Read include/exclude patterns from file.existingz
--existingzASkip creating new files on receiver (only update existing files).ignore_existingz--ignore-existingzCSkip updating files that exist on receiver (only create new files).verbosez	--verbosez-vz%Show detailed logging with reasoning.r   r   rz   )r$   s   "r%   r&   r&     s    rP rPd
^	
	rP d
c	
	rP B	
	rP& N	
	'rP4 O	
	5rPB d
P	
	CrPN d
6	
	OrPZ H	
	[rPh S	DI	
	irPt S	DI	
	urP@ d
;	
	ArPL T	
	MrPZ V	
	[rPh 8	
	irPx yrPz 
{rPr'   c                   \        VR7      pVP                  V VVVVVVVV	V
VVVV\        P                  ! 4       R7       V'       d:   \        P                  ! 4       '       g   \        P                  ! RV R24       R# R# R# )z0Sync files between local directory and a bucket.r)   )r   r   ri   r   r   r   r   rx   ry   r   r   r   rv   r   quietzRun `hf buckets sync --apply z` to execute this plan.N)r   sync_bucketr   is_quiethint)r   r   ri   r   r   r   r   rv   rx   ry   r   r   r   r   r   r5   s   &&&&&&&&&&&&&&& r%   r   r     s    X 5
!COO!!'lln  " CLLNN06MNO #tr'   cpbuckets)zhf buckets create my-bucketz hf buckets create user/my-bucketz-hf buckets create hf://buckets/user/my-bucketz*hf buckets create user/my-bucket --privatez+hf buckets create user/my-bucket --exist-okz,hf buckets create user/my-bucket --region us)FNFN)
zhf buckets listzhf buckets list huggingfacez$hf buckets list --search "my-prefix"zhf buckets list user/my-bucketz!hf buckets list user/my-bucket -Rz!hf buckets list user/my-bucket -hz%hf buckets list user/my-bucket --treez(hf buckets list user/my-bucket --tree -hz+hf buckets list hf://buckets/user/my-bucketz%hf buckets list user/my-bucket/sub -R)NFFFNNr   )z hf buckets delete user/my-bucketz-hf buckets delete hf://buckets/user/my-bucketz&hf buckets delete user/my-bucket --yesz-hf buckets delete user/my-bucket --missing-ok)FFN)z)hf buckets remove user/my-bucket/file.txtz2hf buckets rm hf://buckets/user/my-bucket/file.txtz.hf buckets rm user/my-bucket/logs/ --recursivez:hf buckets rm user/my-bucket --recursive --include "*.tmp"z8hf buckets rm user/my-bucket/data/ --recursive --dry-run)FFFNNN)z/hf buckets move user/old-bucket user/new-bucketz/hf buckets move user/my-bucket my-org/my-bucketzIhf buckets move hf://buckets/user/old-bucket hf://buckets/user/new-bucket)z2hf buckets sync ./data hf://buckets/user/my-bucketz2hf buckets sync hf://buckets/user/my-bucket ./dataz;hf buckets sync ./data hf://buckets/user/my-bucket --deletez^hf buckets sync hf://buckets/user/my-bucket ./data --include "*.safetensors" --exclude "*.tmp"zIhf buckets sync ./data hf://buckets/user/my-bucket --plan sync-plan.jsonlz'hf buckets sync --apply sync-plan.jsonlz<hf buckets sync ./data hf://buckets/user/my-bucket --dry-runzChf buckets sync ./data hf://buckets/user/my-bucket --dry-run | jq .)NNFFFNNFNNNFFFN)zEhf buckets cp hf://buckets/username/my-bucket/config.json config.jsonz<hf buckets cp hf://buckets/username/my-bucket/data.csv data/z;hf buckets cp hf://buckets/username/my-bucket/config.json -zQhf buckets cp model.safetensors hf://buckets/username/my-bucket/model.safetensorsz?hf buckets cp config.json hf://buckets/username/my-bucket/logs/z;hf buckets cp - hf://buckets/username/my-bucket/config.jsonzYhf buckets cp hf://buckets/username/my-bucket/data.csv hf://buckets/username/dest-bucket/z_hf buckets cp hf://buckets/username/source-bucket/logs/ hf://buckets/username/dest-bucket/logs/))__doc__typingr   r    huggingface_hubr   huggingface_hub._bucketsr   r   r   r   hf_apir   
_cli_utilsr	   r
   r   r   _cpr   _file_listingr   r   _outputr   r   
get_logger__name__loggerbuckets_clicommandr   r?   rL   rJ   rI   ra   ri   r   r   r   r   r'   r%   <module>r      s   >   #  "   : & 
		H	% !EF 	  
0R
0Rf 	  >
>
B 3Fc0 	(5  ""  	  .6.6b 	  	H	HD 	  "K"KT 		  rPrPv   	   
)r'   