
    -iF                        d Z ddlZddlZddlmZmZmZ ddlZddlm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ  e ee                    Z ee          Z ej        d	d
 eD             e          Z eee          ej!        dd"                    e           d ee                    f         Z# ed          Z$e$%                    d          	 	 	 	 	 	 	 d#dedededeee           ej!        d          f         dede#deddfd            Z&e$%                    d          	 	 	 d$dee ej'        d           f         d!ede#deddf
d"            Z(dS )%a  Contains commands to interact with spaces on the Hugging Face Hub.

Usage:
    # list spaces on the Hub
    hf spaces ls

    # list spaces with a search query
    hf spaces ls --search "chatbot"

    # get info about a space
    hf spaces info enzostvs/deepsite
    N)	AnnotatedOptionalget_args)RepositoryNotFoundErrorRevisionNotFoundError)ExpandSpaceProperty_TSpaceSort_T)ANSI   )
	AuthorOpt	FilterOptLimitOptRevisionOpt	SearchOptTokenOpt
get_hf_apimake_expand_properties_parserrepo_info_to_dicttyper_factorySpaceSortEnumc                     i | ]}||S  r   ).0ss     X/var/www/html/speakWrite/venv/lib/python3.11/site-packages/huggingface_hub/cli/spaces.py
<dictcomp>r   5   s    +H+H+HQAq+H+H+H    )typezMComma-separated properties to expand. Example: '--expand=likes,tags'. Valid: z, .)helpcallbackz Interact with spaces on the Hub.)r    ls
   searchauthorfiltersortzSort results.limitexpandtokenreturnc           	          t          |          }|r|j        nd}d |                    ||| |||          D             }	t          t	          j        |	d                     dS )zList spaces on the Hub.r*   Nc                 ,    g | ]}t          |          S r   )r   )r   
space_infos     r   
<listcomp>zspaces_ls.<locals>.<listcomp>T   s0        	*%%  r   )r&   r%   r$   r'   r(   r)      indent)r   valuelist_spacesprintjsondumps)
r$   r%   r&   r'   r(   r)   r*   apisort_keyresultss
             r   	spaces_lsr<   D   s     5
!
!
!C!+tzztH //&he\b * 
 
  G 
$*WQ
'
'
'(((((r   infospace_idz)The space ID (e.g. `username/repo-name`).revisionc           	         t          |          }	 |                    | ||          }n# t          $ r; t          dt	          j        |            d           t          j        d          t          $ r] t          dt	          j        t          |                     dt	          j        |            d	           t          j        d          w xY wt          t          j        t          |          d
                     dS )z"Get info about a space on the Hub.r-   )repo_idr?   r)   zSpace z not found.r   )codez	Revision z not found on r   r1   r2   N)r   r/   r   r6   r
   boldtyperExitr   strr7   r8   r   )r>   r?   r)   r*   r9   r=   s         r   spaces_inforG   ]   s    5
!
!
!C!~~h&~QQ" ! ! !7ty**777888ja      ! ! !X$)CMM22XX$)HBUBUXXXYYYja    ! 
$*&t,,Q
7
7
788888s
   + B*C)NNNNr#   NN)NNN))__doc__enumr7   typingr   r   r   rD   huggingface_hub.errorsr   r   huggingface_hub.hf_apir   r	   huggingface_hub.utilsr
   
_cli_utilsr   r   r   r   r   r   r   r   r   r   sorted_EXPAND_PROPERTIES_SORT_OPTIONSEnumrF   r   Optionjoin	ExpandOpt
spaces_clicommandr<   ArgumentrG   r   r   r   <module>rY      s      0 0 0 0 0 0 0 0 0 0  Q Q Q Q Q Q Q Q E E E E E E E E & & & & & &                        VHH%:;;<< %%	/+H+H-+H+H+HsSSS SMEL}]a]f]fgy]z]z}}}../ABB  	 ] BCCC
 D 	) ))) ) /***	,	) ) ) ) 
) ) ) )0 F !	9 9^U^1\]]]]^99 9 	9
 
9 9 9 9 9 9r   