Hacked By AnonymousFox

Current Path : /opt/alt/python33/lib64/python3.3/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/idlelib/__pycache__/FormatParagraph.cpython-33.pyo

�
��f�c@s�dZddlZddlmZGdd�d�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
edkr�ddlm
Z
dge
_ddlZejddddd�ndS(u�Extension to format a paragraph or selection to a max width.

Does basic, standard text formatting, and also understands Python
comment blocks. Thus, for editing Python source code, this
extension is really only suitable for reformatting these comment
blocks or triple-quoted strings.

Known problems with comment reformatting:
* If there is a selection marked, and the first line of the
  selection is not complete, the block will probably not be detected
  as comments, and will have the normal "text formatting" rules
  applied.
* If a comment block has leading whitespace that mixes tabs and
  spaces, they will not be considered part of the same block.
* Fancy comments, like this bulleted list, aren't handled :-)
iN(uidleConfcBsJ|EeZdZddgfgZdd�Zdd�Zdd	�Zd
S(uFormatParagraphuformatuFormat Paragraphu<<format-paragraph>>cCs
||_dS(N(ueditwin(uselfueditwin((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu__init__suFormatParagraph.__init__cCs
d|_dS(N(uNoneueditwin(uself((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuclose suFormatParagraph.closec	Cs>tjddddd�}|jj}|jj�\}}|ri|ri|j||�}t|�}n$t||jd��\}}}}|r�t	|||�}nt
||�}|jddd	�||kr|jd|�|j
�|j||�|j||�|j�n|jd|�|jd�d
S(u�Formats paragraph to a max width specified in idleConf.

        If text is selected, format_paragraph_event will start breaking lines
        at the max width, starting from the beginning selection.

        If no text is selected, format_paragraph_event uses the current
        cursor location to determine the paragraph (lines of text surrounded
        by blank lines) and formats it.
        umainuFormatParagraphu	paragraphutypeuintuinsertuselu1.0uendubreak(uidleConfu	GetOptionueditwinutextuget_selection_indicesugetuget_comment_headerufind_paragraphuindexureformat_commentureformat_paragraphu
tag_removeumark_setuundo_block_startudeleteuinsertuundo_block_stopusee(	uselfueventumaxformatwidthutextufirstulastudataucomment_headerunewdata((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuformat_paragraph_event#s*
$


u&FormatParagraph.format_paragraph_eventN(uFormat Paragraphu<<format-paragraph>>(u__name__u
__module__u__qualname__umenudefsu__init__ucloseuformat_paragraph_event(u
__locals__((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuFormatParagraphs
uFormatParagraphc

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(	u�Returns the start/stop indices enclosing the paragraph that mark is in.

    Also returns the comment format string, if any, and paragraph of text
    between the start/stop indices.
    u.u%d.0u%d.endu<uendiNi(umapuintusplitugetucompareuis_all_whiteuget_comment_headerulen(
utextumarkulinenoucolulineufirst_linenoucomment_headerucomment_header_lenulastufirst((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyufind_paragraphHs,(




ufind_paragraphc	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]�}
|	|
}|s1qnt||j��|kru||kru|j|j��|}n||d}|
dt|	�kr|	|
ddkr|d}qqW|d}q�W|j|j��|j	||d��dj
|�S(u3Return data reformatted to specified width (limit).u
iiNu(\s+)iu (usplitulenuis_all_whiteu
get_indentureurangeu
expandtabsuappendurstripuextendujoin(udataulimitulinesuiunuindent1uindent2unewupartialuwordsujuword((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyureformat_paragraphms<% 
	*ureformat_paragraphcs�t���dj�fdd�|jd�D��}t|t��d�}t||�}|jd�}d}|d	s�d}|dd
�}ndj�fdd�|D��|S(u?Return data reformatted to specified width with comment header.u
c3s|]}|�d�VqdS(N((u.0uline(ulc(u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu	<genexpr>�su#reformat_comment.<locals>.<genexpr>iuiNc3s|]}�|VqdS(N((u.0uline(ucomment_header(u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu	<genexpr>�si����i����(ulenujoinusplitumaxureformat_paragraph(udataulimitucomment_headeruformat_widthunewdataublock_suffix((ucomment_headerulcu</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyureformat_comment�s+
ureformat_commentcCstjd|�dk	S(u/Return True if line is empty or all whitespace.u^\s*$N(ureumatchuNone(uline((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuis_all_white�suis_all_whitecCstjd|�j�S(u/Return the initial space or tab indent of line.u	^([ \t]*)(ureumatchugroup(uline((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu
get_indent�su
get_indentcCs/tjd|�}|dkr"dS|jd�S(uReturn string with leading whitespace and '#' from line or ''.

    A null return indicates that the line is not a comment line. A non-
    null return, such as '    #', will be used to find the other lines of
    a comment block with the same  indent.
    u^([ \t]*#*)uiN(ureumatchuNoneugroup(ulineum((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuget_comment_header�suget_comment_headeru__main__(usupportuguiu&idlelib.idle_test.test_formatparagraphu	verbosityiuexitF(u__doc__ureuidlelib.configHandleruidleConfuFormatParagraphufind_paragraphureformat_paragraphureformat_commentuis_all_whiteu
get_indentuget_comment_headeru__name__utestusupportu
use_resourcesuunittestumainuFalse(((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu<module>s3%$

Hacked By AnonymousFox1.0, Coded By AnonymousFox