HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.5/idlelib/__pycache__/FormatParagraph.cpython-35.pyc


Füƒawã@s²dZddlZddlmZGdd„dƒZdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dd„Z
edkr®ddlZej
dddddƒdS)aÐ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 :-)
éN)ÚidleConfc@sIeZdZddgfgZdd„Zdd„Zdd	d
„ZdS)ÚFormatParagraphÚformatúFormat Paragraphú<<format-paragraph>>cCs
||_dS)N)Úeditwin)Úselfr©r	ú-/usr/lib/python3.5/idlelib/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
ddƒ||kr/|jd	|ƒ|j
ƒ|j||ƒ|j||ƒ|jƒn|jd	|ƒ|jd	ƒd
S)aÕ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.

        The length limit parameter is for testing with a known value.
        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_startZdeleterZundo_block_stopZsee)	rZeventÚ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)	z»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.
    Ú.z%d.0z%d.endú<réNr)ÚmaprÚsplitrZcompareÚis_all_whiterÚlen)
rZmarkÚlinenoÚcolÚlineZfirst_linenor Zcomment_header_lenrrr	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)z3Return data reformatted to specified width (limit).Ú
rr(Nz(\s+)éú )r*r,r+Ú
get_indentÚreÚrangeÚ
expandtabsÚappendÚrstripÚextendÚjoin)rrÚlinesÚiÚnZindent1Zindent2ÚnewÚpartialZwordsÚjZwordr	r	r
rrs<% 
*rcs¸tˆƒ‰dj‡fdd†|jdƒDƒƒ}t|tˆƒdƒ}t||ƒ}|jdƒ}d}|d	s”d}|dd
…}dj‡fdd†|Dƒƒ|S)z?Return data reformatted to specified width with comment header.r0c3s|]}|ˆd…VqdS)Nr	)Ú.0r/)Úlcr	r
ú	<genexpr>›sz#reformat_comment.<locals>.<genexpr>éÚr(Nc3s|]}ˆ|VqdS)Nr	)rAr/)r r	r
rCªséÿÿÿÿrF)r,r:r*Úmaxr)rrr Zformat_widthr!Zblock_suffixr	)r rBr
r–s+
rcCstjd|ƒdk	S)z/Return True if line is empty or all whitespace.z^\s*$N)r4Úmatch)r/r	r	r
r+¬sr+cCstjd|ƒjƒS)z/Return the initial space or tab indent of line.z	^([ \t]*))r4rHÚgroup)r/r	r	r
r3±sr3cCs/tjd|ƒ}|dkr"dS|jdƒS)aReturn 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.
    z^([ \t]*#*)NrEr()r4rHrI)r/Úmr	r	r
rµsrÚ__main__z&idlelib.idle_test.test_formatparagraphÚ	verbosityr1ÚexitF)Ú__doc__r4Zidlelib.configHandlerrrrrrr+r3rr#ZunittestÚmainr	r	r	r
Ú<module>s8%$