o
    Vh                     @  st   d dl mZ d dl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 er0d dlmZ G d	d
 d
e	ZdS )    )annotationsN)TYPE_CHECKING)TextIO)	Verbosity)StreamOutput)Terminal)	Formatterc                      s   e Zd Zejddfd) fddZed*ddZed+ddZd,d- fddZ	d.ddZ
d/ddZd0d1 fd#d$Z	%d2d3 fd'd(Z  ZS )4SectionOutputNstreamr   sectionslist[SectionOutput]	verbosityr   	decoratedbool | None	formatterFormatter | NonereturnNonec                   s@   t  j||||d g | _d| _|d|  || _t j| _d S )N)r   r   r   r   )	super__init___content_linesinsert	_sectionsr   size	_terminal)selfr
   r   r   r   r   	__class__ r/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/cleo/io/outputs/section_output.pyr      s   zSectionOutput.__init__strc                 C  s   d | jS )N )joinr   r   r   r   r    content$   s   zSectionOutput.contentintc                 C  s   | j S N)r   r$   r   r   r    lines(   s   zSectionOutput.linesr(   
int | Nonec                   s^   | j r|  s	d S |r| j | d d = n| j}g | _ |  j|8  _t j| |dd d S )N   Fnew_line)r   is_decoratedr   r   _write)_pop_stream_content_until_current_section)r   r(   r   r   r    clear,   s   

zSectionOutput.clearmessagec                 C  s   |    | | d S r'   )r0   
write_line)r   r1   r   r   r    	overwrite=   s   zSectionOutput.overwriter%   c              
   C  s^   | dD ]'}|  jtt| |dd| jj pd7  _| j	
| | j	
d qd S )N
	z           )splitr   mathceillenremove_formatreplacer   widthr   append)r   r%   line_contentr   r   r    add_contentA   s   zSectionOutput.add_contentFr,   boolc                   sN   |   st j||dS |  }| | t j|dd t j|dd d S )Nr+   TF)r-   r   r.   r/   r@   )r   r1   r,   erased_contentr   r   r    r.   M   s   
zSectionOutput._writer   lines_to_clear_countc                   sp   g }| j D ]}|| u r n||j7 }||j q|dkr1t jd| ddd t jddd dt|S )Nr   z[AFr+   z[0Jr"   )r   r(   r>   r%   r   r.   r#   reversed)r   rC   rB   sectionr   r   r    r/   X   s   

z7SectionOutput._pop_stream_content_until_current_section)r
   r   r   r   r   r   r   r   r   r   r   r   )r   r!   )r   r&   r'   )r(   r)   r   r   )r1   r!   r   r   )r%   r!   r   r   )F)r1   r!   r,   rA   r   r   )r   )rC   r&   r   r!   )__name__
__module____qualname__r   NORMALr   propertyr%   r(   r0   r3   r@   r.   r/   __classcell__r   r   r   r    r	      s    

r	   )
__future__r   r8   typingr   r   cleo.io.outputs.outputr   cleo.io.outputs.stream_outputr   cleo.terminalr   cleo.formatters.formatterr   r	   r   r   r   r    <module>   s    