
    h                         S SK r S SKrS SKrS SKJr  S SKJr  Sr\ R                  " 5       r\R                  SSS9  \R                  SS	S
9  SS jr
g)    N)date)tabulateiT  z--slack_channel_nameztrl-push-examples-ci)defaultz--text_file_nameT)requiredc           	         [         R                  " [         R                  S9  [         R                  " [        5      nSn[
        R                  R                  U 5      (       a  0 n [        U 5       nU HW  nUR                  5       R                  S5      u  pxUR                  S5      S   R                  S5      S   n[        U5      XH'   MY     S S S 5        S
S[        U5      S:X  d  SOSSS.S.n
[!        UR#                  5       5      nOS
SSSS.S.n
SnU R%                  SS5      R%                  SS5      R%                  SS5      R'                  5       nSSSR)                  [
        R*                  R-                  SS5      U5      S.S./nUS:  aU  X; S3-  nWR/                  5        H+  u  p[1        X(       d  SOS//SS/SSS /S!9nUS"U-   S#-   -  nM-     [3        S$U 35        OUR5                  U
5        [
        R*                  R-                  SS5      S:w  Gah   SS%KJn  [        U5      [<        :  a*  [3        S'[        U5       S([<         35        US [<         S)-   n[        U5      S:w  aO  S
S*US.S.nUR5                  U5        S
S*S+S.S,SS-SS.S.[
        R*                  S/    3S0.S1.nUR5                  U5        S2SS3[
        R*                  R-                  S5       S4[>        R@                  " 5        3S./S5.nUR5                  U5        [3        U5         U" [
        R*                  R-                  S65      S79nURC                  S8U 3X=S99nUS:   (       a  URE                  S;5        OUR                  S<US=    35         [        S?:X  a5  [F        RI                  5       n[K        URL                  URN                  5        g g ! , (       d  f       GN= f! [         a-  n	UR                  SU  S	[        U	5       35        0 n S n	A	GN3S n	A	ff = f! [:         a    UR                  S&5         g f = f! [         a'  n	UR                  S>[        U	5       35         S n	A	NS n	A	ff = f)@N)level ,/z.yamlr   zError reading file z: section
plain_textu1   🌞 There were no failures on the example tests!zWSomething went wrong there is at least one empty file - please check GH action results.T)typetextemoji)r   r   u   ❌ Something is wrong with the workflow please check ASAP!Something went wrong there is no text file being produced. Please check ASAP.z.txttemp_results__ headeru,   🤗 Results of the {} TRL {} example tests.	TEST_TYPEz  failed tests for example tests!u   ✅u   ❌z	Test NameStatusalwaysgrid   )headers	showindextablefmtmaxcolwidthsz
```
z
```z### )	WebClientzGslack_sdk is not installed. Please install it to use Slack integration.zTruncating long message from z to z...mrkdwnz*For more details:*buttonzCheck Action resultsz0https://github.com/huggingface/trl/actions/runs/GITHUB_RUN_ID)r   r   url)r   r   	accessorycontextzOn Push - main z test results for )r   elementsSLACK_API_TOKEN)token#)channelr   blocksokz#Message sent successfully to Slack.z!Failed to send message to Slack: errorz Error sending message to Slack: __main__)(loggingbasicConfigINFO	getLogger__name__ospathisfileopenstripsplitint	Exceptionr-   strlensumvaluesreplacetitleformatenvirongetitemsr   printappend	slack_sdkr   ImportErrorMAX_LEN_MESSAGEr   todaychat_postMessageinfoparser
parse_argsmaintext_file_nameslack_channel_name)rQ   rR   loggermessagefinal_resultsfilelineresultconfig_nameeno_error_payloadtotal_num_failedtest_type_namepayload	test_namefailedfailed_tabler   	md_reportaction_buttondate_reportclientresponseargss                           U/home/james-whalen/.local/lib/python3.13/site-packages/scripts/log_example_reports.pyrP   rP      sn   gll+x(FG	ww~~n%%	n% D*.**,*<*<S*A'F"-"3"3C"8"<"B"B7"KA"NK14VM. ! & $=)Q. Ln	
 }3356 $`	
 #++FB7??QST\\]`befllnN $FMMJJNN;3^	

G !''GHH!.!4!4!6I#&Ue<=$h/" TL y</'99G "7 	WI'(	zz~~k2&",	+
 w</)1#g,tOCTUV./%7Gw<1!!)7;I NN9%!!)3HI$%1;Q\`aMbjjYhNiMjkM NN=)  )-bjjnn[.I-JJ\]a]g]g]i\jk
 	{#g	FRZZ^^4E%FGF..;M:N7OV].nH~AB@'AR@STU :  "T  $"9"9: i &%
  	LL.~.>bQIJM	~  	LLbc	Z  	FLL;CF8DEE	Fsh   &O 1AOO P AP3 .P3 
OO O 
P""P

PP0/P03
Q$=QQ$)N)argparser/   r4   datetimer   r   rJ   ArgumentParserrN   add_argumentrP        rh   <module>ro      sZ      	   		 	 	"   *4J  K   &  6@;rn   