AlkantarClanX12

Your IP : 3.135.205.231


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/formatter.cpython-33.pyc

�
��fR:c@s�dZddlZdZGdd�d�ZGdd�d�ZGdd�d�ZGd	d
�d
e�ZGdd�de�Zdd
d�Z	e
dkr�e	�ndS(uGeneric output formatting.

Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.

Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.
iNcBs�|EeZdZdZd'dd�Zdd�Zdd�Zdd	�Zd'd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#d$�Zd"d%d&�Zd'S((u
NullFormatteru=A formatter which does nothing.

    If the writer parameter is omitted, a NullWriter instance is created.
    No methods of the writer are called by NullFormatter instances.

    Implementations should inherit from this class if implementing a writer
    interface but don't need to inherit any implementation.

    cCs%|dkrt�}n||_dS(N(uNoneu
NullWriteruwriter(uselfuwriter((u./opt/alt/python33/lib64/python3.3/formatter.pyu__init__&suNullFormatter.__init__cCsdS(N((uselfu	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyu
end_paragraph*suNullFormatter.end_paragraphcCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_line_break+suNullFormatter.add_line_breakcOsdS(N((uselfuargsukw((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_hor_rule,suNullFormatter.add_hor_rulecCsdS(N((uselfuformatucounteru	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_label_data-suNullFormatter.add_label_datacCsdS(N((uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_flowing_data.suNullFormatter.add_flowing_datacCsdS(N((uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_literal_data/suNullFormatter.add_literal_datacCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuflush_softspace0suNullFormatter.flush_softspacecCsdS(N((uselfualign((u./opt/alt/python33/lib64/python3.3/formatter.pyupush_alignment1suNullFormatter.push_alignmentcCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyu
pop_alignment2suNullFormatter.pop_alignmentcCsdS(N((uselfux((u./opt/alt/python33/lib64/python3.3/formatter.pyu	push_font3suNullFormatter.push_fontcCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyupop_font4suNullFormatter.pop_fontcCsdS(N((uselfumargin((u./opt/alt/python33/lib64/python3.3/formatter.pyupush_margin5suNullFormatter.push_margincCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyu
pop_margin6suNullFormatter.pop_margincCsdS(N((uselfuspacing((u./opt/alt/python33/lib64/python3.3/formatter.pyuset_spacing7suNullFormatter.set_spacingcGsdS(N((uselfustyles((u./opt/alt/python33/lib64/python3.3/formatter.pyu
push_style8suNullFormatter.push_styleicCsdS(N((uselfun((u./opt/alt/python33/lib64/python3.3/formatter.pyu	pop_style9suNullFormatter.pop_stylecCsdS(N((uselfuflag((u./opt/alt/python33/lib64/python3.3/formatter.pyuassert_line_data:suNullFormatter.assert_line_dataN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__u
end_paragraphuadd_line_breakuadd_hor_ruleuadd_label_datauadd_flowing_datauadd_literal_datauflush_softspaceupush_alignmentu
pop_alignmentu	push_fontupop_fontupush_marginu
pop_marginuset_spacingu
push_styleu	pop_styleuassert_line_data(u
__locals__((u./opt/alt/python33/lib64/python3.3/formatter.pyu
NullFormatters&	u
NullFormattercBs|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd-d
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)d*�Zd(d+d,�Zd-S(.uAbstractFormatteru�The standard formatter.

    This implementation has demonstrated wide applicability to many writers,
    and may be used directly in most circumstances.  It has been used to
    implement a full-featured World Wide Web browser.

    cCsy||_d|_g|_g|_g|_d|_g|_d|_d|_	d|_
d|_d|_d|_
dS(Nii(uwriteruNoneualignualign_stacku
font_stackumargin_stackuspacingustyle_stackunospaceu	softspaceupara_enduparskipu
hard_breaku
have_label(uselfuwriter((u./opt/alt/python33/lib64/python3.3/formatter.pyu__init__Ks												uAbstractFormatter.__init__cCs�|js"|jj�d|_n|j|krg|jrg|jj||j�||_d|_nd|_|_|_d|_dS(Nii(	u
hard_breakuwriterusend_line_breaku
have_labeluparskipusend_paragraphunospaceupara_endu	softspace(uselfu	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyu
end_paragraphZs	
	uAbstractFormatter.end_paragraphcCsO|jp|js2|jj�d|_|_nd|_|_d|_dS(Nii(u
hard_breakupara_enduwriterusend_line_breaku
have_labeluparskipunospaceu	softspace(uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_line_breakes

u AbstractFormatter.add_line_breakcOs^|js|jj�n|jj||�d|_|_d|_|_|_|_dS(Nii(	u
hard_breakuwriterusend_line_breaku
send_hor_ruleunospaceu
have_labelupara_endu	softspaceuparskip(uselfuargsukw((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_hor_rulels
	uAbstractFormatter.add_hor_rulecCs�|js|jr#|jj�n|jsK|jj|rAdpDd�nt|t�ry|jj|j	||��n|jj|�d|_
|_|_|_d|_|_dS(Nii(
u
have_labelu
hard_breakuwriterusend_line_breakupara_endusend_paragraphu
isinstanceustrusend_label_datauformat_counterunospaceu	softspaceuparskip(uselfuformatucounteru	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_label_datass	u AbstractFormatter.add_label_datacCs�d}x�|D]�}|dkr0|d|}q
|dkrd|dkr�||j||�}q�q
|dkr�|dkr�||j||�}q�q
||}q
W|S(Nuu1u%duaAiuiI(u
format_letteruformat_roman(uselfuformatucounterulabeluc((u./opt/alt/python33/lib64/python3.3/formatter.pyuformat_counters
u AbstractFormatter.format_countercCsVd}xI|dkrQt|dd�\}}tt|�|�}||}q	W|S(Nuiii(udivmoduchruord(uselfucaseucounterulabeluxus((u./opt/alt/python33/lib64/python3.3/formatter.pyu
format_letter�suAbstractFormatter.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(Nuiuxucumuvuluduii
i	iiiuI(ui(udivmoduupper(	uselfucaseucounteruonesufivesulabeluindexuxus((u./opt/alt/python33/lib64/python3.3/formatter.pyuformat_roman�s&



uAbstractFormatter.format_romancCs�|s
dS|dd�j�}|dd�j�}dj|j��}|jr_|r_dS|sn|jr�|s�|js�d|_d|_ndS|js�d|}q�nd|_|_|_|_|_||_|j	j
|�dS(Niu ii����(uisspaceujoinusplitunospaceu	softspaceuparskipu
hard_breakupara_endu
have_labeluwriterusend_flowing_data(uselfudatauprespaceu	postspace((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_flowing_data�s$			%	u"AbstractFormatter.add_flowing_datacCsx|s
dS|jr&|jjd�n|dd�dk|_d|_|_|_|_|_|jj|�dS(Nu iu
ii����(	u	softspaceuwriterusend_flowing_datau
hard_breakunospaceupara_enduparskipu
have_labelusend_literal_data(uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyuadd_literal_data�s	%u"AbstractFormatter.add_literal_datacCsN|jrJd|_|_|_|_|_d|_|jjd�ndS(Niiu (u	softspaceu
hard_breakupara_enduparskipu
have_labelunospaceuwriterusend_flowing_data(uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuflush_softspace�s	%	u!AbstractFormatter.flush_softspacecCsX|rA||jkrA|jj|�||_|jj|�n|jj|j�dS(N(ualignuwriteru
new_alignmentualign_stackuappend(uselfualign((u./opt/alt/python33/lib64/python3.3/formatter.pyupush_alignment�s
	u AbstractFormatter.push_alignmentcCsc|jr|jd=n|jrF|jd|_}|jj|�nd|_|jjd�dS(Nii����i����(ualign_stackualignuwriteru
new_alignmentuNone(uselfualign((u./opt/alt/python33/lib64/python3.3/formatter.pyu
pop_alignment�s	
		uAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jrNd|_|_|_d|_|jjd�n|jr�|jd\}}}}	|tkr�|}n|tkr�|}n|tkr�|}n|tkr�|	}q�n||||f}|jj|�|jj	|�dS(Niiu i����(
u	softspaceu
hard_breakupara_endunospaceuwriterusend_flowing_datau
font_stackuAS_ISuappendunew_font(
uselfufontusizeuiubuttucsizeuciucbuctt((u./opt/alt/python33/lib64/python3.3/formatter.pyu	push_font�s$						uAbstractFormatter.push_fontcCsI|jr|jd=n|jr/|jd}nd}|jj|�dS(Nii����i����(u
font_stackuNoneuwriterunew_font(uselfufont((u./opt/alt/python33/lib64/python3.3/formatter.pyupop_font�s	
	uAbstractFormatter.pop_fontcCs]|jj|�dd�|jD�}|r@|r@|d}n|jj|t|��dS(NcSsg|]}|r|�qS(((u.0um((u./opt/alt/python33/lib64/python3.3/formatter.pyu
<listcomp>s	u1AbstractFormatter.push_margin.<locals>.<listcomp>ii����(umargin_stackuappenduwriteru
new_marginulen(uselfumarginufstack((u./opt/alt/python33/lib64/python3.3/formatter.pyupush_margins


uAbstractFormatter.push_margincCsb|jr|jd=ndd�|jD�}|r?|d}nd}|jj|t|��dS(NicSsg|]}|r|�qS(((u.0um((u./opt/alt/python33/lib64/python3.3/formatter.pyu
<listcomp>
s	u0AbstractFormatter.pop_margin.<locals>.<listcomp>i����i����(umargin_stackuNoneuwriteru
new_marginulen(uselfufstackumargin((u./opt/alt/python33/lib64/python3.3/formatter.pyu
pop_margins	

uAbstractFormatter.pop_margincCs||_|jj|�dS(N(uspacinguwriterunew_spacing(uselfuspacing((u./opt/alt/python33/lib64/python3.3/formatter.pyuset_spacings	uAbstractFormatter.set_spacingcGsz|jr<d|_|_|_d|_|jjd�nx|D]}|jj|�qCW|jjt	|j��dS(Niiu (
u	softspaceu
hard_breakupara_endunospaceuwriterusend_flowing_dataustyle_stackuappendu
new_stylesutuple(uselfustylesustyle((u./opt/alt/python33/lib64/python3.3/formatter.pyu
push_styles		
uAbstractFormatter.push_styleicCs.|j|d�=|jjt|j��dS(N(ustyle_stackuwriteru
new_stylesutuple(uselfun((u./opt/alt/python33/lib64/python3.3/formatter.pyu	pop_stylesuAbstractFormatter.pop_stylecCs,||_|_d|_|_|_dS(Ni(unospaceu
hard_breakupara_enduparskipu
have_label(uselfuflag((u./opt/alt/python33/lib64/python3.3/formatter.pyuassert_line_data"su"AbstractFormatter.assert_line_dataN(u__name__u
__module__u__qualname__u__doc__u__init__u
end_paragraphuadd_line_breakuadd_hor_ruleuNoneuadd_label_datauformat_counteru
format_letteruformat_romanuadd_flowing_datauadd_literal_datauflush_softspaceupush_alignmentu
pop_alignmentu	push_fontupop_fontupush_marginu
pop_marginuset_spacingu
push_styleu	pop_styleuassert_line_data(u
__locals__((u./opt/alt/python33/lib64/python3.3/formatter.pyuAbstractFormatter=s,	
	
	uAbstractFormattercBs�|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS(u
NullWriteruMinimal writer interface to use in testing & inheritance.

    A writer which only provides the interface definition; no actions are
    taken on any methods.  This should be the base class for all writers
    which do not need to inherit any implementation methods.

    cCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyu__init__/suNullWriter.__init__cCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuflush0suNullWriter.flushcCsdS(N((uselfualign((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_alignment1suNullWriter.new_alignmentcCsdS(N((uselfufont((u./opt/alt/python33/lib64/python3.3/formatter.pyunew_font2suNullWriter.new_fontcCsdS(N((uselfumarginulevel((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_margin3suNullWriter.new_margincCsdS(N((uselfuspacing((u./opt/alt/python33/lib64/python3.3/formatter.pyunew_spacing4suNullWriter.new_spacingcCsdS(N((uselfustyles((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_styles5suNullWriter.new_stylescCsdS(N((uselfu	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_paragraph6suNullWriter.send_paragraphcCsdS(N((uself((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_line_break7suNullWriter.send_line_breakcOsdS(N((uselfuargsukw((u./opt/alt/python33/lib64/python3.3/formatter.pyu
send_hor_rule8suNullWriter.send_hor_rulecCsdS(N((uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_label_data9suNullWriter.send_label_datacCsdS(N((uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_flowing_data:suNullWriter.send_flowing_datacCsdS(N((uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_literal_data;suNullWriter.send_literal_dataN(u__name__u
__module__u__qualname__u__doc__u__init__uflushu
new_alignmentunew_fontu
new_marginunew_spacingu
new_stylesusend_paragraphusend_line_breaku
send_hor_ruleusend_label_datausend_flowing_datausend_literal_data(u
__locals__((u./opt/alt/python33/lib64/python3.3/formatter.pyu
NullWriter'su
NullWritercBs�|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS(uAbstractWriteru�A writer which can be used in debugging formatters, but not much else.

    Each method simply announces itself by printing its name and
    arguments on standard output.

    cCstd|f�dS(Nunew_alignment(%r)(uprint(uselfualign((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_alignmentFsuAbstractWriter.new_alignmentcCstd|f�dS(Nunew_font(%r)(uprint(uselfufont((u./opt/alt/python33/lib64/python3.3/formatter.pyunew_fontIsuAbstractWriter.new_fontcCstd||f�dS(Nunew_margin(%r, %d)(uprint(uselfumarginulevel((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_marginLsuAbstractWriter.new_margincCstd|f�dS(Nunew_spacing(%r)(uprint(uselfuspacing((u./opt/alt/python33/lib64/python3.3/formatter.pyunew_spacingOsuAbstractWriter.new_spacingcCstd|f�dS(Nunew_styles(%r)(uprint(uselfustyles((u./opt/alt/python33/lib64/python3.3/formatter.pyu
new_stylesRsuAbstractWriter.new_stylescCstd|f�dS(Nusend_paragraph(%r)(uprint(uselfu	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_paragraphUsuAbstractWriter.send_paragraphcCstd�dS(Nusend_line_break()(uprint(uself((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_line_breakXsuAbstractWriter.send_line_breakcOstd�dS(Nusend_hor_rule()(uprint(uselfuargsukw((u./opt/alt/python33/lib64/python3.3/formatter.pyu
send_hor_rule[suAbstractWriter.send_hor_rulecCstd|f�dS(Nusend_label_data(%r)(uprint(uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_label_data^suAbstractWriter.send_label_datacCstd|f�dS(Nusend_flowing_data(%r)(uprint(uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_flowing_dataasu AbstractWriter.send_flowing_datacCstd|f�dS(Nusend_literal_data(%r)(uprint(uselfudata((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_literal_datadsu AbstractWriter.send_literal_dataN(u__name__u
__module__u__qualname__u__doc__u
new_alignmentunew_fontu
new_marginunew_spacingu
new_stylesusend_paragraphusend_line_breaku
send_hor_ruleusend_label_datausend_flowing_datausend_literal_data(u
__locals__((u./opt/alt/python33/lib64/python3.3/formatter.pyuAbstractWriter>suAbstractWritercBst|EeZdZdZdddd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS(u
DumbWriteru;Simple writer class which writes output on the file object passed in
    as the file parameter or, if file is omitted, on standard output.  The
    output is simply word-wrapped to the number of columns specified by
    the maxcol parameter.  This class is suitable for reflowing a sequence
    of paragraphs.

    iHcCs6|ptj|_||_tj|�|j�dS(N(usysustdoutufileumaxcolu
NullWriteru__init__ureset(uselfufileumaxcol((u./opt/alt/python33/lib64/python3.3/formatter.pyu__init__qs	
uDumbWriter.__init__cCsd|_d|_dS(Ni(ucoluatbreak(uself((u./opt/alt/python33/lib64/python3.3/formatter.pyuresetws	uDumbWriter.resetcCs*|jjd|�d|_d|_dS(Nu
i(ufileuwriteucoluatbreak(uselfu	blankline((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_paragraph{s	uDumbWriter.send_paragraphcCs&|jjd�d|_d|_dS(Nu
i(ufileuwriteucoluatbreak(uself((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_line_break�s	uDumbWriter.send_line_breakcOsM|jjd�|jjd|j�|jjd�d|_d|_dS(Nu
u-i(ufileuwriteumaxcolucoluatbreak(uselfuargsukw((u./opt/alt/python33/lib64/python3.3/formatter.pyu
send_hor_rule�s
	uDumbWriter.send_hor_rulecCsz|jj|�|jd�}|dkrKd|_||dd�}n|j�}|jt|�|_d|_dS(Nu
ii(ufileuwriteurfinducolu
expandtabsulenuatbreak(uselfudataui((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_literal_data�s	uDumbWriter.send_literal_datacCs�|s
dS|jp |dj�}|j}|j}|jj}xz|j�D]l}|r�|t|�|kr�|d�d}q�|d�|d}n||�|t|�}d}qNW||_|dj�|_dS(Niu
u ii����(uatbreakuisspaceucolumaxcolufileuwriteusplitulen(uselfudatauatbreakucolumaxcoluwriteuword((u./opt/alt/python33/lib64/python3.3/formatter.pyusend_flowing_data�s$		
	



	uDumbWriter.send_flowing_dataN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__uresetusend_paragraphusend_line_breaku
send_hor_ruleusend_literal_datausend_flowing_data(u
__locals__((u./opt/alt/python33/lib64/python3.3/formatter.pyu
DumbWriterhs
u
DumbWritercCs�t�}t|�}|dk	r0t|�}n2tjdd�rYttjd�}n	tj}x7|D]/}|dkr�|jd�qi|j|�qiW|jd�dS(Niu
i(	u
DumbWriteruAbstractFormatteruNoneuopenusysuargvustdinu
end_paragraphuadd_flowing_data(ufileuwufufpuline((u./opt/alt/python33/lib64/python3.3/formatter.pyutest�s		
utestu__main__(u__doc__usysuNoneuAS_ISu
NullFormatteruAbstractFormatteru
NullWriteruAbstractWriteru
DumbWriterutestu__name__(((u./opt/alt/python33/lib64/python3.3/formatter.pyu<module>s"�*C