Ë
    ÂÓ^j^'  ã                   óø  — d Z ddlZddlmZmZ ddlmZmZ ddlm	Z	m
Z
mZmZ ddlmZmZ ddlmZmZ  ee«      Z ej(                  d	eD � ci c]  } | | “Œ c} e¬
«      Z ee«      Z ej(                  deD �ci c]  }||“Œ c}e¬
«      Z ed¬«      Zej5                  dg d¢¬«      	 	 	 	 	 dSdeedz   ed¬«      f   deedz   ed¬«      f   deedz   ed¬«      f   de	de
ddfd„«       Zej5                  ddg¬«      	 dTdee ed¬«      f   de
ddfd„«       Zej5                  d g d!¢¬«      	 	 	 	 	 dUd"ee ed#¬«      f   d$eedz   ed%¬«      f   d&eedz   ed'¬«      f   d(ee ed)¬«      f   d*ee ed+¬«      f   de
ddfd,„«       Zej5                  d-g d.¢¬«      	 	 	 	 	 	 dVdee ed¬«      f   d"eedz   ed/¬«      f   d&eedz   ed0¬«      f   d1eedz   ed2¬«      f   d(eedz   ed3¬«      f   d4eedz   ed5¬«      f   de
ddfd6„«       Z ej5                  d7d8d9g¬«      	 	 dWdee ed¬«      f   d:ee ed;¬«      f   de
ddfd<„«       Z!ej5                  d=g d>¢¬«      	 	 	 dXdee ed¬«      f   d?ee ed@¬«      f   dAee edB¬«      f   dCeedz   edD¬«      f   d*ee edE¬«      f   de
ddfdF„«       Z"ej5                  dGdHdIg¬«      	 	 	 dYdee ed¬«      f   dJee edK¬«      f   dCeedz   edL¬«      f   d1eedz   edM¬«      f   de
ddfdN„«       Z#ej5                  dO«      	 	 dWdee ed¬«      f   dJee edP¬«      f   d:ee edQ¬«      f   de
ddf
dR„«       Z$yc c} w c c}w )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                 óÆ   — t        |¬«      }|r|j                  nd}|j                  | |||¬«      D �cg c]  }t        |«      ‘Œ }}t	        j
                  |«       yc c}w )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	            új/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/huggingface_hub/cli/collections.pyÚcollections_lsr%   %   sn   € ô6 ˜5Ô
!€CÙ!ˆt�zŠz t€Hð ×.Ñ.ØØØØð	 /ó 
öàô 	˜:Õ&ð€Gð ô ‡I�IˆgÕùòs   ´AÚinfoz/hf collections info username/my-collection-slugÚcollection_slugz7The collection slug (e.g., 'username/collection-slug').c                 óh   — t        |¬«      }|j                  | «      }t        j                  |«       y)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Ó4€JÜ‡H�HˆZÕó    Ú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                 ó    — t        |¬«      }|j                  | ||||¬«      }t        j                  d|j                  |j
                  ¬«       y)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ô ‡J�JÐ#¨*¯/©/¸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                 ó¢   — t        |¬«      }|j                  | |||||¬«      }t        j                  d|j                  |j
                  ¬«       y)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ô ‡J�JÐ#¨*¯/©/¸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                 óp   — t        |¬«      }|j                  | |¬«       t        j                  d| ¬«       y)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   ³   s0   € ô  ˜5Ô
!€CØ×Ñ˜/°jÐÔAÜ‡J�JÐ#¨/Ö: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                 ó    — t        |¬«      }|j                  | ||j                  ||¬«      }t        j                  d| |j
                  ¬«       y)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   È   sM   € ô4 ˜5Ô
!€CØ×(Ñ(Ø'ØØ—/‘/ØØð )ó €Jô ‡J�JÐ)°ÀZÇ^Á^Ö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                 ót   — t        |¬«      }|j                  | |||¬«       t        j                  d| ¬«       y)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Ø×ÑØ'Ø%ØØð	 ô ô ‡J�JÐ+°/Ö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                 ór   — t        |¬«      }|j                  | ||¬«       t        j                  d| ¬«       y)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Ø×ÑØ'Ø%Øð ô ô
 ‡J�JÐ-°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Ð Ø�T—Y‘YÐ3ÐDZÖ5[¸q°a¸±dÒ5[ÐbeÔfÐ á#Ð$4Ó5Ð Ø�—‘Ð+Ð<TÖ-U°q¨a°©dÒ-UÐ\_Ô`€ñ  Ð%LÔM€ð ×ÑØòð ó ð 	ð 	ð 	ØØñ!ØØˆd‰
ÙÐ?Ô@ð	Bñðð
 Øˆd‰
ÙØ~ô	
ð	ñðð Ø˜ÑÙÐJÔKð	Mñðð ðð  ð!ð" 
ò#óððB ×ÑØ
à9ðð ó ð ñØ˜s¡HÐ2kÔ$lÐlÑmðàðð 
òóðð ×ÑØòð ó ð 	ð 	ð 	ð 	Øñ%OØ�S™(Ð(FÔGÐGÑHðOàØˆd‰
ÙÐcÔdð	fñðOð Øˆd‰
ÙÐ7Ô8ð	:ñðOð ØÙÐ2Ô3ð	5ñðOð ØÙÐMÔNð	PñðOð$ ð%Oð& 
ò'OóðOð@ ×ÑØòð ó ð 	ð 	ð 	ð 	ð 	Øñ-"OØ˜s¡HÐ2kÔ$lÐlÑmð"OàØˆd‰
ÙÐ7Ô8ð	:ñð"Oð Øˆd‰
ÙÐ=Ô>ð	@ñð"Oð Øˆd‰
ÙÐMÔNð	Pñð"Oð Øˆt‰ÙÐ?Ô@ð	Bñð"Oð$ Øˆd‰
ÙÐQÔRð	Tñð%"Oð, ð-"Oð. 
ò/"Oóð"OðJ ×ÑØà6ØCðð ó ð 	Øñ;Ø˜s¡HÐ2kÔ$lÐlÑmð;àØÙÐLÔMð	Oñð;ð ð;ð 
ò;óð;ð ×ÑØòð ó ð$ 	ð 	ØñUØ˜s¡HÐ2kÔ$lÐlÑmðUà�s™HÐ*oÔpÐpÑqðUð ØÙÐ_Ô`ð	bñðUð Øˆd‰
ÙÐHÔIð	KñðUð ØÙÐUÔVð	XñðUð ðUð  
ò!UóðUð: ×ÑØà`ØWðð ó ð  	ð 	ØñCØ˜s¡HÐ2kÔ$lÐlÑmðCàØÙÐlÔmð	oñðCð Øˆd‰
ÙÐCÔDð	FñðCð Øˆd‰
ÙÐEÔFð	HñðCð ðCð 
òCóðCð6 ×Ñ˜Ó'ð 	ØñEØ˜s¡HÐ2kÔ$lÐlÑmðEàØÙð Bô	
ð	ñðEð ØÙÐFÔGð	IñðEð ðEð 
òEó (ñEùòi 6\ùò .Vs   Á
M2
Á8
M7
