
    5pj.                      n   S r SSKrSSKrSSKrSSKJr  SSKrSSKJrJ	r	  SSK
Jr  SSKJrJr  SSKJr  SS	KJrJrJrJrJrJrJr  SS
KJrJr  SSKJr  \	R<                  " \5      r / SQr!             S(S\S\\"S-  \" SS94   S\\"S-  \" SS94   S\S\S\S\\#\"   S-  \" SS94   S\\#\"   S-  \" SS94   S\\#\"   S-  \" SS94   S\\"S-  \" SS94   S\\"S-  \" SS94   S \\$\" S!S94   S"\\%S-  \" S#S94   S$\S%S4S& jjr&S\"S\"S-  S\"S-  S\#\"   S-  S%\'\"\"\#\"   S-  4   4
S' jr(g))z7Contains command to upload a repo or file with the CLI.    N)	Annotated)	constantslogging)CommitScheduler)CLIErrorRevisionNotFoundError)parse_hf_uri   )
PrivateOpt	RepoIdArgRepoTypeRepoTypeOptionalOptRevisionOptTokenOpt
get_hf_api)ArgumentOption)out)zhf upload my-cool-model . .z:hf upload Wauplin/my-cool-model ./models/model.safetensorszChf upload Wauplin/my-cool-dataset ./data /train --repo-type=datasetzrhf upload Wauplin/my-cool-model ./models . --commit-message="Epoch 34/50" --commit-description="Val accuracy: 68%"z?hf upload bigcode/the-stack . . --repo-type dataset --create-prrepo_id
local_pathzkLocal path to the file or folder to upload. Wildcard patterns are supported. Defaults to current directory.)helppath_in_repoz\Path of the file or folder in the repo. Defaults to the relative path of the file or folder.	repo_typerevisionprivateincludez'Glob patterns to match files to upload.excludez.Glob patterns to exclude from files to upload.deletezDGlob patterns for file to be deleted from the repo while committing.commit_messagez9The summary / title / first line of the generated commit.commit_descriptionz(The description of the generated commit.	create_prz0Whether to upload content as a new Pull Request.everyzNIf set, a background job is scheduled to create commits every `every` minutes.tokenreturnc                   ^ ^^^^^	^
^^^^^^^ Tb  TS::  a  [         R                  " SSS9eT R                  [        R                  5      (       a  Ub  [        ST  S35      eTb  [        ST  S35      e[        T 5      nUR                  (       a  [        S	5      eUR                  UR                  UR                  sm mmUR                  (       a+  Ub  [        S
UR                   SU S35      eUR                  nO#U=(       d    [        R                  R                  m[        US9m[!        T XUS9u  mmmS["        4UU
U	UUUUUU UUUUU4S jjnU" 5       n[$        R&                  " SUS9  g)zLUpload a file or a folder to the Hub. Recommended for single-commit uploads.Nr   z --every must be a positive valuer"   )
param_hintz3'--repo-type' cannot be used with an 'hf://' URI ('z').z2'--revision' cannot be used with an 'hf://' URI ('z@Buckets are not supported by `hf upload`. Use `hf sync` instead.z)Cannot combine a path in the hf:// URI ('z&') with the `path_in_repo` argument (')r#   )r   r   r   r   r$   c                  b  > [         R                  R                  T5      (       a  Tb:  [        T5      S:  a+  [	        T[
        5      (       a  [        R                  " S5        Tb%  [        T5      S:  a  [        R                  " S5        Tb%  [        T5      S:  a  [        R                  " S5        TGb4  [         R                  R                  T5      (       a  [         R                  R                  T5      n [         R                  R                  T5      nTR                  S5      u  p#nUSSU4;  a,  [        R                  " SU(       a  US-   OSU-    S	T S
35        U/n/ nO0Tn TnTnTnTb%  [        T5      S:  a  [        R                  " S5        [        U TTTUUUTTT	S9
n[        R                  " ST SUR                   S35          [         R"                  " S5        M  [         R                  R                  T5      (       d3  [         R                  R)                  T5      (       d  [+        ST S35      eT	R-                  TTSTTS:X  a  SOS S9R                  nTb  T(       d   T	R/                  UTTS9  [         R                  R                  T5      (       a  T	R9                  TTUTTTT
TS9$ T	R;                  TTUTTTT
TTTTS9$ ! [$         a    UR'                  5          gf = f! [0         a.    [2        R5                  ST S35        T	R7                  UTTSS9   Nf = f)Nr   z3Ignoring --include since a single file is uploaded.z3Ignoring --exclude since a single file is uploaded.z2Ignoring --delete since a single file is uploaded./ .zMScheduled uploads keep the local file name, so the file will be uploaded as 'z' rather than 'z='. Rename the local file to upload it under a different name.z8Ignoring --delete when uploading with scheduled commits.)
folder_pathr   r   r   allow_patternsignore_patternsr   r   r"   hf_apizScheduling commits every z minutes to Td   zStopped scheduled commits.zNo such file or directory: 'z'.spacegradio)r   r   exist_okr   	space_sdk)r   r   r   zBranch 'z' not found. Creating it...)r   r   branchr2   )path_or_fileobjr   r   r   r   r   r    r!   )r+   r   r   r   r   r   r    r!   r,   r-   delete_patterns)ospathisfilelen
isinstancelistwarningswarndirnamebasename
rpartitionr   warningr   textr   timesleepKeyboardInterruptstopisdirFileNotFoundErrorcreate_repo	repo_infor   loggerinfocreate_branchupload_fileupload_folder)r+   filenamepi_dest_filenamer,   r-   	schedulercreatedapir    r   r!   r   r"   r   r   r   repo_type_strresolved_includeresolved_local_pathresolved_path_in_repor   s            V/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/huggingface_hub/cli/upload.py
run_uploadupload.<locals>.run_upload   sB   77>>-..+4D0E0IjYikoNpNpST"s7|a'7ST!c&kAoRS  ww~~122
 !ggoo.AB77++,?@'<'G'G'L$} S((;;KK*,b3h"@AQfPg hVV
 #+"$1*!1")%#f+/MM"\]'''!- /I HH0|IDUDUCVVWXY4JJsO  ww~~122277==I\;];]#&BCVBWWY$Z[[//#"/7":h " 
 ' 	 	lgQYZ 77>>-..?? 32'!-#5# # 	 	   +.#)1+#" ! 
 	
Q % 4 34* ) lhxj0KLM!!']S[fj!kls$   K 2K6 K32K365L.-L.Uploaded)url)clickBadParameter
startswithr   HF_PROTOCOLr   r	   	is_bucketidtyper   r   r   modelvaluer   _resolve_upload_pathsstrr   result)r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   urir]   rl   rW   rX   rY   rZ   r[   s   `   `` ``````    @@@@@r\   uploadrn   5   s|   ~ UaZ  !CPWXX )//00 PQXPYY\]^^OPWyX[\]]7#==]^^+.66388S\\('?@P@P?QQw  yE  xF  FI  J  ++L"4hnn;;
5
!C DYJSZD@.0@j
 j
 j
 j
X \FJJzv&    c                 6  ^ U R                  S5      S   nUnTbB  [        U4S jS 5       5      (       a(  Ub  [        S5      eUb  US:w  a  [        S5      eSTS/4$ Tc(  [        R                  R                  U5      (       a  XDU4$ Tc)  [        R                  R                  U5      (       a  USU4$ Tc  [        SU S	35      eUcF  [        R                  R                  T5      (       a"  T[        R                  R                  T5      U4$ Uc  TSU4$ TX%4$ )
Nr(   c              3   ,   >#    U  H	  oT;   v   M     g 7f)N ).0cr   s     r\   	<genexpr>(_resolve_upload_paths.<locals>.<genexpr>  s     %O!:os   )*?[z9Cannot set --include when local_path contains a wildcard.r*   z<Cannot set path_in_repo when local_path contains a wildcard.'zB' is not a local file or folder. Please set local_path explicitly.)splitany
ValueErrorr7   r8   r9   rH   r@   )r   r   r   r   	repo_namerY   s    `    r\   rj   rj     s'    c"2&I#%O%O"O"OXYY#(;[\\J%%bggnnY77%555bggmmI66#///1YK'ijkkz : :277++J79III3 000|55ro   )NNNNNNNNNNFNN))__doc__r7   rD   r=   typingr   ra   huggingface_hubr   r   !huggingface_hub._commit_schedulerr   huggingface_hub.errorsr   r   huggingface_hub.utilsr	   
_cli_utilsr   r   r   r   r   r   r   
_frameworkr   r   _outputr   
get_logger__name__rL   UPLOAD_EXAMPLESrk   r<   boolfloatrn   tuplerj   rs   ro   r\   <module>r      s   > 	     . = B .   )  
		H	%  	 	%)  	 	 	 	 	 	 	wN'N'd
~	
	N' d
o	
	N' #N' N'  !N'" S	D:	
	#N'. S	DA	
	/N': S	DW	
	;N'F d
L	
	GN'R "d
;	
	SN'^ C	
	_N'j a	
	kN'v wN'x 
yN'b66!$t6;>:6PTUXPY\`P`6
3T#Y%%&6ro   