
    ,h                         S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  \R                  " \5      r " S	 S
5      r " S S\	5      rg)a  Contains command to update or delete files in a repository using the CLI.

Usage:
    # delete all
    huggingface-cli repo-files <repo_id> delete "*"

    # delete single file
    huggingface-cli repo-files <repo_id> delete file.txt

    # delete single folder
    huggingface-cli repo-files <repo_id> delete folder/

    # delete multiple
    huggingface-cli repo-files <repo_id> delete file.txt folder/ file2.txt

    # delete multiple patterns
    huggingface-cli repo-files <repo_id> delete file.txt "*.json" "folder/*.parquet"

    # delete from different revision / repo-type
    huggingface-cli repo-files <repo_id> delete file.txt --revision=refs/pr/1 --repo-type=dataset
    )_SubParsersAction)ListOptional)logging)BaseHuggingfaceCLICommand)HfApi   )show_deprecation_warningc                   (    \ rS rSrSS jrSS jrSrg)DeleteFilesSubCommand2   Nc                 R   Xl         UR                  U l        UR                  U l        UR                  U l        [	        UR
                  SS9U l        UR                  U l        UR                  U l        UR                  U l	        UR                  U l
        UR
                  U l        g )Nzhuggingface-cli)tokenlibrary_name)argsrepo_id	repo_typerevisionr   r   apipatternscommit_messagecommit_description	create_pr)selfr   s     [/var/www/html/shao/venv/lib/python3.13/site-packages/huggingface_hub/commands/repo_files.py__init__DeleteFilesSubCommand.__init__3   sx    	 LL(,'+}}djj?PQ#'==-1-@-@151H1H#~~$(JJ
    c           
      X   [        SS5        [        R                  " 5         U R                  R	                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  S9n[        SU S35        [        R                  " 5         g )Nzhuggingface-cli repo-fileszhf repo-files)delete_patternsr   r   r   r   r   r   z+Files correctly deleted from repo. Commit: .)r
   r   set_verbosity_infor   delete_filesr   r   r   r   r   r   r   printset_verbosity_warning)r   urls     r   runDeleteFilesSubCommand.run?   s     !=O""$hh## MMLLnn]]..#66nn $ 
 	;C5BC%%'r   )
r   r   r   r   r   r   r   r   r   r   )returnN)__name__
__module____qualname____firstlineno__r   r'   __static_attributes__ r   r   r   r   2   s    
/(r   r   c                   ,    \ rS rSr\S\4S j5       rSrg)RepoFilesCommandP   parserc                    U R                  SSS9nUR                  S[        SS9  UR                  SSS	9nUR                  S
SS9nUR	                  S S9  UR                  SS[        SS9  UR                  S/ SQSSS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  SSSS 9  UR                  S![        S"S9  UR	                  [
        S9  g )#Nz
repo-filesz!Manage files in a repo on the Hub)helpr   z9The ID of the repo to manage (e.g. `username/repo-name`).)typer5   z$Action to execute against the files.T)r5   requireddeletez#Delete files from a repo on the Hubc                     [        U 5      $ )N)r   )r   s    r   <lambda>6RepoFilesCommand.register_subcommand.<locals>.<lambda>_   s
    8Md8Sr   )funcr   +z'Glob patterns to match files to delete.)nargsr6   r5   z--repo-type)modeldatasetspacer?   z/Type of the repo to upload to (e.g. `dataset`).)choicesdefaultr5   z
--revisionzAn optional Git revision to push to. It can be a branch name or a PR reference. If revision does not exist and `--create-pr` is not set, a branch will be automatically created.z--commit-messagez9The summary / title / first line of the generated commit.z--commit-descriptionz(The description of the generated commit.z--create-pr
store_truez7Whether to create a new Pull Request for these changes.)actionr5   z--tokenzIA User Access Token generated from https://huggingface.co/settings/tokens)
add_parseradd_argumentstradd_subparsersset_defaultsr1   )r3   repo_files_parserrepo_files_subparsersdelete_subparsers       r   register_subcommand$RepoFilesCommand.register_subcommandQ   so   "--lAd-e&&C&a 	' 	
 !2 @ @7 !A !
 1;;6 < 
 	%%+S%T%%:	 	& 	
 	%%1B	 	& 	
 	%%_	 	& 	
 	%%S/j 	& 	
 	%%"3] 	& 	
 	%%,5n 	& 	
 	&&\ 	' 	
 	&&,<&=r   r/   N)r*   r+   r,   r-   staticmethodr   rN   r.   r/   r   r   r1   r1   P   s    2>$5 2> 2>r   r1   N)__doc__argparser   typingr   r   huggingface_hubr   huggingface_hub.commandsr   huggingface_hub.hf_apir   
_cli_utilsr
   
get_loggerr*   loggerr   r1   r/   r   r   <module>rZ      sG   , ' ! # > ( 0 
		H	%( (<4>0 4>r   