Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -1,4 +1,3 @@
# coding=utf-8
# Copyright 2023-present, the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -12,44 +11,35 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains command to update or delete files in a repository using the CLI.
"""Legacy `hf repo-files` command.
Usage:
# delete all
hf repo-files delete <repo_id> "*"
# delete single file
hf repo-files delete <repo_id> file.txt
# delete single folder
hf repo-files delete <repo_id> folder/
# delete multiple
hf repo-files delete <repo_id> file.txt folder/ file2.txt
# delete multiple patterns
hf repo-files delete <repo_id> file.txt "*.json" "folder/*.parquet"
# delete from different revision / repo-type
hf repo-files delete <repo_id> file.txt --revision=refs/pr/1 --repo-type=dataset
Kept for backward compatibility. Users are nudged to use `hf repos delete-files` instead.
"""
from typing import Annotated, Optional
from typing import Annotated
import typer
from huggingface_hub import logging
from ._cli_utils import RepoIdArg, RepoType, RepoTypeOpt, RevisionOpt, TokenOpt, get_hf_api, typer_factory
from ._cli_utils import (
RepoIdArg,
RepoType,
RepoTypeOpt,
RevisionOpt,
TokenOpt,
get_hf_api,
typer_factory,
)
from ._output import out
logger = logging.get_logger(__name__)
repo_files_cli = typer_factory(
help="(Deprecated) Manage files in a repo on the Hub. Use `hf repos delete-files` instead."
)
repo_files_cli = typer_factory(help="Manage files in a repo on the Hub.")
@repo_files_cli.command("delete")
@repo_files_cli.command(
"delete",
)
def repo_files_delete(
repo_id: RepoIdArg,
patterns: Annotated[
@ -61,13 +51,13 @@ def repo_files_delete(
repo_type: RepoTypeOpt = RepoType.model,
revision: RevisionOpt = None,
commit_message: Annotated[
Optional[str],
str | None,
typer.Option(
help="The summary / title / first line of the generated commit.",
),
] = None,
commit_description: Annotated[
Optional[str],
str | None,
typer.Option(
help="The description of the generated commit.",
),
@ -80,6 +70,7 @@ def repo_files_delete(
] = False,
token: TokenOpt = None,
) -> None:
out.warning("`hf repo-files delete` is deprecated. Use `hf repos delete-files` instead.")
api = get_hf_api(token=token)
url = api.delete_files(
delete_patterns=patterns,
@ -90,5 +81,4 @@ def repo_files_delete(
commit_description=commit_description,
create_pr=create_pr,
)
print(f"Files correctly deleted from repo. Commit: {url}.")
logging.set_verbosity_warning()
out.result("Files deleted", repo_id=repo_id, commit_url=url)