Your IP : 3.15.10.117


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



���]';�@s�ddlZddlZejdedd�dZGdd�d�ZGdd�d�ZGd	d
�d
�ZGdd�de�ZGd
d�de�Z	ddd�Z
edkr�e
�dS)�Nz"the formatter module is deprecated�
stacklevel�c@s�eZdZddd�Zdd�Zdd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#d$�Zd"d%d&�ZdS)'�
NullFormatterNcCs"|dkrt�}||_dS)N)�
NullWriter�writer)�selfr�r�./opt/alt/python35/lib64/python3.5/formatter.py�__init__)s	zNullFormatter.__init__cCsdS)Nr)r�	blanklinerrr	�
end_paragraph-szNullFormatter.end_paragraphcCsdS)Nr)rrrr	�add_line_break.szNullFormatter.add_line_breakcOsdS)Nr)r�args�kwrrr	�add_hor_rule/szNullFormatter.add_hor_rulecCsdS)Nr)r�format�counterrrrr	�add_label_data0szNullFormatter.add_label_datacCsdS)Nr)r�datarrr	�add_flowing_data1szNullFormatter.add_flowing_datacCsdS)Nr)rrrrr	�add_literal_data2szNullFormatter.add_literal_datacCsdS)Nr)rrrr	�flush_softspace3szNullFormatter.flush_softspacecCsdS)Nr)r�alignrrr	�push_alignment4szNullFormatter.push_alignmentcCsdS)Nr)rrrr	�
pop_alignment5szNullFormatter.pop_alignmentcCsdS)Nr)r�xrrr	�	push_font6szNullFormatter.push_fontcCsdS)Nr)rrrr	�pop_font7szNullFormatter.pop_fontcCsdS)Nr)r�marginrrr	�push_margin8szNullFormatter.push_margincCsdS)Nr)rrrr	�
pop_margin9szNullFormatter.pop_margincCsdS)Nr)r�spacingrrr	�set_spacing:szNullFormatter.set_spacingcGsdS)Nr)r�stylesrrr	�
push_style;szNullFormatter.push_style�cCsdS)Nr)r�nrrr	�	pop_style<szNullFormatter.pop_stylecCsdS)Nr)r�flagrrr	�assert_line_data=szNullFormatter.assert_line_data)�__name__�
__module__�__qualname__r
rr
rrrrrrrrrrr r"r$r'r)rrrr	rs$rc@seZdZdd�Zdd�Zdd�Zdd�Zd	d
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)d*�Zd(d+d,�Zd	S)-�AbstractFormattercCsy||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS)Nr%r)
rr�align_stack�
font_stack�margin_stackr!�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_label)rrrrr	r
Ns												zAbstractFormatter.__init__cCs�|js|jj�d|_|j|kra|jra|jj||j�||_d|_d|_|_|_d|_dS)Nrr%)	r6r�send_line_breakr7r5�send_paragraphr2r4r3)rrrrr	r]s	
			zAbstractFormatter.end_paragraphcCsL|jp|js/|jj�d|_|_d|_|_d|_dS)Nrr%)r6r4rr8r7r5r2r3)rrrr	r
hs

z AbstractFormatter.add_line_breakcOs[|js|jj�|jj||�d|_|_d|_|_|_|_dS)Nr%r)	r6rr8�
send_hor_ruler2r7r4r3r5)rrrrrr	ros
	
zAbstractFormatter.add_hor_ruleNcCs�|js|jr |jj�|jsE|jj|r>dpAd�t|t�rs|jj|j	||��n|jj|�d|_
|_|_|_d|_|_dS)Nr%r)
r7r6rr8r4r9�
isinstance�str�send_label_data�format_counterr2r3r5)rrrrrrr	rvs
	z AbstractFormatter.add_label_datacCs�d}x�|D]�}|dkr0|d|}q
