o
    h|                     @   sz   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ G dd deZG d	d
 d
eZeG dd dZdS )z 
Summarize Black runs to users.
    )	dataclass)Enum)Path)style)erroutc                   @   s   e Zd ZdZdZdZdS )Changedr         N)__name__
__module____qualname__NOCACHEDYES r   r   B/var/www/html/ai/venv/lib/python3.10/site-packages/black/report.pyr      s    r   c                   @   s   e Zd ZdZdS )NothingChangedz3Raised when reformatted code is the same as source.N)r   r   r   __doc__r   r   r   r   r      s    r   c                   @   s   e Zd ZU dZdZeed< dZeed< dZeed< dZ	eed< dZ
eed< dZeed	< dZeed
< dededdfddZdededdfddZdededdfddZedefddZdefddZdS )ReportzDProvides a reformatting counter. Can be rendered with `str(report)`.Fcheckdiffquietverboser   change_count
same_countfailure_countsrcchangedreturnNc                 C   s   |t ju r'| js| jrdnd}| js| jst| d|  |  jd7  _d	S | jr@|t ju r5| d}n| d}t|dd |  j	d7  _	d	S )
zGIncrement the counter for successful reformatting. Write out a message.zwould reformatreformatted r	   z" already well formatted, good job.z( wasn't modified on disk since last run.FboldN)
r   r   r   r   r   r   r   r   r   r   )selfr   r   r    msgr   r   r   done$   s   


zReport.donemessagec                 C   s&   t d| d|  |  jd7  _dS )zCIncrement the counter for failed reformatting. Write out a message.zerror: cannot format z: r	   N)r   r   )r$   r   r'   r   r   r   failed4   s   zReport.failedpathc                 C   s$   | j rt| d| dd d S d S )Nz
 ignored: Fr"   )r   r   )r$   r)   r'   r   r   r   path_ignored9   s   zReport.path_ignoredc                 C   s   | j rdS | jr| jrdS dS )a  Return the exit code that the app should use.

        This considers the current state of changed files and failures:
        - if there were any failures, return 123;
        - if any files were changed and --check is being used, return 1;
        - otherwise return 0.
        {   r	   r   )r   r   r   )r$   r   r   r   return_code=   s
   zReport.return_codec                 C   s   | j s| jrd}d}d}nd}d}d}g }| jr9| jdkrdnd	}|t| j d
| ddddt| dd  | jrW| jdkrCdnd	}|t| j d
| ddd|  | jru| jdkradnd	}|t| j d
| d| dd d|d S )zcRender a color report of the current state.

        Use `click.unstyle` to remove colors.
        zwould be reformattedzwould be left unchangedzwould fail to reformatr    zleft unchangedzfailed to reformatr	   s z filer!   Tblue)r#   fgr"   )r0   redz, .)r   r   r   appendr   r   r   join)r$   r    	unchangedr(   reportr-   r   r   r   __str__P   s,   $$zReport.__str__)r   r   r   r   r   bool__annotations__r   r   r   r   intr   r   r   r   r&   strr(   r*   propertyr,   r7   r   r   r   r   r      s   
 r   N)r   dataclassesr   enumr   pathlibr   clickr   black.outputr   r   r   UserWarningr   r   r   r   r   r   <module>   s    