o
    h                     @   s   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ dd	lmZ d
dlmZ eeZG dd deZG dd dZdS )a&  Contains commands to interact with repositories on the Hugging Face Hub.

Usage:
    # create a new dataset repo on the Hub
    huggingface-cli repo create my-cool-dataset --repo-type=dataset

    # create a private model repo on the Hub
    huggingface-cli repo create my-cool-model --private
    N)_SubParsersAction)Optional)BaseHuggingfaceCLICommand)ANSI)SPACES_SDK_TYPES)HfApi)logging   )show_deprecation_warningc                   @   s   e Zd ZedefddZdS )RepoCommandsparserc                 C   s   | j ddd}|jdd}|j ddd}|jdtdd	 |jd
tdd	 |jdtdtd |jdddd |jdtdd	 |jdddd |jdtdd	 |jdtdd	 |jddddd |jdtdd	 |jd d! d" d S )#Nrepoz={create} Commands to interact with your huggingface.co repos.)helpz%huggingface.co repos related commandscreatez#Create a new repo on huggingface.corepo_idzThe ID of the repo to create to (e.g. `username/repo-name`). The username is optional and will be set to your username if not provided.)typer   z--repo-typezWOptional: set to "dataset" or "space" if creating a dataset or space, default is model.z--space_sdkzOOptional: Hugging Face Spaces SDK type. Required when --type is set to "space".)r   r   choicesz	--private
store_truezhWhether to create a private repository. Defaults to public unless the organization's default is private.)actionr   z--tokenzLHugging Face token. Will default to the locally saved token if not provided.z
--exist-okz-Do not raise an error if repo already exists.z--resource-group-idzoResource group in which to create the repo. Resource groups is only available for Enterprise Hub organizations.z--typez&[Deprecated]: use --repo-type instead.z-yz--yesz[Deprecated] no effect.z--organizationzE[Deprecated] Pass the organization namespace directly in the repo_id.c                 S   s   t | S )N)RepoCreateCommand)args r   Z/var/www/Befach/backend/venv/lib/python3.10/site-packages/huggingface_hub/commands/repo.py<lambda>`   s    z2RepoCommands.register_subcommand.<locals>.<lambda>)func)
add_parseradd_subparsersadd_argumentstrr   set_defaults)r   repo_parserrepo_subparsersrepo_create_parserr   r   r   register_subcommand)   sl   z RepoCommands.register_subcommandN)__name__
__module____qualname__staticmethodr   r#   r   r   r   r   r   (   s    r   c                   @   s$   e Zd ZdejfddZdd ZdS )r   r   c                 C   s   |j | _ |jp	|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j	| _	|jd ur3t
td | jd ur?t
td | jrIt
td t | _d S )NzcThe --type argument is deprecated and will be removed in a future version. Use --repo-type instead.zThe --organization argument is deprecated and will be removed in a future version. Pass the organization namespace directly in the repo_id.zfThe --yes argument is deprecated and will be removed in a future version. It does not have any effect.)r   	repo_typer   	space_sdkorganizationyesprivatetokenexist_okresource_group_idprintr   yellowr   _api)selfr   r   r   r   __init__d   s8   

zRepoCreateCommand.__init__c              	   C   s   t dd | jd ur$d| jv rttd td | j d| j | _| jj| j| j	| j
| j| j| j| jd}tdt|j d td	t|  d S )
Nzhuggingface-cli repozhf repo/zCYou cannot pass both --organization and a repo_id with a namespace.r	   )r   r(   r,   r-   r.   r/   r)   zSuccessfully created z on the Hub.zYour repo is now available at )r
   r*   r   r0   r   redexitr2   create_repor(   r,   r-   r.   r/   r)   bold)r3   repo_urlr   r   r   run   s"   


	zRepoCreateCommand.runN)r$   r%   r&   argparse	Namespacer4   r;   r   r   r   r   r   c   s     r   )__doc__r<   r   typingr   huggingface_hub.commandsr   #huggingface_hub.commands._cli_utilsr   huggingface_hub.constantsr   huggingface_hub.hf_apir   huggingface_hub.utilsr   
_cli_utilsr
   
get_loggerr$   loggerr   r   r   r   r   r   <module>   s   

;