|dkra|dkr�||j||�}q
|dkr�|dkr�||j||�}q
||}q
W|S)N��1z%dZaArZiI)�
format_letter�format_roman)rrr�label�crrr	r>�s
z AbstractFormatter.format_countercCsVd}xI|dkrQt|dd�\}}tt|�|�}||}q	W|S)Nr?rr%�)�divmod�chr�ord)r�caserrCr�srrr	rA�szAbstractFormatter.format_letterc	Csddddg}dddg}d\}}x�|d	kr�t|d
�\}}|dkrz||||d|}nj|d
kr�|||||}nE|dkr�||}|d}nd}||||}||}|d}q0W|dkr|j�S|S)N�irrD�m�v�l�dr?r�
�	r%���I)r?r)rF�upper)	rrIrZonesZfivesrC�indexrrJrrr	rB�s&



zAbstractFormatter.format_romancCs�|s
dS|dd�j�}|dd�j�}dj|j��}|jr_|r_dS|sn|jr�|s�|js�d|_d|_dS|js�d|}d|_|_|_|_|_||_|j	j
|�dS)Nr%� r���)�isspace�join�splitr2r3r5r6r4r7r�send_flowing_data)rrZprespaceZ	postspacerrr	r�s$				
%	z"AbstractFormatter.add_flowing_datacCsu|s
dS|jr#|jjd�|dd�dk|_d|_|_|_|_|_|jj|�dS)NrWr%�
rrX)	r3rr\r6r2r4r5r7�send_literal_data)rrrrr	r�s	%z"AbstractFormatter.add_literal_datacCsK|jrGd|_|_|_|_|_d|_|jjd�dS)Nrr%rW)r3r6r4r5r7r2rr\)rrrr	r�s	%	z!AbstractFormatter.flush_softspacecCsX|rA||jkrA|jj|�||_|jj|�n|jj|j�dS)N)rr�
new_alignmentr.�append)rrrrr	r�s
	z AbstractFormatter.push_alignmentcCs`|jr|jd=|jrC|jd|_}|jj|�nd|_|jjd�dS)Nr%rXrX)r.rrr_)rrrrr	r�s	
		zAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jrKd|_|_|_d|_|jjd�|jr�|jd\}}}}	|tkr|}|tkr�|}|tkr�|}|tkr�|	}||||f}|jj|�|jj	|�dS)Nrr%rWrX)
r3r6r4r2rr\r/�AS_ISr`�new_font)
r�font�sizerK�b�ttZcsizeZci�cbZcttrrr	r�s$			zAbstractFormatter.push_fontcCsF|jr|jd=|jr,|jd}nd}|jj|�dS)Nr%rXrX)r/rrb)rrcrrr	r�s	
	zAbstractFormatter.pop_fontcCsZ|jj|�dd�|jD�}|r=|r=|d}|jj|t|��dS)NcSsg|]}|r|�qSrr)�.0rLrrr	�
<listcomp>s	z1AbstractFormatter.push_margin.<locals>.<listcomp>r%rX)r0r`r�
new_margin�len)rr�fstackrrr	rs


zAbstractFormatter.push_margincCs_|jr|jd=dd�|jD�}|r<|d}nd}|jj|t|��dS)Nr%cSsg|]}|r|�qSrr)rhrLrrr	ri
s	z0AbstractFormatter.pop_margin.<locals>.<listcomp>rXrX)r0rrjrk)rrlrrrr	r 
s	

zAbstractFormatter.pop_margincCs||_|jj|�dS)N)r!r�new_spacing)rr!rrr	r"s	zAbstractFormatter.set_spacingcGsw|jr9d|_|_|_d|_|jjd�x|D]}|jj|�q@W|jjt	|j��dS)Nrr%rW)
r3r6r4r2rr\r1r`�
new_styles�tuple)rr#�stylerrr	r$s		
zAbstractFormatter.push_styler%cCs.|j|d�=|jjt|j��dS)N)r1rrnro)rr&rrr	r'!szAbstractFormatter.pop_stylecCs,||_|_d|_|_|_dS)Nr)r2r6r4r5r7)rr(rrr	r)%sz"AbstractFormatter.assert_line_data)r*r+r,r
rr
rrr>rArBrrrrrrrrr r"r$r'r)rrrr	r-@s*	
	
	r-c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rcCsdS)Nr)rrrr	r
