
    ai                        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	eD  ci c]  } | |  c} e
      Z eee    ejB                  ddjE                  e       d ee            f   Z# ed      Z$e$jK                  d      	 	 	 	 	 	 	 d!dedededeee     ejB                  d      f   dede#deddfd       Z&e$jK                  d      	 	 	 d"dee ejN                  d      f   dede#deddf
d        Z(yc c} w )#a  Contains commands to interact with datasets on the Hugging Face Hub.

Usage:
    # list datasets on the Hub
    hf datasets ls

    # list datasets with a search query
    hf datasets ls --search "code"

    # get info about a dataset
    hf datasets info HuggingFaceFW/fineweb
    N)	AnnotatedOptionalget_args)RepositoryNotFoundErrorRevisionNotFoundError)DatasetSort_TExpandDatasetProperty_T)ANSI   )
	AuthorOpt	FilterOptLimitOptRevisionOpt	SearchOptTokenOpt
get_hf_apimake_expand_properties_parserrepo_info_to_dicttyper_factoryDatasetSortEnum)typezWComma-separated properties to expand. Example: '--expand=downloads,likes,tags'. Valid: z, .)helpcallbackz"Interact with datasets on the Hub.)r   lssearchauthorfiltersortzSort results.limitexpandtokenreturnc                     t        |      }|r|j                  nd}|j                  ||| |||      D 	cg c]  }	t        |	       }
}	t	        t        j                  |
d             yc c}	w )zList datasets on the Hub.r"   N)r   r   r   r   r    r!      indent)r   valuelist_datasetsr   printjsondumps)r   r   r   r   r    r!   r"   apisort_keydataset_inforesultss              f/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/huggingface_hub/cli/datasets.pydatasets_lsr3   D   sw     5
!C!tzztH  --&he\b . 
 	,'G  
$**WQ
'(s   A+info
dataset_idz+The dataset ID (e.g. `username/repo-name`).revisionc           	         t        |      }	 |j                  | ||      }t        t        j                  t        |      d
             y# t        $ r9 t        dt	        j
                  |        d       t        j                  d      t        $ rX t        dt	        j
                  t        |             dt	        j
                  |        d	       t        j                  d      w xY w)z$Get info about a dataset on the Hub.r%   )repo_idr6   r!   zDataset z not found.r   )codez	Revision z not found on r   r&   r'   N)r   r0   r   r+   r
   boldtyperExitr   strr,   r-   r   )r5   r6   r!   r"   r.   r4   s         r2   datasets_infor>   ]   s     5
!C!
XfU 
$**&t,Q
78 # !:./{;<jja    !	$))CM23>$))JBWAXXYZ[jja  !s   A B!C-)NNNN
   NN)NNN))__doc__enumr,   typingr   r   r   r;   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Enumr=   r   Optionjoin	ExpandOptdatasets_clicommandr3   Argumentr>   )ss   0r2   <module>rR      s     0 0  Q I &   H%<=> '$))-m/L1/LSVW SMELLfgkgpgp  rD  hE  gF  FG  H./AB	 "FG d 	))) ) !/*	,	) ) ) ) 
) )0 f !	9#~u~~3`aab99 9 	9
 
9 9S 0Ms   .
E
