o
    od                  
   @   sV  d Z ddlZddlmZmZ ddlmZ ddlZddlm	Z	m
Z
 eddd$dee d	ed
eddfddZeddd$dee d	ed
eddfddZeddd$dee d	ed
eddfddZd$dee d	ed
eddfddZdededededef
ddZdededededef
ddZdedefddZeddddd ed!edefd"d#ZdS )%zMNice output for Black.

The double calls are for patching purposes in tests.
    N)AnyOptional)
mypyc_attr)echostyleT)	patchablemessagenlstylesreturnc                 K   s:   | d urd|vrd|d< t | fi |} t| |dd d S )NboldTr	   errr   r   r   r	   r
    r   N/var/www/staging_poorna_satya/env/lib/python3.10/site-packages/black/output.py_out   
   r   c                 K   s:   | d urd|vrd|d< t | fi |} t| |dd d S )NfgredTr   r   r   r   r   r   _err   r   r   c                 K      t | fd|i| d S Nr	   )r   r   r   r   r   out    s   r   c                 K   r   r   )r   r   r   r   r   r   %   s   r   aba_nameb_namec                    s>   t | t | fddtd D }d|S )zHReturn a unified diff string between each cell in notebooks `a` and `b`.c              	      sj   g | ]1\}}|d  dkrt dd | d d dd | d d   d|  d| qS )	cell_typecode cellssource
z:cell_)diffjoin).0cell_numbercellr   a_nbr   b_nbr   r   
<listcomp>-   s    zipynb_diff.<locals>.<listcomp>r"   r!   )jsonloads	enumerater&   )r   r   r   r   
diff_linesr   r*   r   
ipynb_diff)   s   




r2   c           	      C   sx   ddl }| jdd}|jdd}g }|j||||ddD ]}|d dkr*|| q||d  |d	 qd
|S )z9Return a unified diff string between strings `a` and `b`.r   NT)keepends   )fromfiletofilenr$   z\ No newline at end of file
r!   )difflib
splitlinesunified_diffappendr&   )	r   r   r   r   r9   a_linesb_linesr1   liner   r   r   r%   :   s   


r%   contentsc                 C   s   |  d}t|D ]<\}}|ds|drd| d }n#|dr*d| d }n|dr6d	| d }n|d
rAd| d }|||< q	d|S )z(Inject the ANSI color codes to the diff.r$   z+++z---z[1mz[0mz@@z[36m+z[32m-z[31m)splitr0   
startswithr&   )r@   linesir?   r   r   r   
color_diffO   s   





rG   )ensure_final_newlineoutputrH   c                 G   sp   t jdddddd#}|D ]}|| | r#|r#|d dkr#|d qW d	   |jS 1 s0w   Y  |jS )
z;Dump `output` to a temporary file. Return path to the file.wblk_z.logFutf8)modeprefixsuffixdeleteencodingr8   r$   N)tempfileNamedTemporaryFilewritename)rH   rI   frE   r   r   r   dump_to_file_   s   



rW   )NT)__doc__r.   typingr   r   mypy_extensionsr   rR   clickr   r   strboolr   r   r   r   r2   r%   rG   rW   r   r   r   r   <module>   s$    """ "