
    wi                         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j        e          Z G d de          Z G 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                   *    e Zd Zedefd            ZdS )RepoCommandsparserc                    |                      dd          }|                    d          }|                     dd          }|                    dt          d	           |                    d
t          d	           |                    dt          dt                     |                    ddd           |                    dt          d	           |                    ddd           |                    dt          d	           |                    dt          d	           |                    dddd           |                    dt          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                      t          |           S )N)RepoCreateCommand)argss    u/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/huggingface_hub/commands/repo.py<lambda>z2RepoCommands.register_subcommand.<locals>.<lambda>`   s    :KD:Q:Q     )func)
add_parseradd_subparsersadd_argumentstrr   set_defaults)r   repo_parserrepo_subparsersrepo_create_parsers       r   register_subcommandz RepoCommands.register_subcommand)   s   ''5t'uu%44:a4bb,77Gl7mm'' [ 	( 	
 	
 	

 	''j 	( 	
 	
 	

 	''b$	 	( 	
 	
 	
 	''{ 	( 	
 	
 	

 	''_ 	( 	
 	
 	

 	''@ 	( 	
 	
 	

 	''! C 	( 	
 	
 	

 	''9 	( 	
 	
 	

 	''*	 	( 	
 	
 	
 	''3-t 	( 	
 	
 	
 	''-Q-Q'RRRRRr   N)__name__
__module____qualname__staticmethodr   r'    r   r   r   r   (   sA        6S$5 6S 6S 6S \6S 6S 6Sr   r   c                   *    e Zd Zdej        fdZd ZdS )r   r   c                    |j         | _         |j        p|j        | _        |j        | _        |j        | _        |j        | _        |j        | _        |j        | _        |j        | _        |j	        | _	        |j        !t          t          j        d                     | j        !t          t          j        d                     | j        r!t          t          j        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   s     r   __init__zRepoCreateCommand.__init__d   s     L(,(C$)(,+/+<!\$(J
"m040F9 y   
 ( b   
 8 	|    GG			r   c           	         t          dd           | j        Od| j        v r0t          t	          j        d                     t          d           | j         d| j         | _        | j                            | j        | j	        | j
        | j        | j        | j        | j                  }t          dt	          j        |j                   d           t          d	t	          j        |                      d S )
Nzhuggingface-cli repozhf repo/zCYou cannot pass both --organization and a repo_id with a namespace.r
   )r   r/   r3   r4   r5   r6   r0   zSuccessfully created z on the Hub.zYour repo is now available at )r   r1   r   r7   r   redexitr9   create_repor/   r3   r4   r5   r6   r0   bold)r:   repo_urls     r   runzRepoCreateCommand.run   s     !7CCC(dl""dhdeefffQ"/@@$,@@DL9((LnL*]"4n ) 
 
 	Odi0@&A&AOOOPPPDty/B/BDDEEEEEr   N)r(   r)   r*   argparse	Namespacer;   rC   r,   r   r   r   r   c   sG        X/    @F F F F Fr   r   )__doc__rD   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   <module>rP      s.     & & & & & &       > > > > > > 4 4 4 4 4 4 6 6 6 6 6 6 ( ( ( ( ( ( ) ) ) ) ) ) 0 0 0 0 0 0 
	H	%	%8S 8S 8S 8S 8S, 8S 8S 8Sv4F 4F 4F 4F 4F 4F 4F 4F 4F 4Fr   