Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/format.cpython-37.opt-2.pyc

B

YI~d�=�@s�ddlZddlmZddlmZddlmZGdd�d�Ze��dd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Ze�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zedkr�ddlmZeddd d!�dS)"�N)�askyesno)�
askinteger)�idleConfc@s2eZdZdd�Zedd��Zdd�Zd
dd	�ZdS)�FormatParagraphcCs
||_dS)N)�editwin)�selfr�r�3/opt/alt/python37/lib64/python3.7/idlelib/format.py�__init__szFormatParagraph.__init__cCstjdddddd�|_dS)N�
extensionsrz	max-width�int�H)�type�default)rZ	GetOption�	max_width)�clsrrr	�reload"szFormatParagraph.reloadcCs
d|_dS)N)r)rrrr	�close'szFormatParagraph.closeNc	Cs�|dkr|jn|}|jj}|j��\}}|rF|rF|�||�}t|�}nt||�d��\}}}}|rpt|||�}n
t	||�}|�
ddd�||kr�|�d|�|��|�
||�|�||�|��n|�d|�|�d�dS)N�insert�selz1.0�end�break)rr�text�get_selection_indices�get�get_comment_header�find_paragraph�index�reformat_comment�reformat_paragraph�
tag_remove�mark_set�undo_block_start�deleter�undo_block_stopZsee)	r�event�limitr�first�last�data�comment_header�newdatarrr	�format_paragraph_event*s(



z&FormatParagraph.format_paragraph_event)N)�__name__�
__module__�__qualname__r
�classmethodrrr,rrrr	rsrc
CsFtt|�d��\}}|�d|d|�}x:|�d|dd�rbt|�rb|d}|�d|d|�}q*W|}t|�}t|�}x<t|�|kr�t||d��s�|d}|�d|d|�}qzWd|}|d}|�d|d|�}xJ|dk�r$t|�|k�r$t||d���s$|d}|�d|d|�}q�Wd|d}	|	|||�|	|�fS)N�.z%d.0z%d.end�<r�r)�mapr�splitrZcompare�is_all_whiter�len)
rZmark�lineno�col�lineZfirst_linenor*Zcomment_header_lenr(r'rrr	rSs,rcCs�|�d�}d}t|�}x ||kr6t||�r6|d}qW||krD|St||�}|d|kr~t||d�s~t||d�}n|}|d|�}|}x�||k�rTt||��sTt�d||�}	x�tdt|	�d�D]x}
|	|
}|s�q�t||���|k�r||k�r|�|���|}||d}|
dt|	�kr�|	|
ddkr�|d}q�W|d}q�W|�|���|�	||d��d�
|�S)N�
rr3z(\s+)�� )r5r7r6�
get_indent�re�range�
expandtabs�append�rstrip�extend�join)r)r&�lines�i�nZindent1Zindent2�new�partialZwords�jZwordrrr	rxs<

 rcs�t���d��fdd�|�d�D��}t|t��d�}t||�}|�d�}d}|dshd}|dd�}d��fdd�|D��|S)Nr;c3s|]}|�d�VqdS)Nr)�.0r:)�lcrr	�	<genexpr>�sz#reformat_comment.<locals>.<genexpr>�����c3s|]}�|VqdS)Nr)rLr:)r*rr	rN�s)r7rEr5�maxr)r)r&r*Zformat_widthr+Zblock_suffixr)r*rMr	r�s

rcCst�d|�dk	S)Nz^\s*$)r?�match)r:rrr	r6�sr6cCst�d|���S)Nz	^([ \t]*))r?rS�group)r:rrr	r>�sr>cCs"t�d|�}|dkrdS|�d�S)Nz^([ \t]*#*)rPr3)r?rSrT)r:�mrrr	r�srz[ \t]*cCs$t�|�}|��t|���|��fS)N)�_line_indent_rerSrr7rTrA)r:�tabwidthrUrrr	�get_line_indent�s
rXc@sheZdZdd�Zdd�Zdd�Zddd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
ddd�Zdd�ZdS)�FormatRegioncCs
||_dS)N)r)rrrrr	r
�szFormatRegion.__init__cCsr|jj}|j��\}}|r<|r<|�|d�}|�|d�}n|�d�}|�d�}|�||�}|�d�}||||fS)Nz
 linestartz-1c lineend +1czinsert linestartzinsert lineend +1cr;)rrrrrr5)rrr'r(�head�tail�charsrFrrr	�
get_region�s



