
    Y j4$                        S r SSKrSSKJrJrJr  SSKrSSKJr  SSK	J
r
  SSKJrJrJr  SSKJr  \" \" \
5      S	   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\\
   4S jr\" SS9r\R5                  S/ SQS9 SES\SS4S jj5       r\R5                  SS/S9 SES\\\R8                  " SS94   S\SS4S jj5       r\R5                  S/ SQS9     SFS\\\   \R<                  " SS S94   S!\\S-  \R<                  " S"S94   S#\\S-  \R<                  " S$S%S94   S&\\\   S-  \R<                  " S'S(S94   S)\\S-  \R<                  " S*S94   S\SS4S+ jj5       r\R5                  S,/ S-QS9     SFS\\\R8                  " S.S94   S!\\S-  \R<                  " S/S94   S\\\   S-  \R<                  " SS0S94   S&\\\   S-  \R<                  " S'S1S94   S)\\S-  \R<                  " S2S94   S\SS4S3 jj5       r \R5                  S4S5/S9 SES\\\R8                  " S6S94   S\SS4S7 jj5       r!\R5                  S8S9/S9 SES\\\R8                  " S:S94   S\SS4S; jj5       r"\R5                  S<S=S>/S9  SGS\\\R8                  " S?S94   S@\\#\R<                  " SASBSCS94   S\SS4SD jj5       r$gs  sn f s  snf )Ha  Contains commands to manage webhooks on the Hugging Face Hub.

Usage:
    # list all webhooks
    hf webhooks ls

    # show details of a single webhook
    hf webhooks info <webhook_id>

    # create a new webhook
    hf webhooks create --url https://example.com/hook --watch model:bert-base-uncased

    # create a webhook watching multiple items and domains
    hf webhooks create --url https://example.com/hook --watch org:HuggingFace --watch model:gpt2 --domain repo

    # update a webhook
    hf webhooks update <webhook_id> --url https://new-url.com/hook

    # enable / disable a webhook
    hf webhooks enable <webhook_id>
    hf webhooks disable <webhook_id>

    # delete a webhook
    hf webhooks delete <webhook_id>
    N)	Annotatedget_argsget_type_hints)WEBHOOK_DOMAIN_T)WebhookWatchedItem   )TokenOpt
