Your IP : 3.147.77.119


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/FormatParagraph.cpython-35.opt-2.pyc



���]w�@s�ddlZddlmZGdd�d�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	e
dkr�ddlZejddddd�dS)�N)�idleConfc@sIeZdZddgfgZdd�Zdd�Zdd	d
�ZdS)�FormatParagraph�format�Format Paragraph�<<format-paragraph>>cCs
||_dS)N)�editwin)�selfr�r	�4/opt/alt/python35/lib64/python3.5/FormatParagraph.py�__init__szFormatParagraph.__init__cCs
d|_dS)N)r)rr	r	r
�close szFormatParagraph.closeNc	CsP|dkr-tjddddddd�}|jj}|jj�\}}|r{|r{|j||�}t|�}n$t||jd��\}}}}|r�t	|||�}nt
||�}|jd	d
d�||kr/|jd|�|j
�|j||�|j||�|j�n|jd|�|jd�dS)
N�
extensionsrz	max-width�type�int�default�H�insertZselz1.0�end�break)rZ	GetOptionr�textZget_selection_indices�get�get_comment_header�find_paragraph�index�reformat_comment�reformat_paragraphZ
tag_removeZmark_setZundo_block_start�deleterZundo_block_stopZsee)	r�event�limitr�first�last�data�comment_header�newdatar	r	r
�format_paragraph_event#s.$


z&FormatParagraph.format_paragraph_event)rr)�__name__�
__module__�__qualname__Zmenudefsrrr$r	r	r	r
rs
rc
Cs�tt|jd��\}}|jd|d|�}xM|jd|dd�r�t|�r�|d}|jd|d|�}q;W|}t|�}t|�}xQt|�|kr�t||d��r�|d}|jd|d|�}q�Wd|}|d}|jd|d|�}x]|dkr�t|�|kr�t||d��r�|d}|jd|d|�}q+Wd|d}	|	|||j|	|�fS)N�.z%d.0z%d.end�<r�r)�mapr�splitrZcompare�is_all_whiter�len)
r�mark�lineno�col�lineZfirst_linenor"Zcomment_header_lenr rr	r	r
rMs,(




rcCs�|jd�}d}t|�}x*||krMt||�rM|d}q$W||kr^|St||�}|d|kr�t||d�r�t||d�}n|}|d|�}|}x�||kr�t||�r�tjd||�}	x�tdt|	�d�D]�}
|	|
}|s.qt||j��|kro||kro|j|j��|}||d}|
dt|	�kr|	|
ddkr|d}qW|d}q�W|j|j��|j	||d��dj
|�S)N�
rr*z(\s+)�� )r,r.r-�
get_indent�re�range�
expandtabs�append�rstrip�extend�join)r!r�lines�i�nZindent1Zindent2�new�partialZwords�jZwordr	r	r
rrs<% 
*rcs�t���dj�fdd�|jd�D��}t|t��d�}t||�}|jd�}d}|ds�d}|dd	�}dj�fdd�|D��|S)
Nr3c3s|]}|�d�VqdS)Nr	)�.0r2)�lcr	r
�	<genexpr>�sz#reformat_comment.<locals>.<genexpr>��r*c3s|]}�|VqdS)Nr	)rDr2)r"r	r
rF�s���rI)r.r=r,�maxr)r!rr"Zformat_widthr#Zblock_suffixr	)r"rEr
r�s+
rcCstjd|�dk	S)Nz^\s*$)r7�match)r2r	r	r
r-�sr-cCstjd|�j�S)Nz	^([ \t]*))r7rK�group)r2r	r	r
r6�sr6cCs/tjd|�}|dkr"dS|jd�S)Nz^([ \t]*#*)rHr*)r7rKrL)r2�mr	r	r
r�sr�__main__z&idlelib.idle_test.test_formatparagraph�	verbosityr4�exitF)
r7Zidlelib.configHandlerrrrrrr-r6rr%Zunittest�mainr	r	r	r
�<module>s8%$

?>