zFormatRegion.get_regioncCsz|jj}d�|�}||kr&|��dS|�ddd�|�d|�|��|�||�|�||�|�	�|�
d|d�dS)Nr;rz1.0rr)rrrEZbellr r!r"r#rr$Ztag_add)rrZr[r\rFr�newcharsrrr	�
set_region�s
zFormatRegion.set_regionNc
Cs�|��\}}}}xZtt|��D]J}||}|rt||jj�\}}	|	|jj}	|j�|	�||d�||<qW|�||||�dS)Nr)	r]r@r7rXrrW�indentwidth�_make_blanksr_)
rr%rZr[r\rF�posr:�raw�	effectiverrr	�indent_region_events z FormatRegion.indent_region_eventc
Cs�|��\}}}}x`tt|��D]P}||}|rt||jj�\}}	t|	|jjd�}	|j�|	�||d�||<qW|�	||||�dS)Nrr)
r]r@r7rXrrWrRr`rar_)
rr%rZr[r\rFrbr:rcrdrrr	�dedent_region_events z FormatRegion.dedent_region_eventcCsR|��\}}}}x,tt|�d�D]}||}d|||<q"W|�||||�dS)Nr3z##r)r]r@r7r_)rr%rZr[r\rFrbr:rrr	�comment_region_event sz!FormatRegion.comment_region_eventcCs�|��\}}}}xdtt|��D]T}||}|s0q|dd�dkrN|dd�}n|dd�dkrj|dd�}|||<qW|�||||�dS)Nr<z##r3�#r)r]r@r7r_)rr%rZr[r\rFrbr:rrr	�uncomment_region_event,sz#FormatRegion.uncomment_region_eventc
Cs�|��\}}}}|��}|dkr$dSx\tt|��D]L}||}|r2t||�\}	}
t|
|�\}}d|d|||	d�||<q2W|�||||�dS)N�	r=r)r]�_asktabwidthr@r7rX�divmodr_)
rr%rZr[r\rFrWrbr:rcrdZntabsZnspacesrrr	�tabify_region_event?s$z FormatRegion.tabify_region_eventcCs`|��\}}}}|��}|dkr$dSx&tt|��D]}||�|�||<q2W|�||||�dS)Nr)r]rkr@r7rAr_)rr%rZr[r\rFrWrbrrr	�untabify_region_eventNsz"FormatRegion.untabify_region_eventcCstdd|jj|jjddd�S)Nz	Tab widthzColumns per tab? (2-16)r<�)�parent�initialvalue�minvalue�maxvalue)rrrr`)rrrr	rkYszFormatRegion._asktabwidth)N)N)N)N)N)N)
r-r.r/r
r]r_rerfrgrirmrnrkrrrr	rY�s





rYc@s$eZdZdd�Zdd�Zdd�ZdS)�IndentscCs
||_dS)N)r)rrrrr	r
gszIndents.__init__cCsJ|j}|j}tddd|dd|dd|jd�rF||_d	|_d
S)NzToggle tabsz
Turn tabs )ZonZoffz?
Indent width )zwill bez
remains atz 8.z!
 Note: a tab is always 8 columns)rp�r)r�usetabsrrr`)rr%rrvrrr	�toggle_tabs_eventjs
zIndents.toggle_tabs_eventcCs<|j}tdd|j|jddd�}|r8||jkr8|js8||_dS)NzIndent widthz6New indent width (2-16)
(Always use 8 when using tabs)r<ro)rprqrrrsr)rrrr`rv)rr%rrIrrr	�change_indentwidth_eventzsz Indents.change_indentwidth_eventN)r-r.r/r
rwrxrrrr	rtdsrtc@seZdZdd�Zddd�ZdS)�RstripcCs
||_dS)N)r)rrrrr	r
�szRstrip.__init__Nc	Cs�|jj}|jj}|��tt|�d���}xZtd|�D]L}|�d|d|�}t	|�}t	|�
��}||kr6|�d||fd|�q6W|�d�dkr�t|jd�s�x*|�d	�d
kr�|�d�dkr�|�d�q�W|�
�dS)Nrr3z%i.0z%i.endz%i.%izend-2cr;Zinterpzend-1cz1.0zend-3c)rr�undor"r�floatrr@rr7rCr#�hasattrr$)	rr%rrzZend_lineZcurZtxtrcZcutrrr	�	do_rstrip�s zRstrip.do_rstrip)N)r-r.r/r
r}rrrr	ry�sry�__main__)�mainzidlelib.idle_test.test_formatr<F)�	verbosity�exit)r?Ztkinter.messageboxrZtkinter.simpledialogrZidlelib.configrrrrrrr6r>r�compilerVrXrYrtryr-Zunittestrrrrr	�<module>s(C%$

$ 

Hacked By AnonymousFox1.0, Coded By AnonymousFox