
    Y j*                     r   S r SSKrSSKJrJr  SSKrSSKJrJr  SSK	J
r
JrJrJrJr  SSKJr  \" \5      r\R$                  " S\ V s0 s H  o U _M     sn \S	9r\" \5      r\R$                  " S
\ Vs0 s H  oU_M     sn\S	9r\" SS9r\R1                  S/ SQS9     SRS\\S-  \R2                  " SS94   S\\S-  \R2                  " SS94   S\\S-  \R2                  " SS94   S\
S\SS4S jj5       r\R1                  SS/S9 SSS\\\R6                  " SS94   S\SS4S jj5       r\R1                  S/ S QS9     STS!\\\R6                  " S"S94   S#\\S-  \R2                  " S$S94   S%\\S-  \R2                  " S&S94   S'\\\R2                  " S(S94   S)\\\R2                  " S*S94   S\SS4S+ jj5       r\R1                  S,/ S-QS9      SUS\\\R6                  " SS94   S!\\S-  \R2                  " S.S94   S%\\S-  \R2                  " S/S94   S0\\S-  \R2                  " S1S94   S'\\S-  \R2                  " S2S94   S3\\S-  \R2                  " S4S94   S\SS4S5 jj5       r \R1                  S6S7S8/S9  SVS\\\R6                  " SS94   S9\\\R2                  " S:S94   S\SS4S; jj5       r!\R1                  S</ S=QS9   SWS\\\R6                  " SS94   S>\\\R6                  " S?S94   S@\\\R6                  " SAS94   SB\\S-  \R2                  " SCS94   S)\\\R2                  " SDS94   S\SS4SE jj5       r"\R1                  SFSGSH/S9   SXS\\\R6                  " SS94   SI\\\R6                  " SJS94   SB\\S-  \R2                  " SKS94   S0\\S-  \R2                  " SLS94   S\SS4SM jj5       r#\R1                  SN5        SVS\\\R6                  " SS94   SI\\\R6                  " SOS94   S9\\\R2                  " SPS94   S\SS4
SQ jj5       r$gs  sn f s  snf )Ya_  Contains commands to interact with collections on the Hugging Face Hub.

Usage:
    # list collections on the Hub
    hf collections ls

    # list collections for a specific user
    hf collections ls --owner username

    # get info about a collection
    hf collections info username/collection-slug

    # create a new collection
    hf collections create "My Collection" --description "A collection of models"

    # add an item to a collection
    hf collections add-item username/collection-slug username/model-name model

    # delete a collection
    hf collections delete username/collection-slug
    N)	Annotatedget_args)CollectionItemType_TCollectionSort_T   )LimitOptTokenOptapi_object_to_dict
get_hf_apityper_factory)outCollectionItemType)typeCollectionSortz%Interact with collections on the Hub.)helpz	list | ls)zhf collections lsz hf collections ls --owner nvidiazLhf collections ls --item models/teknium/OpenHermes-2.5-Mistral-7B --limit 10)examplesownerz)Filter by owner username or organization.itemzkFilter collections containing a specific item (e.g., "models/gpt2", "datasets/squad", "papers/2311.12983").sortz4Sort results by last modified, trending, or upvotes.limittokenreturnc                     [        US9nU(       a  UR                  OSnUR                  U UUUS9 Vs/ s H  n[        U5      PM     nn[        R
                  " U5        gs  snf )zList collections on the Hub.r   N)r   r   r   r   )r   valuelist_collectionsr
   r   table)	r   r   r   r   r   apisort_key
collectionresultss	            p/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/collections.pycollections_lsr#   :   su    6 5
!C!tzztH ..	 / 

J 	:&
   IIgs   A!infoz/hf collections info username/my-collection-slugcollection_slugz7The collection slug (e.g., 'username/collection-slug').c                 d    [        US9nUR                  U 5      n[        R                  " U5        g)z'Get info about a collection on the Hub.r   N)r   get_collectionr   dict)r%   r   r   r    s       r"   collections_infor)   c   s*     5
!C##O4JHHZ    create)z!hf collections create "My Models"z^hf collections create "My Models" --description "A collection of my favorite models" --privatez9hf collections create "Org Collection" --namespace my-orgtitlezThe title of the collection.	namespacezMThe namespace (username or organization). Defaults to the authenticated user.descriptionz!A description for the collection.privatezCreate a private collection.	exists_okz7Do not raise an error if the collection already exists.c                     [        US9nUR                  U UUUUS9n[        R                  " SUR                  UR
                  S9  g)z#Create a new collection on the Hub.r   )r,   r-   r.   r/   r0   zCollection createdslugurlN)r   create_collectionr   resultr3   r4   )r,   r-   r.   r/   r0   r   r   r    s           r"   collections_creater7   s   sM    : 5
!C&& ' J JJ#*//z~~Nr*   update)z@hf collections update username/my-collection --title "New Title"zPhf collections update username/my-collection --description "Updated description"zDhf collections update username/my-collection --private --theme greenz!The new title for the collection.z'The new description for the collection.positionz7The new position of the collection in the owner's list.z)Whether the collection should be private.themez;The theme color for the collection (e.g., 'green', 'blue').c           	          [        US9nUR                  U UUUUUS9n[        R                  " SUR                  UR
                  S9  g)z*Update a collection's metadata on the Hub.r   )r%   r,   r.   r9   r/   r:   zCollection updatedr2   N)r   update_collection_metadatar   r6   r3   r4   )	r%   r,   r.   r9   r/   r:   r   r   r    s	            r"   collections_updater=      sQ    B 5
!C//' 0 J JJ#*//z~~Nr*   deletez,hf collections delete username/my-collectionz9hf collections delete username/my-collection --missing-ok
missing_okz6Do not raise an error if the collection doesn't exist.c                 ^    [        US9nUR                  XS9  [        R                  " SU S9  g)z!Delete a collection from the Hub.r   )r?   zCollection deletedr3   N)r   delete_collectionr   r6   )r%   r?   r   r   s       r"   collections_deleterC      s.      5
!C/AJJ#/:r*   zadd-item)zGhf collections add-item username/my-collection moonshotai/kimi-k2 modelz`hf collections add-item username/my-collection Qwen/DeepPlanning dataset --note "Useful dataset"zGhf collections add-item username/my-collection Tongyi-MAI/Z-Image spaceitem_idzCThe ID of the item to add (repo_id for repos, paper ID for papers).	item_typezGThe type of item (model, dataset, space, paper, collection, or bucket).notez2A note to attach to the item (max 500 characters).z?Do not raise an error if the item is already in the collection.c                     [        US9nUR                  U UUR                  UUS9n[        R                  " SXR
                  S9  g)zAdd an item to a collection.r   )r%   rD   rE   rF   r0   zItem added to collectionr2   N)r   add_collection_itemr   r   r6   r4   )r%   rD   rE   rF   r0   r   r   r    s           r"   collections_add_itemrI      sK    8 5
