
    Ցi&                     :   S r SSKrSSKrSSKJr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JrJrJrJr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\R?                  S/ SQS9\R@                  SS4S\S\S\SS4S jj5       r!\R?                  SS/S9 SGS\\\RD                  " SS94   S\SS4S jj5       r#\R?                  S/ SQS9     SHS \\\   \RH                  " S!S"S94   S#\\\   \RH                  " S$S94   S%\\\   \RH                  " S&S'S94   S(\\\\      \RH                  " S)S*S94   S+\\\   \RH                  " S,S94   S\SS4S- jj5       r%\R?                  S./ S/QS9     SHS\\\RD                  " S0S94   S#\\\   \RH                  " S1S94   S \\\\      \RH                  " S!S2S94   S(\\\\      \RH                  " S)S3S94   S+\\\   \RH                  " S4S94   S\SS4S5 jj5       r&\R?                  S6S7/S9 SGS\\\RD                  " S8S94   S\SS4S9 jj5       r'\R?                  S:S;/S9 SGS\\\RD                  " S<S94   S\SS4S= jj5       r(\R?                  S>S?S@/S9  SIS\\\RD                  " SAS94   SB\\)\RH                  " SCSDSES94   S\SS4SF jj5       r*gs  sn f s  snf )Ja  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Optionalget_argsget_type_hints)WEBHOOK_DOMAIN_T)WebhookWatchedItem   )	FormatOptOutputFormatQuietOptTokenOptapi_object_to_dict
get_hf_apiprint_list_outputtyper_factory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: , .r	   zInvalid type ')r   name)tuple_WATCHED_TYPEStyperBadParameterjoinsplitappendr   )r   itemsvalid_typesvkindr   s         \/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/huggingface_hub/cli/webhooks.py_parse_watchr(   E   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 -q)examplesFformatquiettokenc                     [        US9nUR                  5        Vs/ s H  n[        U5      PM     nn[        UU U/ SQS S9  gs  snf )z'List all webhooks for the current user.r.   )idurldisableddomainswatchedc           
      <   U R                  SS5      U R                  S5      =(       d    S[        U R                  SS5      5      SR                  U R                  S5      =(       d    / 5      SR                  S	 U R                  S
5      =(       d    /  5       5      /$ )Nr1    r2   z(job)r3   Fr   r4   c              3   |   #    U  H2  n[        U[        5      (       a  US     SUS    3O
[        U5      v   M4     g7f)r   r   r   N)
isinstancedictstr).0ws     r'   	<genexpr>0webhooks_ls.<locals>.<lambda>.<locals>.<genexpr>~   s=      XqRSjD.A.A1V9+Qqyk*s1vMXqs   :<r5   )getr;   r    )items    r'   <lambda>webhooks_ls.<locals>.<lambda>y   s    HHT2HHUO&wU+,IIdhhy)/R0II X\X`X`ajXkXqoqXq 
r)   )r,   r-   headersrow_fnN)r   list_webhooksr   r   )r,   r-   r.   apir=   resultss         r'   webhooks_lsrI   d   sR     5
!C.1.?.?.AB.A!!$.AGB?
 Cs   Ainfozhf webhooks info abc123
webhook_idzThe ID of the webhook.c                     [        US9nUR                  U 5      n[        [        R                  " [        U5      SS95        g)z/Show full details for a single webhook as JSON.r0      indentN)r   get_webhookprintjsondumpsr   rK   r.   rG   webhooks       r'   webhooks_inforV      s5     5
!Cooj)G	$**'0
;<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.r2   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                    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
[        SU
R                   35        [        [        R                  " [        U
5      SS95        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.r0   )r2   rY   r5   r4   r[   zWebhook created: rM   rN   )r   r   r   r(   valuecreate_webhookrQ   r1   rR   rS   r   )rX   r2   rY   rZ   r[   r.   rG   watched_itemsdr4   rU   s              r'   webhooks_createra      s    X 6-  !NOO
{v~  !DEE
5
!C 'M+1'1ww'tG  Shn oG	gjj\
*+	$**'0
;< (s   C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                 2   [        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
[	        SU
R
                   35        [	        [        R                  " [        U
5      SS95        gs  snf )z>Update an existing webhook. Only provided options are changed.r0   N)r2   r5   r4   r[   zWebhook updated: rM   rN   )	r   r(   r]   update_webhookrQ   r1   rR   rS   r   )rK   r2   rX   rZ   r[   r.   rG   r_   r`   r4   rU   s              r'   webhooks_updatere      s    L 5
!C+0L'dM+1'1ww'tG  mek lG	gjj\
*+	$**'0
;< (s   Benablezhf webhooks enable abc123z The ID of the webhook to enable.c                 h    [        US9nUR                  U 5      n[        SUR                   35        g)zEnable a disabled webhook.r0   zWebhook enabled: N)r   enable_webhookrQ   r1   rT   s       r'   webhooks_enableri      s2     5
!C  ,G	gjj\
*+r)   disablezhf webhooks disable abc123z!The ID of the webhook to disable.c                 h    [        US9nUR                  U 5      n[        SUR                   35        g)zDisable an active webhook.r0   zWebhook disabled: N)r   disable_webhookrQ   r1   rT   s       r'   webhooks_disablerm     s2     5
!C!!*-G	wzzl
+,r)   deletezhf webhooks delete abc123zhf webhooks delete abc123 --yesz The ID of the webhook to delete.yesz--yesz-yzSkip confirmation prompt.c                     U(       dA  [         R                  " SU  S35      nU(       d   [        S5        [         R                  " 5       e[	        US9nUR                  U 5        [        SU  35        g)zDelete a webhook permanently.z)Are you sure you want to delete webhook 'z'?zAborted.r0   zWebhook deleted: N)r   confirmrQ   Abortr   delete_webhook)rK   ro   r.   rq   rG   s        r'   webhooks_deletert     s_    ( --"KJ<WY Z[*++-
5
!Cz"	j\
*+r)   )N)NNNNN)FN)+__doc__enumrR   typingr   r   r   r   r   huggingface_hub.constantsr   huggingface_hub.hf_apir   
_cli_utilsr
   r   r   r   r   r   r   r   r   Enumr;   r   _DOMAIN_TYPESr   listr(   webhooks_clicommandtablerI   ArgumentrV   Optionra   re   ri   rm   boolrt   )tr`   s   00r'   <module>r      sM  4   @ @  6 5	 	 	 .);<VDE))-n/Mn1n/MTWX)*		/-+H-QqD-+HsSc t,>'? 8 "?@    %**  
	2 
!   =#u~~3KLLM== 
==   & 	 	 	 	=-=S	e	
	-= 
^_	a
-= p	
	-=& m$%a	
	'-=4 JK	M5-=< =-=> 
?-=-=`    	 	 	 	7#=#u~~3UVVW#=	@A	C
#= cI	
		#=  m$%U	
	!#=. EF	H/#=6 7#=8 
9#=#=L #   ,#u~~3UVVW,, 
,, $   -#u~~3VWWX-- 
-- #)    	,#u~~3UVVW,	,	
	
, , 
,,G 0N ,Is   L
L