2szNullWriter.__init__cCsdS)Nr)rrrr	�flush3szNullWriter.flushcCsdS)Nr)rrrrr	r_4szNullWriter.new_alignmentcCsdS)Nr)rrcrrr	rb5szNullWriter.new_fontcCsdS)Nr)rr�levelrrr	rj6szNullWriter.new_margincCsdS)Nr)rr!rrr	rm7szNullWriter.new_spacingcCsdS)Nr)rr#rrr	rn8szNullWriter.new_stylescCsdS)Nr)rrrrr	r99szNullWriter.send_paragraphcCsdS)Nr)rrrr	r8:szNullWriter.send_line_breakcOsdS)Nr)rrrrrr	r:;szNullWriter.send_hor_rulecCsdS)Nr)rrrrr	r=<szNullWriter.send_label_datacCsdS)Nr)rrrrr	r\=szNullWriter.send_flowing_datacCsdS)Nr)rrrrr	r^>szNullWriter.send_literal_dataN)r*r+r,r
rqr_rbrjrmrnr9r8r:r=r\r^rrrr	r*src@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�AbstractWritercCstd|f�dS)Nznew_alignment(%r))�print)rrrrr	r_IszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r))rt)rrcrrr	rbLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d))rt)rrrrrrr	rjOszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r))rt)rr!rrr	rmRszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r))rt)rr#rrr	rnUszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r))rt)rrrrr	r9XszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break())rt)rrrr	r8[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule())rt)rrrrrr	r:^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r))rt)rrrrr	r=aszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r))rt)rrrrr	r\dsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r))rt)rrrrr	r^gsz AbstractWriter.send_literal_dataN)r*r+r,r_rbrjrmrnr9r8r:r=r\r^rrrr	rsAsrsc@sjeZdZdddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)�
DumbWriterN�HcCs6|ptj|_||_tj|�|j�dS)N)�sys�stdout�file�maxcolrr
�reset)rryrzrrr	r
ts	
zDumbWriter.__init__cCsd|_d|_dS)Nr)�col�atbreak)rrrr	r{zs	zDumbWriter.resetcCs*|jjd|�d|_d|_dS)Nr]r)ry�writer|r})rrrrr	r9~s	zDumbWriter.send_paragraphcCs&|jjd�d|_d|_dS)Nr]r)ryr~r|r})rrrr	r8�s	zDumbWriter.send_line_breakcOsM|jjd�|jjd|j�|jjd�d|_d|_dS)Nr]�-r)ryr~rzr|r})rrrrrr	r:�s
	zDumbWriter.send_hor_rulecCsw|jj|�|jd�}|dkrHd|_||dd�}|j�}|jt|�|_d|_dS)Nr]rr%)ryr~�rfindr|�
expandtabsrkr})rrrKrrr	r^�s	zDumbWriter.send_literal_datacCs�|s
dS|jp |dj�}|j}|j}|jj}xw|j�D]i}|r�|t|�|kr�|d�d}n|d�|d}||�|t|�}d}qNW||_|dj�|_dS)Nrr]rWr%rX)r}rYr|rzryr~r[rk)rrr}r|rzr~Zwordrrr	r\�s$		
	



	zDumbWriter.send_flowing_data)
r*r+r,r
r{r9r8r:r^r\rrrr	ruks	
rucCs�t�}t|�}|dk	r0t|�}n2tjdd�rYttjd�}n	tj}z>x7|D]/}|dkr�|jd�ql|j|�qlWWd|tjk	r�|j�X|jd�dS)Nr%r]r)	rur-�openrw�argv�stdinrr�close)ry�w�f�fp�linerrr	�test�s		
r��__main__)rw�warnings�warn�DeprecationWarningrarr-rrsrur�r*rrrr	�<module>s"�*C

?>