
    ՑiA                     <	   S r SSKrSSKrSSKrSSKJr  SSKJrJr  SSK	r	SSK
Jr  SSKJr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JrJrJrJrJrJr   " S
 S\ \RB                  5      r" " S S\ \RB                  5      r# " S S\ \RB                  5      r$SS1r%\\&\	RN                  " SSS94   r(S\ S\ 4S jr)S\\    S\\   S\\    4S jr*SpS\S\+SS4S jjr,\" SS9r-\-R]                  S / S!QS"9\"R^                  \#R`                  SS#\Rb                  \Rd                  SS4S$\S\\"\	Rf                  " S%S&S'S94   S(\\#\	Rf                  " S)S*S+S94   S,\S-\S.\S/\S0\S1\SS4S2 jj5       r4\-R]                  S3/ S4QS"9SSS\Rb                  \$Rj                  S4S$\S5\(S6\\+\	Rf                  " S7S8S94   S9\\+\	Rf                  " S:S;S94   S<\\+\	Rf                  " S=S>S94   S.\S/\\$\	Rf                  " S?S94   S1\SS4S@ jj5       r6\-R]                  SA/ SBQS"9SSS\Rb                  S4S$\SC\\ \	Rf                  " SDSES94   S\\\    \	Rf                  " SFSGS94   S\\\   \	Rf                  " SHSIS94   SJ\\+\	Rf                  " SKSLSMS94   S.\S1\SS4SN jj5       r7\-R]                  SOSPSQ/S"9SS\Rb                  S4S$\S5\(S\\\    \	Rf                  " SFSRS94   S\\\   \	Rf                  " SHSSS94   S.\S1\SS4ST jj5       r8\-R]                  SUSVSW/S"9SS\Rb                  S4S$\S5\(SO\\\    \	Rf                  " SXSYS94   SZ\\+\	Rf                  " S[S\S]S94   S.\S1\SS4S^ jj5       r9\-R]                  S_S`Sa/S"9SS\Rb                  S4S$\S5\(SO\\\    \	Rf                  " SXSbS94   SZ\\+\	Rf                  " S[S\S]S94   S.\S1\SS4Sc jj5       r:\-R]                  SdSe/S"9\Rb                  S4S$\S5\(Sf\\ \	RN                  " SgS94   S.\S1\SS4Sh jj5       r;\-R]                  SiSjSk/S"9SS\Rb                  S4S$\S5\(SO\\\    \	Rf                  " SXSlS94   SZ\\+\	Rf                  " S[S\S]S94   S.\S1\SS4Sm jj5       r<\-R]                  S9Sn/S"9\Rb                  S4S$\S5\(S.\S1\SS4
