
    5pj'                     6   S r SSKrSSKJrJr  SSKJrJr  SSKJ	r	J
r
JrJr  SSKJrJr  SSKJr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\R5                  S/ SQS9     SSS\\S-  \" SS94   S\\S-  \" SS94   S\\S-  \" SS94   S\	S\
SS4S jj5       r\R5                  SS/S9 STS\\\" SS94   S\
SS4S jj5       r\R5                  S / S!QS9     SUS"\\\" S#S94   S$\\S-  \" S%S94   S&\\S-  \" S'S94   S(\\\" S)S94   S*\\\" S+S94   S\
SS4S, jj5       r\R5                  S-/ S.QS9      SVS\\\" SS94   S"\\S-  \" S/S94   S&\\S-  \" S0S94   S1\\S-  \" S2S94   S(\\S-  \" S3S94   S4\\S-  \" S5S94   S\
SS4S6 jj5       r \R5                  S7S8S9/S9  SWS\\\" SS94   S:\\\" S;S94   S\
SS4S< jj5       r!\R5                  S=/ S>QS9   SXS\\\" SS94   S?\\\" S@S94   SA\\\" SBS94   SC\\S-  \" SDS94   S*\\\" SES94   S\
SS4SF jj5       r"\R5                  SGSHSI/S9   SYS\\\" SS94   SJ\\\" SKS94   SC\\S-  \" SLS94   S1\\S-  \" SMS94   S\
SS4SN jj5       r#\R5                  SO5        SWS\\\" SS94   SJ\\\" SPS94   S:\\\" SQS94   S\
SS4
SR jj5       r$gs  sn f s  snf )ZzGContains commands to interact with collections on the Hugging Face Hub.    N)	Annotatedget_args)CollectionItemType_TCollectionSort_T   )LimitOptTokenOpt
get_hf_apityper_factory)ArgumentOption)_dataclass_to_dict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	            [/var/www/html/pdf-tiff/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+   N   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.descriptionz6A description for the collection (max 150 characters).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/   r0   r1   r2   zCollection createdslugurlN)r
   create_collectionr   resultr5   r6   )r.   r/   r0   r1   r2   r   r    r"   s           r$   collections_creater9   ^   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 (max 150 characters).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.   r0   r;   r1   r<   zCollection updatedr4   N)r
   update_collection_metadatar   r8   r5   r6   )	r'   r.   r0   r;   r1   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   )rA   zCollection deletedr5   N)r
   delete_collectionr   r8   )r'   rA   r   r    s       r$   collections_deleterE      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'   rF   rG   rH   r2   zItem added to collectionr4   N)r
   add_collection_itemr   r   r8   r6   )r'   rF   rG   rH   r2   r   r    r"   s           r$   collections_add_itemrK      sK    4 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'   rL   rH   r;   zItem updated in collectionrC   N)r
   update_collection_itemr   r8   )r'   rL   rH   r;   r   r    s         r$   collections_update_itemrO      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'   rL   rA   zItem deleted from collectionrC   N)r
   delete_collection_itemr   r8   )r'   rL   rA   r   r    s        r$   collections_delete_itemrR     s;      5
!C'%  
 JJ-ODr,   )NNN
   N)N)NNFFN)NNNNNN)FN)NFN)NNN)%__doc__enumtypingr   r   huggingface_hub.hf_apir   r   
_cli_utilsr   r	   r
   r   
_frameworkr   r   _outputr   r   _COLLECTION_ITEM_TYPESEnumstrr   _COLLECTION_SORT_OPTIONSr   collections_clicommandr%   r+   boolr9   intr?   rE   rK   rO   rR   )tss   00r$   <module>re      s   N  & I E E ( , ""67 YY3DZ5[DZqdDZ5[bef #$45 +<T-U<Tqd<T-U\_`  %LM    	 	 	!d
?@	B
 d
~	
	 JK	M   !" 
#B 
9   sH2k$llm 
    	 	 	 	%OS((FGGHOd
cd	fO d
LM	OO 23	5O MN	PO$ %O& 
'OO@    	 	 	 	 	-"OsH2k$llm"Od
78	:"O d
RS	U"O d
MN	P"O t?@	B"O$ d
QR	T%"O, -"O. 
/"O"OJ 6C   	;sH2k$llm;LM	O; ; 
;;   $ 	 	UsH2k$llmUsH*oppqU _`	bU d
HI	KU UV	XU U  
!UU: `W    	 	CsH2k$llmClm	oC d
CD	FC d
EF	HC C 
CC6 ' 	EsH2k$llmE B	
	E FG	IE E 
E (Ei 6\ .Vs   L
7L