get_hf_apityper_factory)outtypeWatchedItemType)r   WebhookDomainvaluesreturnc           	      X   / n[        [        5      nU  H  nSU;  a,  [        R                  " SU SSR	                  U5       S35      eUR                  SS5      u  pEXB;  a,  [        R                  " SU SSR	                  U5       S35      eUR                  [        XES95        M     U$ )	a9  Parse 'type:name' strings into WebhookWatchedItem objects.

Args:
    values: List of strings in the format 'type:name'
        (e.g., 'model:bert-base-uncased', 'org:HuggingFace').

Returns:
    List of WebhookWatchedItem objects.

Raises:
    typer.BadParameter: If any value doesn't match the expected format.
:zCExpected format 'type:name' (e.g. 'model:bert-base-uncased'), got 'z'. Valid types: z, .r   zInvalid type ')r   name)tuple_WATCHED_TYPEStyperBadParameterjoinsplitappendr   )r   itemsvalid_typesvkindr   s         m/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/webhooks.py_parse_watchr"   @   s     E'Ka<$$UVWUX Y!!%;!7 8;  WWS!_
"$$~dV;KDIIVaLbKccd%eff'T=>  L    zManage webhooks on the Hub.)helpz	list | ls)zhf webhooks lszhf webhooks ls --format jsonzhf webhooks ls --format quiet)examplestokenc                    [        U S9nUR                  5        VVs/ s H  nUR                  UR                  =(       d    SUR                  UR
                  =(       d    / UR                  =(       d    /  Vs/ s H  o3R                   SUR                   3PM     snS.PM     nnn[        R                  " U5        gs  snf s  snnf )z'List all webhooks for the current user.r&   z(job)r   )idurldisableddomainswatchedN)r
   list_webhooksr)   r*   r+   r,   r-   r   r   r   table)r&   apiwwiresultss        r!   webhooks_lsr4   _   s     5
!C ""$	 %A $$55#G

yyB:;))/r/K/277)1RWWI./K	
 %  	 IIg	 L	s   AC8$B?	C?Cinfozhf webhooks info abc123
webhook_idzThe ID of the webhook.c                 d    [        US9nUR                  U 5      n[        R                  " U5        g)z'Show full details for a single webhook.r(   N)r
   get_webhookr   dictr6   r&   r0   webhooks       r!   webhooks_infor<   y   s(     5
!Cooj)GHHWr#   create)zQhf webhooks create --url https://example.com/hook --watch model:bert-base-uncasedzjhf webhooks create --url https://example.com/hook --watch org:HuggingFace --watch model:gpt2 --domain repozJhf webhooks create --job-id 687f911eaea852de79c4a50a --watch user:julien-cwatchz--watchzRItem to watch, in 'type:name' format (e.g. 'model:bert-base-uncased'). Repeatable.r*   zBURL to send webhook payloads to. Mutually exclusive with --job-id.job_idz--job-idz]ID of a Job to trigger (from job.id) instead of pinging a URL. Mutually exclusive with --url.domainz--domainzNDomain to watch: 'repo' or 'discussions'. Repeatable. Defaults to all domains.secretz.Optional secret used to sign webhook payloads.c                 P   Ub  Ub  [         R                  " S5      eUc  Uc  [         R                  " S5      e[        US9n[        U 5      nU(       a  U Vs/ s H  oR                  PM     snOSn	UR                  XXyUS9n
[        R                  " SU
R                  S9  gs  snf )ztCreate a new webhook.

Provide either --url (to ping a remote server) or --job-id (to trigger a Job), but not both.
Nz+Provide either --url or --job-id, not both.z!Provide either --url or --job-id.r(   )r*   r?   r-   r,   rA   zWebhook createdr)   )	r   r   r
   r"   valuecreate_webhookr   resultr)   )r>   r*   r?   r@   rA   r&   r0   watched_itemsdr,   r;   s              r!   webhooks_createrI      s    X 6-  !NOO
{v~  !DEE
5
!C 'M+1'1ww'tG  Shn oGJJ WZZ0 (s   B#update)z8hf webhooks update abc123 --url https://new-url.com/hookz:hf webhooks update abc123 --watch model:gpt2 --domain repoz,hf webhooks update abc123 --secret newsecretz The ID of the webhook to update.z$New URL to send webhook payloads to.ziNew list of items to watch, in 'type:name' format. Repeatable. Replaces the entire existing watched list.zBNew list of domains to watch: 'repo' or 'discussions'. Repeatable.z)New secret used to sign webhook payloads.c                     [        US9nU(       a  [        U5      OSnU(       a  U Vs/ s H  oR                  PM     snOSn	UR                  XXyUS9n
[        R
                  " SU
R                  S9  gs  snf )z>Update an existing webhook. Only provided options are changed.r(   N)r*   r-   r,   rA   zWebhook updatedrC   )r
   r"   rD   update_webhookr   rF   r)   )r6   r*   r>   r@   rA   r&   r0   rG   rH   r,   r;   s              r!   webhooks_updaterM      sg    L 5
!C+0L'dM+1'1ww'tG  mek lGJJ WZZ0 (s   A4enablezhf webhooks enable abc123z The ID of the webhook to enable.c                 v    [        US9nUR                  U 5      n[        R                  " SUR                  S9  g)zEnable a disabled webhook.r(   zWebhook enabledrC   N)r
   enable_webhookr   rF   r)   r:   s       r!   webhooks_enablerQ      s1     5
!C  ,GJJ WZZ0r#   disablezhf webhooks disable abc123z!The ID of the webhook to disable.c                 v    [        US9nUR                  U 5      n[        R                  " SUR                  S9  g)zDisable an active webhook.r(   zWebhook disabledrC   N)r
   disable_webhookr   rF   r)   r:   s       r!   webhooks_disablerU      s1     5
!C!!*-GJJ!gjj1r#   deletezhf webhooks delete abc123zhf webhooks delete abc123 --yesz The ID of the webhook to delete.yesz--yesz-yzSkip confirmation prompt.c                     [         R                  " SU  S3US9  [        US9nUR                  U 5        [         R                  " SU S9  g)zDelete a webhook permanently.z)Are you sure you want to delete webhook 'z'?)rW   r(   zWebhook deletedrC   N)r   confirmr
   delete_webhookrF   )r6   rW   r&   r0   s       r!   webhooks_deleter[     sD    ( KK;J<rJPST
5
!Cz"JJ Z0r#   )N)NNNNN)FN)%__doc__enumtypingr   r   r   r   huggingface_hub.constantsr   huggingface_hub.hf_apir   
_cli_utilsr	   r
   r   _outputr   r   Enumstrr   _DOMAIN_TYPESr   listr"   webhooks_clicommandr4   Argumentr<   OptionrI   rM   rQ   rU   boolr[   )trH   s   00r!   <module>rm      s*  4  6 6  6 5 
  .);<VDE))-n/Mn1n/MTWX)*		/-+H-QqD-+HsSc t,>'? 8 "?@    	$ 
!   #u~~3KLLM 
   & 	 	 	 	=,1S	e	
	,1 
d
^_	a
,1 d
p	
	,1& ]d"a	
	',14 d
JK	M5,1< =,1> 
?,1,1^    	 	 	 	7"1#u~~3UVVW"1	d
@A	C
"1 S	DI	
		"1  ]d"U	
	!"1. d
EF	H/"16 7"18 
9"1"1J #   1#u~~3UVVW11 
11 $   2#u~~3VWWX22 
22 #)    	1#u~~3UVVW1	,	
	
1 1 
11u 0N ,Is   K9
>K>
