
    h]              
          d Z ddlZddlZddlZddlmZmZ ddlmZm	Z	 ddl
mZ  ed      ddee   d	ed
eddfd       Z ed      ddee   d	ed
eddfd       Z ed      ddee   d	ed
eddfd       Zddee   d	ed
eddfdZdededededef
dZ ej&                  d      Zdedee   fdZdededededef
dZdedefdZ ed      dddededefd       Zy) 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                 N    | d|vrd|d<   t        | fi |} t        | |d       y )NboldTr
   errr   r   r	   r
   r   s      ?/var/www/html/immo/lib/python3.12/site-packages/black/output.py_outr      s4    !F6N*6*RT"    c                 N    | d|vrd|d<   t        | fi |} t        | |d       y )NfgredTr   r   r   s      r   _errr      s4    v F4L*6*RT"r   c                      t        | fd|i| y Nr
   )r   r   s      r   outr   !   s    "R"6"r   c                      t        | fd|i| y r   )r   r   s      r   r   r   &   s    "R"6"r   aba_nameb_namec                 l   t        j                  |       }t        j                  |      }t        |d         D cg c][  \  }}|d   dk(  rNt        dj	                  |d   |   d         dz   dj	                  |d   |   d         dz   | d| | d|       ] }}}dj	                  |      S c c}}w )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*		
	J 	 77:	s   A B0z(.*?(?:\r\n|\n|\r|$))r'   c                     t         j                  |       D cg c]  }|d   	 }}|d   dk(  r|j                  d       |S c c}w )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;   >   sH     %2$:$:6$BC5eAhCFCbzR

2M Ds   Ac                    ddl }t        |       }t        |      }g }|j                  ||||d      D ]A  }|d   dk(  r|j                  |       |j                  |dz          |j                  d       C dj	                  |      S )	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$$6&A %  
@ 8td#dTk*>?
@ 77:r   contentsc                 f   | j                  d      }t        |      D ]  \  }}|j                  d      s|j                  d      r	d|z   dz   }nM|j                  d      r	d|z   dz   }n3|j                  d      r	d	|z   dz   }n|j                  d
      rd|z   dz   }|||<    dj                  |      S )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# 	4??5!T__U%;t#i/D__T"$y0D__S!$y0D__S!$y0Da	 99Ur   )ensure_final_newlineoutputrP   c                     t        j                  ddddd      5 }|D ]3  }|j                  |       | s|s|d   dk7  s#|j                  d       5 	 d	d	d	       |j                  S # 1 sw Y   j                  S xY w)
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   A)A)A)A))A=)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   