
    ^h]              
          S r SSKrSSKrSSKrSSKJrJr  SSKJrJ	r	  SSK
Jr  \" SS9SS\\   S	\S
\SS4S jj5       r\" SS9SS\\   S	\S
\SS4S jj5       r\" SS9SS\\   S	\S
\SS4S jj5       rSS\\   S	\S
\SS4S jjrS\S\S\S\S\4
S jr\R&                  " S5      rS\S\\   4S jrS\S\S\S\S\4
S jrS\S\4S jr\" SS9SS.S\S\S\4S jj5       rg) zMNice output for Black.

The double calls are for patching purposes in tests.
    N)AnyOptional)echostyle)
mypyc_attrT)	patchablemessagenlstylesreturnc                 L    U b  SU;  a  SUS'   [        U 40 UD6n [        XSS9  g )NboldTr
   errr   r   r	   r
   r   s      F/home/james-whalen/.local/lib/python3.13/site-packages/black/output.py_outr      s2    !F6N*6*T"    c                 L    U b  SU;  a  SUS'   [        U 40 UD6n [        XSS9  g )NfgredTr   r   r   s      r   _errr      s2    v F4L*6*T"r   c                      [        U 4SU0UD6  g Nr
   )r   r   s      r   outr   !   s    "R"6"r   c                      [        U 4SU0UD6  g r   )r   r   s      r   r   r   &   s    "R"6"r   aba_nameb_namec                 z   [         R                  " U 5      n[         R                  " U5      n[        US   5       VVs/ s H^  u  pgUS   S:X  d  M  [        SR	                  US   U   S   5      S-   SR	                  US   U   S   5      S-   U SU 3U SU 35      PM`     nnnSR	                  U5      $ s  snnf )zHReturn a unified diff string between each cell in notebooks `a` and `b`.cells	cell_typecode source
z:cell_)jsonloads	enumeratediffjoin)	r   r   r    r!   a_nbb_nbcell_numbercell
diff_liness	            r   
ipynb_diffr3   *   s    ::a=D::a=D "+4=!9	 ":K&	
GGDM+.x89D@GGDM+.x89D@hf[M*hf[M*		
 ":  	 77:	s   B7AB7z(.*?(?:\r\n|\n|\r|$))r'   c                     [         R                  U 5       Vs/ s H  oS   PM	     nnUS   S:X  a  UR                  S5        U$ s  snf )zSplit a string into lines ignoring form feed and other chars.

This mimics how the Python parser splits source code.

A simplified version of the function with the same name in Lib/ast.py
r   r&   )_line_patternfinditerpop)r'   matchresults      r   _splitlines_no_ffr;   >   sI     %2$:$:6$BC$B5Ah$BFCbzR

2M Ds   Ac                    SSK n[        U 5      n[        U5      n/ nUR                  XVX#SS9 HD  nUS   S:X  a  UR                  U5        M  UR                  US-   5        UR                  S5        MF     SR	                  U5      $ )	z9Return a unified diff string between strings `a` and `b`.r   N   )fromfiletofilenr5   r(   z\ No newline at end of file
r&   )difflibr;   unified_diffappendr-   )	r   r   r    r!   rA   a_linesb_linesr2   lines	            r   r,   r,   K   s    "G"GJ$$6A %  8td#dTk*>? 77:r   contentsc                    U R                  S5      n[        U5       H  u  p#UR                  S5      (       d  UR                  S5      (       a	  SU-   S-   nO\UR                  S5      (       a	  SU-   S-   nO=UR                  S5      (       a	  S	U-   S-   nOUR                  S
5      (       a  SU-   S-   nX1U'   M     SR                  U5      $ )z(Inject the ANSI color codes to the diff.r(   z+++z---z[1mz[0mz@@z[36m+z[32m-z[31m)splitr+   
startswithr-   )rG   linesirF   s       r   
color_diffrO   `   s    NN4 EU#??5!!T__U%;%;t#i/D__T""$y0D__S!!$y0D__S!!$y0Da $ 99Ur   )ensure_final_newlineoutputrP   c                 $   [         R                  " SSSSSS9 nU HB  nUR                  U5        U (       d  M  U(       d  M&  US   S:w  d  M1  UR                  S5        MD     S	S	S	5        UR                  $ ! , (       d  f       WR                  $ = f)
z;Dump `output` to a temporary file. Return path to the file.wblk_z.logFutf8)modeprefixsuffixdeleteencodingr5   r(   N)tempfileNamedTemporaryFilewritename)rP   rQ   frM   s       r   dump_to_filer`   p   s{     
	$	$uv
	
EGGEN##%)t2C 
 66M
 
 66Ms   A6A6A6A66
B)NT)__doc__r)   rer[   typingr   r   clickr   r   mypy_extensionsr   strboolr   r   r   r   r3   compiler6   listr;   r,   rO   r`    r   r   <module>rk      s  
  	     & d#(3- #D #3 #4 # # d#(3- #D #3 #4 # # d## #4 ## #$ # ### #4 ## #$ ## # s C C " 

34
c 
d3i 
C C  c c *    d<@ 	# 	T 	S 	 	r   