!C(('// ) J JJ)^^Tr*   zupdate-itemzVhf collections update-item username/my-collection ITEM_OBJECT_ID --note "Updated note"zMhf collections update-item username/my-collection ITEM_OBJECT_ID --position 0item_object_idzTThe ID of the item in the collection (from 'item_object_id' field, not the repo_id).z-A new note for the item (max 500 characters).z/The new position of the item in the collection.c                 d    [        US9nUR                  U UUUS9  [        R                  " SU S9  g)zUpdate an item in a collection.r   )r%   rJ   rF   r9   zItem updated in collectionrA   N)r   update_collection_itemr   r6   )r%   rJ   rF   r9   r   r   s         r"   collections_update_itemrM     s>    0 5
!C'%	   JJ+/Br*   zdelete-itemznThe ID of the item in the collection (retrieved from `item_object_id` field returned by 'hf collections info'.z0Do not raise an error if the item doesn't exist.c                 b    [        US9nUR                  U UUS9  [        R                  " SU S9  g)z!Delete an item from a collection.r   )r%   rJ   r?   zItem deleted from collectionrA   N)r   delete_collection_itemr   r6   )r%   rJ   r?   r   r   s        r"   collections_delete_itemrP   &  s;      5
!C'%  
 JJ-ODr*   )NNN
   N)N)NNFFN)NNNNNN)FN)NFN)NNN)%__doc__enumtypingr   r   typerhuggingface_hub.hf_apir   r   
_cli_utilsr   r	   r
   r   r   _outputr   _COLLECTION_ITEM_TYPESEnumstrr   _COLLECTION_SORT_OPTIONSr   collections_clicommandOptionr#   Argumentr)   boolr7   intr=   rC   rI   rM   rP   )tss   00r"   <module>re      sn  ,  &  I Y Y  ""67 YY3DZ5[DZqdDZ5[bef #$45 +<T-U<Tqd<T-U\_`  %LM    	 	 	!d
EF	H
 d
~	
	 PQ	S   !" 
#B 
9   sENN8q$rrs 
    	 	 	 	%OS%...LMMNOd
ij	lO d
=>	@O 89	;O ST	VO$ %O& 
'OO@    	 	 	 	 	-"OsENN8q$rrs"Od
=>	@"O d
CD	F"O d
ST	V"O tEF	H"O$ d
WX	Z%"O, -"O. 
/"O"OJ 6C   	;sENN8q$rrs;RS	U; ; 
;;   ( 	 	#UsENN8q$rrsUU^^!fggU
 ef	hU d
NO	QU [\	^U" #U$ 
%UU> `W    	 	CsENN8q$rrsCrs	uC d
IJ	LC d
KL	NC C 
CC6 ' 	EsENN8q$rrsE B	
	E LM	OE E 
E (Em 6\ .Vs   P/
3P4