So jj5       r=g)qzYContains commands to interact with discussions and pull requests on the Hugging Face Hub.    N)Path)	AnnotatedOptional)	constants)DiscussionCommentDiscussionWithDetails)ANSI   )	AuthorOpt	FormatOptLimitOptOutputFormatQuietOpt	RepoIdArgRepoTypeRepoTypeOptTokenOpt_format_cellapi_object_to_dict
get_hf_apiprint_list_outputtyper_factoryc                   (    \ rS rSrSrSrSrSrSrSr	g)	DiscussionStatus.   openclosedmergeddraftall N)
__name__
__module____qualname____firstlineno__r   r   r   r   r    __static_attributes__r!       _/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/huggingface_hub/cli/discussions.pyr   r   .   s    DFFE
Cr'   r   c                        \ rS rSrSrSrSrSrg)DiscussionKind6   r    
discussionpull_requestr!   N)r"   r#   r$   r%   r    r,   r-   r&   r!   r'   r(   r*   r*   6   s    
CJ!Lr'   r*   c                        \ rS rSrSrSrSrSrg)
InfoFormat<   z#Output format for the info command.textjsonr!   N)r"   r#   r$   r%   __doc__r1   r2   r&   r!   r'   r(   r/   r/   <   s    -DDr'   r/   r   r   z&The discussion or pull request number.)helpminstatusreturnc                     U S:X  a  [         R                  " S5      $ U S:X  a  [         R                  " S5      $ U S:X  a  [         R                  " S5      $ U S:X  a  [         R                  " S5      $ U $ )Nr   r   r   r   )r	   greenredblueyellow)r6   s    r(   _format_statusr=   S   sc    zz&!!	8	xx!!	8	yy""	7	{{7##Mr'   body	body_filec                     U b  Ub  [         R                  " S5      eUb<  [        U5      S:X  a  [        R                  R                  5       $ UR                  SS9$ U $ )zFResolve body text from --body or --body-file (supports '-' for stdin).z'Cannot use both --body and --body-file.-zutf-8)encoding)typerBadParameterstrsysstdinread	read_text)r>   r?   s     r(   
_read_bodyrJ   _   s[    I1  !JKKy>S 99>>##""G"44Kr'   Fdetailsshow_commentsc           	         U R                   (       a  SOSn[        [        R                  " U R                  5       S[        R
                  " SU R                   35       35        [        U R                  5      U R                  U R                  R                  S5      /nU R                   (       aC  U R                  (       a2  UR                  S[        R                  " U R                  5       35        [        U SSR                  U5       35        U R                   (       a{  U R                  (       aj  U R                  S	L a   [        [        R                   " S
5      5        O;[        [        R                   " SSR                  U R                  5       35      5        S n/ nU R"                   HE  n[%        U[&        5      (       d  M  UR(                  (       a  M-  Uc  UnM4  UR                  U5        MG     U(       aL  UR*                  R-                  5       (       a-  [        5         [        UR*                  R-                  5       5        U(       a  U(       a  [        5         [        [        R
                  " S5      5        U Hw  n[        5         [        [        R                  " UR                  5       SUR                  R                  S5       35        [        UR*                  R-                  5       5        My     OPU(       aI  [        5         [        [        R
                  " [/        U5       S[/        U5      S:w  a  SOS S35      5        [        5         [        S[        R0                  " U R2                  5       35        g )NzPull Request
Discussion #z%Y-%m-%d %H:%Mzinto z: u    · TzHas conflicting fileszConflicting files: z,    ────────────────────────────────────────────────────────────z commentr
   s z (use --comments to show)View on Hub: )is_pull_requestprintr	   boldtitlegraynumr=   r6   author
created_atstrftimetarget_branchappendjoinconflicting_filesr<   events
isinstancer   hiddencontentstriplenr;   url)rK   rL   kindpartsr>   commentseventcomments           r(   _print_discussion_inforn   j   sc   $44>,D	TYYw}}%&a		Agkk]2C(D'E
FGGNN+W^^W=O=O=X=XYi=jkE7#8#8uTYYw'<'<=>?@	TF"V[['(
)*7#<#<$$,$++567$++ 3DIIg>W>W4X3YZ[\DHe.//|&   ""$$dll  "#dii
#$GGTYYw~~./tG4F4F4O4OP`4a3bcd'//'')*   
dii3x=/X!9K#QS1TTmnop	G	M$))GKK01
23r'   z0Manage discussions and pull requests on the Hub.)r4   z	list | ls)z%hf discussions list username/my-modelzIhf discussions list username/my-model --kind pull_request --status mergedzFhf discussions list username/my-dataset --type dataset --status closedzBhf discussions list username/my-model --author alice --format json)examples   repo_idz-sz--statusz4Filter by status (open, closed, merged, draft, all).ri   z-kz--kindz/Filter by kind (discussion, pull_request, all).r[   limit	repo_typeformatquiettokenc	           
         [        US9n	U[        R                  :X  a  Sn
OU[        R                  :X  a  Sn
OSn
U[        R
                  :X  a  SnOUR                  n/ nU	R                  U UUU
UR                  S9 HU  nUR                  [        ;   a  UR                  UR                  :w  a  M3  UR                  U5        [        U5      U:  d  MU    O   U Vs/ s H  n[        U5      PM     nn[        UUUS/ SQS SS	0S
9  gs  snf )z-List discussions and pull requests on a repo.rv   r   r   N)rq   r[   discussion_typediscussion_statusrs   rZ   )rZ   rX   rU   r6   r[   r\   c                 &   SU S    3[        U R                  SS5      SS9U R                  S5      (       a  SOS[        [        U R                  S	S5      5      5      [        U R                  S
S5      5      [        U R                  SS5      5      /$ )NrP   rZ   rX   rS   2   )max_lenrU   PRr6   r[   r\   )r   getr=   rE   )items    r(   <lambda>!discussion_list.<locals>.<lambda>   s|    U}'2.;HH.//DR3txx"5672&',34
r'   right)rt   ru   id_keyheadersrow_fn
alignments)r   r   r   r   r*   r    valueget_repo_discussions_CLIENT_SIDE_STATUSESr6   r_   rg   r   r   )rq   r6   ri   r[   rr   rs   rt   ru   rv   api
api_statusapi_discussion_typediscussionsditemss                  r(   discussion_listr      s   F 5
!C !&&&
	#**	*

 ~!!!""jjK%%+$// &  <<00QXX5M1{u$ -88Kq"KE8U
 7# 9s   Dinfo)z'hf discussions info username/my-model 5z2hf discussions info username/my-model 5 --commentsz.hf discussions info username/my-model 5 --diffz5hf discussions info username/my-model 5 --format jsonrZ   rk   z
--commentszShow all comments.diffz--diffz"Show the diff (for pull requests).no_colorz
--no-colorzDisable colored output.zOutput format (text or json).c                    SSK nU(       a  SUR                  S'   [        US9n	U	R                  U UUR                  S9n
U[
        R                  :X  aC  [        U
5      nU(       d  UR                  SS5        [        [        R                  " USS	95        g[        XS
9  U(       aQ  U
R                  (       a?  [        5         [        [        R                  " S5      5        [        U
R                  5        ggg)z,Get info about a discussion or pull request.r   N1NO_COLORrx   rq   discussion_numrs   r      )indent)rL   rQ   )osenvironr   get_discussion_detailsr   r/   r2   r   poprV   dumpsrn   r   r	   rY   )rq   rZ   rk   r   r   rs   rt   rv   r   r   rK   results               r(   discussion_infor      s    V !$

:
5
!C((// ) G  #G,JJvt$djj*+7;dii
#$gll tr'   create)z<hf discussions create username/my-model --title "Bug report"zWhf discussions create username/my-model --title "Feature request" --body "Please add X"zIhf discussions create username/my-model --title "Fix typo" --pull-requestzUhf discussions create username/my-dataset --type dataset --title "Data quality issue"rX   z--titlez,The title of the discussion or pull request.z--bodyz$The description (supports Markdown).z--body-filez4Read the description from a file. Use '-' for stdin.r-   z--pull-requestz--prz.Create a pull request instead of a discussion.c           
         [        X#5      n[        US9nUR                  U UUUR                  US9n	U(       a  SOSn
[	        SU
 S[
        R                  " SU	R                   35       S[
        R                  " U 5       35        U(       a/  [	        S	[
        R                  " S
U	R                   35       35        [	        S[
        R                  " U	R                  5       35        g)z2Create a new discussion or pull request on a repo.rx   )rq   rX   descriptionrs   r-   zpull requestr,   zCreated rO   rP   z on zPush changes to: zrefs/pr/rT   N)
rJ   r   create_discussionr   rV   r	   rW   rZ   r;   rh   )rq   rX   r>   r?   r-   rs   rv   r   r   r,   ri   s              r(   discussion_creater   3  s    X T-K
5
!C&&//! ' J *>|D	HTF!DII*..)9&:;<D7AS@T
UV!$))hz~~6F,G"H!IJK	M$))JNN34
56r'   rm   zIhf discussions comment username/my-model 5 --body "Thanks for reporting!"z9hf discussions comment username/my-model 5 --body "LGTM!"z%The comment text (supports Markdown).z0Read the comment from a file. Use '-' for stdin.c                     [        X#5      nUc  [        R                  " S5      e[        US9nUR	                  U UUUR
                  S9  [        SU S[        R                  " U 5       35        g)z(Comment on a discussion or pull request.Nz)Either --body or --body-file is required.rx   rq   r   rm   rs   zCommented on # in )	rJ   rC   rD   r   comment_discussionr   rV   r	   rW   )rq   rZ   r>   r?   rs   rv   rm   r   s           r(   discussion_commentr   o  ss    8 )G  !LMM
5
!C//	   
N3%tDIIg$6#7
89r'   closez(hf discussions close username/my-model 5zIhf discussions close username/my-model 5 --comment "Closing as resolved."z	--commentz)An optional comment to post when closing.yesz--yesz-yzSkip confirmation prompt.c                 0   U(       dD  [         R                  " SU SU  S35      nU(       d   [        S5        [         R                  " 5       e[	        US9nUR                  U USUUR                  S9  [        SU S	[        R                  " U 5       35        g
)z#Close a discussion or pull request.zClose # on ''?Aborted.rx   r   rq   r   
new_statusrm   rs   zClosed #r   N	rC   confirmrV   Exitr   change_discussion_statusr   r	   rW   rq   rZ   rm   r   rs   rv   r   r   s           r(   discussion_closer     s    : --'#eG9B ?@***,
5
!C  // !  
HSEdii01
23r'   reopenz)hf discussions reopen username/my-model 5zZhf discussions reopen username/my-model 5 --comment "Reopening for further investigation."z+An optional comment to post when reopening.c                 0   U(       dD  [         R                  " SU SU  S35      nU(       d   [        S5        [         R                  " 5       e[	        US9nUR                  U USUUR                  S9  [        SU S	[        R                  " U 5       35        g
)z+Reopen a closed discussion or pull request.zReopen #r   r   r   rx   r   r   z
Reopened #r   Nr   r   s           r(   discussion_reopenr     s    : --(3%uWIR @A***,
5
!C  // !  
Jse4		' 23
45r'   renamez9hf discussions rename username/my-model 5 "Updated title"	new_titlezThe new title.c           
          [        US9nUR                  U UUUR                  S9  [        SU S[        R
                  " U5       S[        R
                  " U 5       35        g)z$Rename a discussion or pull request.rx   )rq   r   r   rs   z	Renamed #z to r   N)r   rename_discussionr   rV   r	   rW   )rq   rZ   r   rs   rv   r   s         r(   discussion_renamer     sb    & 5
!C//	   
IcU$tyy34D79K8L
MNr'   mergez(hf discussions merge username/my-model 5zEhf discussions merge username/my-model 5 --comment "Merging, thanks!"z)An optional comment to post when merging.c                 .   U(       dD  [         R                  " SU SU  S35      nU(       d   [        S5        [         R                  " 5       e[	        US9nUR                  U UUUR                  S9  [        SU S[        R                  " U 5       35        g	)
zMerge a pull request.zMerge #r   r   r   rx   r   zMerged #r   N)	rC   r   rV   r   r   merge_pull_requestr   r	   rW   r   s           r(   discussion_merger     s    : --'#eG9B ?@***,
5
!C//	   
HSEdii01
23r'   z'hf discussions diff username/my-model 5c                     [        US9nUR                  U UUR                  S9nUR                  (       a  [	        UR                  5        g[	        S5        g)z Show the diff of a pull request.rx   r   zNo diff available.N)r   r   r   r   rV   )rq   rZ   rs   rv   r   rK   s         r(   discussion_diffr   ;  sN     5
!C((// ) G
 ||gll"#r'   )F)>r3   enumr2   rF   pathlibr   typingr   r   rC   huggingface_hubr   huggingface_hub.communityr   r   huggingface_hub.utilsr	   
_cli_utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   rE   Enumr   r*   r/   r   intArgumentDiscussionNumArgr=   rJ   boolrn   discussions_clicommandr   r    modeltableOptionr   r1   r   r   r   r   r   r   r   r   r!   r'   r(   <module>r      s   `   
  &  % N &   $sDII "S$)) "dii  "7+  	NN5 	3 	3 	Xc] x~ (3- (4$9 (4$ (4[_ (4V  %WX   $ 	 	%^^$**/IIG	
	I B	
	I$ %I& 'I( )I* +I, -I. /I0 
1IIX 
  $ 	 	 	%^^ 	?::	: %	
	: 5	
	:" *	
	#:0 1:2 0	
	3:> ?:@ 
A::z   0 	 	 	%^^A0707?	
	07 7	
	07  G	
	!07. A	
	/07> ?07@ A07B 
C0707f SC    	 	%^^%::	: 8	
	: C	
	:" #:$ %:& 
'::D 2S    	 	%^^'#4#4	#4 <	
	#4 
,	
	
#4$ %#4& '#4( 
)#4#4L 3d    	 	%^^'#6#6	#6 >	
	#6 
,	
	
#6$ %#6& '#6( 
)#6#6L C   &^^OO	O !	
	O O O 
OO. 2O    	 	%^^'"4"4	"4 <	
	"4 
,	
	
"4$ %"4& '"4( 
)"4"4J 
1   &^^	$$	$ $ 	$
 
$$r'   