Your IP : 3.129.216.248


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



���]fL�@s�ddlZddddddgZdZGd	d�d�Zd
dd�Zd
dd�Zd
d�Zejdej�Z	ejdej�Z
dd�Zddd�Ze
dkr�eed��dS)�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c@skeZdZiZed�ZxeD]Zeeee�<q%WdZdZ	de
je�Zdedd�Z
e
jdd	ed
e	dede
ie
j�Z[[	[
e
jd
e�Z[e
jd�Zdddddddddddddddd�
Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS))r� z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        )Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF��	max_lines�placeholderz [...]c
Csp||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS)N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r�-/opt/alt/python35/lib64/python3.5/textwrap.py�__init__ss											zTextWrapper.__init__cCs:|jr|j|j�}|jr6|j|j�}|S)N)r�
expandtabsrr�	translate�unicode_whitespace_trans)r�textrrr�_munge_whitespace�s
		zTextWrapper._munge_whitespacecCsM|jdkr$|jj|�}n|jj|�}dd�|D�}|S)NTcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�s	z&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re)rr!�chunksrrr�_split�s
zTextWrapper._splitcCs|d}|jj}xc|t|�dkrw||ddkrj|||�rjd||d<|d7}q|d7}qWdS)Nrr	rz  �)�sentence_end_re�search�len)rr)�i�	patsearchrrr�_fix_sentence_endings�s	$
z!TextWrapper._fix_sentence_endingscCs{|dkrd}n
||}|jr^|j|dd|��|d|d�|d<n|sw|j|j��dS)Nr	���r2r2)r�append�pop)r�reversed_chunks�cur_line�cur_lenr�
space_leftrrr�_handle_long_word�s
	
	zTextWrapper._handle_long_wordc	CsPg}|jdkr(td|j��|jdk	r�|jdkrR|j}n	|j}t|�t|jj��|jkr�td��|j�x�|rKg}d}|r�|j}n	|j}|jt|�}|j	r|dj
�dkr|r|d=xK|rUt|d�}|||krQ|j|j��||7}qPqW|r�t|d	�|kr�|j
||||�ttt|��}|j	r�|r�|d
j
�dkr�|t|d�8}|d=|r�|jdksJt|�d|jksJ|s>|j	rgt|�dkrg|dj
�rg||krg|j|dj|��q�x�|r�|d
j
�r�|t|j�|kr�|j|j�|j|dj|��P|t|d�8}|d=qjW|r-|dj�}t|�t|j�|jkr-||j|d<P|j||jj��Pq�W|S)Nrzinvalid width %r (must be > 0)r	z#placeholder too large for max widthrr2r2r2r2r2r2r2r2r2r2r2r2)r�
ValueErrorrrrr.r�lstrip�reverser�stripr3r4r9�sum�map�join�rstrip)	rr)�linesrr6r7r�l�	prev_linerrr�_wrap_chunks�sp
	(
		%	
%		zTextWrapper._wrap_chunkscCs|j|�}|j|�S)N)r"r*)rr!rrr�
_split_chunksPszTextWrapper._split_chunkscCs2|j|�}|jr%|j|�|j|�S)N)rFrr1rE)rr!r)rrrrVs		
zTextWrapper.wrapcCsdj|j|��S)N�
)r@r)rr!rrrrdszTextWrapper.fill)�__name__�
__module__�__qualname__r �ord�uspace�_whitespace�xZ
word_punctZletter�re�escape�
whitespaceZnowhitespace�compile�VERBOSEr&r(r,rr"r*r1r9rErFrrrrrrrsH1
	!grcKstd||�}|j|�S)Nr)rr)r!r�kwargs�wrrrrps
cKstd||�}|j|�S)Nr)rr)r!rrTrUrrrr}s	cKs:td|dd|�}|jdj|j�j���S)Nrrr	r)rrr@r=r')r!rrTrUrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCsd}tjd|�}tj|�}x�|D]�}|dkrI|}q.|j|�r[q.|j|�rs|}q.x\tt||��D]/\}\}}||kr�|d|�}Pq�W|dt|��}q.Wdr�|r�x|jd�D]}q�W|rt	jd|d|�}|S)NrrrGz(?m)^)
�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr.r'rO)r!�margin�indentsrr/rN�y�linerrrr�s*
		(cs@�dkrdd�����fdd�}dj|��S)NcSs
|j�S)N)r=)r`rrr�	predicate�szindent.<locals>.predicatec3s9x2�jd�D]!}�|�r,�|n|VqWdS)NT)�
splitlines)r`)ra�prefixr!rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r@)r!rcrardr)rarcr!rr�s�__main__z Hello there.
  This is indented.)rO�__all__rMrrrrrR�	MULTILINErVrXrrrH�printrrrr�<module>s�`
5

?>