%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyc

�
���Uc@sxddlZddlZddlZddlZdZdZdZdfd��YZd�Ze	dkrte�ndS(	i����NiiitPrettyTablecBsmeZdedddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	d
dd�Zd
�Z
dd�Zd�Zd�Zdddeeeded�Zdddeeeded�Zded�Zdeed�Zdeed�Zddddeeeeedd�
Zddddeeeeedd�
Zd�Zd�ZRS(icCs�g|_|r|j|�ng|_g|_|j|�g|_i|_i|_t|_	||_
||_||_||_
d|_d|_d|_dS(s�Return a new PrettyTable instance

        Arguments:

        fields - list or tuple of field names
        caching - boolean value to turn string caching on/off
        padding width - number of spaces between column lines and contentt|t-t+N(tfieldstset_field_namestwidthstalignstset_padding_widthtrowstcachet
html_cachetFRAMEthrulestcachingt
padding_widthtleft_paddingt
right_paddingt
vertical_charthorizontal_chart
junction_char(tselfRRRRR((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt__init__+s"			
										cCs&tj|�}|j||!|_|S(s�Return a new PrettyTable whose data rows are a slice of this one's

        Arguments:

        i - beginning slice index
        j - ending slice index(tcopytdeepcopyR	(Rtitjtnewtable((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt__getslice__Ks	cCs
|j�S(N(t
get_string(R((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt__str__XscCs�|jr�g|D]}t|�^q|_x�|jD]i}x`tdt|��D]I}tt||��|j|krQtt||��|j|<qQqQWq5Wn"g|D]}t|�^q�|_||_t|�dg|_i|_i|_dS(s^Set the names of the fields

        Arguments:

        fields - list or tuple of field namesitcN(	RtlenRR	trangetunicodeRR
R(RRtfieldtrowR((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR`s	"#+"		cCsp||jkr"td|��n|dkrAtd|��n||j|jj|�<i|_i|_dS(s�Set the alignment of a field by its fieldname

        Arguments:

        fieldname - name of the field whose alignment is to be changed
        align - desired alignment - "l" for left, "c" for centre and "r" for rightsNo field %s exists!tlRtrs'Alignment %s is invalid, use l, c or r!N(R%RR&(Rt	ExceptionRtindexR
R(Rt	fieldnametalign((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytset_field_alignxs		cCseyt|�dkst�Wn'tk
rEtdt|���nX||_i|_i|_dS(s�Set the number of empty spaces between a column's edge and its content

        Arguments:

        padding_width - number of spaces, must be a positive integeris$Invalid value for padding_width: %s!N(tinttAssertionErrorR'R"RR
R(RR((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR�s
		cCsqy(|dks't|�dks't�Wn'tk
rQtdt|���nX||_i|_i|_dS(s�Set the number of empty spaces between a column's left edge and its content

        Arguments:

        left_padding - number of spaces, must be a positive integeris#Invalid value for left_padding: %s!N(tNoneR,R-R'R"RR
R(RR((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytset_left_padding�s(
		cCsqy(|dks't|�dks't�Wn'tk
rQtdt|���nX||_i|_i|_dS(s�Set the number of empty spaces between a column's right edge and its content

        Arguments:

        right_padding - number of spaces, must be a positive integeris$Invalid value for right_padding: %s!N(R.R,R-R'R"RR
R(RR((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytset_right_padding�s(
		RRRcCsmt|�dks6t|�dks6t|�dkrEtd��n||_||_||_i|_dS(s;Set the characters to use when drawing the table border

        Arguments:

        vertical - character used to draw a vertical line segment.  Default is |
        horizontal - character used to draw a horizontal line segment.  Default is -
        junction - character used to draw a line junction.  Default is +is4All border characters must be strings of length ONE!N(R R'RRRR
(Rtverticalt
horizontaltjunction((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytset_border_chars�s
6			cCs�t|�t|j�krCtdt|�t|j�f��n|jj|�x`tdt|��D]I}tt||��|j|kritt||��|j|<qiqiWi|_dS(s�Add a row to the table

        Arguments:

        row - row of data, should be a list with as many elements as the table
        has fieldss>Row has incorrect number of values, (actual) %d!=%d (expected)iN(	R RR'R	tappendR!R"RR(RR$R((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytadd_row�s	(#$RcCsIt|j�dt|�fkr |d
kr@td|��n|jj|�|jjt|��|jj|�x�tdt|��D]�}t|j�|dkr�|jjg�n|j|j||�tt||��|jdkr�tt||��|jd<q�q�Wn%tdt|�t|j�f��d	S(s@Add a column to the table.

        Arguments:

        fieldname - name of the field to contain the new column of data
        column - column of data, should be a list with as many elements as the
        table has rows
        align - desired alignment for this column - "l" for left, "c" for centre and "r" for rightiR%RR&s'Alignment %s is invalid, use l, c or r!ii����s2Column length %d does not match number of rows %d!N(R%RR&(	R R	R'RR5RRR!R"(RR)tcolumnR*R((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt
add_column�s!#'cCs�tj|j||!�}|jj|�}g|D]}||g|^q2}|jd|�g|D]}|d^qf}|S(Ntreversei(RRR	RR(tsort(RtstarttendtsortbytreversesortR	t	sortindexR$((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt_get_sorted_rowss$cCsR|jdk	r|j}n	|j}|jdk	r?|j}n	|j}||fS(N(RR.RR(Rtlpadtrpad((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt
_get_paddingss		ic			Cs'|j||||||||�GHdS(s1Print table in current state to stdout.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        sortby - name of field to sort rows by
        reversesort - True or False to sort in descending or ascending order
        border - should be True or False to print or not print borders
        hrules - controls printing of horizontal rules after each row.  Allowed values: FRAME, ALL, NONEN(R(	RR;R<RtheadertborderR
R=R>((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytprinttsc		Cs�|jrMtj||||||||f�}	|	|jkrM|j|	Sn|pY|j}
g}|jsodS|s|j}dgt|j�|_xw|jD]i}
x`t	dt|
��D]I}tt
|
|��|j|kr�tt
|
|��|j|<q�q�Wq�Wn|r7|j|j|||��n.|re|t
kre|j|j||��n|r�|j||||�}n|j||!}x-|D]%}
|j|j|
|||
��q�W|r�|
r�|j|j||��ndj|�}|jr||j|	<n|s�||_xw|jD]i}
x`t	dt|
��D]I}tt
|
|��|j|krLtt
|
|��|j|<qLqLWq0Wn|S(sAReturn string representation of table in current state.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        sortby - name of field to sort rows by
        reversesort - True or False to sort in descending or ascending order
        border - should be True or False to print or not print borders
        hrules - controls printing of horizontal rules after each row.  Allowed values: FRAME, ALL, NONEtis
(RtcPickletdumpsR
R
RRR R	R!R"R5t_stringify_headertNONEt_stringify_hruleR@t_stringify_rowtjoin(RR;R<RRDRER
R=R>tkeythruletbitst
old_widthsR$RR	tstring((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR,sH	'	
#+
#
		#+c	Cs�|s
dS|j�\}}||}|jg}xct|j|j�D]L\}}|rl||krlqHn|j|||j�|j|j�qHWdj|�S(NRG(RCRtzipRRR5RRN(	RRRERARBRRQR#twidth((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyRLfs
"c	Cs+|j�\}}g}|rf|tkrS|j|j||��|jd�n|j|j�nxzt|j|j�D]c\}}|r�||kr�q|n|jd||j|�d|�|r||j|j�q|q|W|r|tkr|jd�|j|j||��ndj	|�S(Ns
t RG(
RCRKR5RLRRTRRtcenterRN(	RRRER
RARBRQR#RU((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyRJts""&
cCs�|j�\}}g}|r1|j|j�nxt|j||j|j�D]�\}}	}
}|rz||krzqPn|dkr�|jd|t|	�j|
�d|�ng|dkr�|jd|t|	�j	|
�d|�n,|jd|t|	�j
|
�d|�|rP|j|j�qPqPW|rt|tkrt|jd�|j|j||��ndj
|�S(NR%RVR&s
RG(RCR5RRTRRRR"tljusttrjustRWtALLRLRN(RR$RRERPRARBRQR#tvalueRUR*((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyRM�s$1//,
cCs-|j|||||||||	|
�
GHdS(s�Print HTML formatted version of table in current state to stdout.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        sortby - name of field to sort rows by
        format - should be True or False to attempt to format alignmet, padding, etc. or not
        header - should be True or False to print a header showing field names or not
        border - should be True or False to print or not print borders
        hrules - include horizontal rule after each row
        attributes - dictionary of name/value pairs to include as HTML attributes in the <table> tagN(tget_html_string(RR;R<RR=R>tformatRDRER
t
attributes((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt
print_html�scCs�|jrStj|||||||	|||
f
�}||jkrS|j|Sn|re|j}n	|j}|||||||||	|
�	}
|jr�|
|j|<n|
S(s'Return string representation of HTML formatted version of table in current state.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        sortby - name of 
        border - should be True or False to print or not print borders
        format - should be True or False to attempt to format alignmet, padding, etc. or not
        header - should be True or False to print a header showing field names or not
        border - should be True or False to print or not print borders
        hrules - include horizontal rule after each row
        attributes - dictionary of name/value pairs to include as HTML attributes in the <table> tag(RRHRIRt_get_formatted_html_stringt_get_simple_html_string(RR;R<RR=R>R]RDRER
R^ROt
tmp_html_funcRS((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR\�s	-	$	c
Cs�g}
d}|r|d7}n|	rQx)|	D]}|d||	|f7}q,Wn|d7}|
j|�|
jd�xI|jD]>}
|r�|
|kr�qn|
jdtjt|
���qW|
jd�|r�|jt|||�}n	|j}xy|jD]n}|
jd�xXt|j|�D]D\}
}|rL|
|krLq(n|
jdtjt|���q(WqW|
jd�|
jd	�d
j	|
�}|S(Ns<tables border="1"s %s="%s"t>s    <tr>s        <th>%s</th>s	    </tr>s        <td>%s</td>s</table>s
(
R5RtcgitescapeR"R@tstardR	RTRN(RR;R<RR=R>RDRER
R^RQt	table_tagt	attr_nameR#R	R$tdatumRS((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyRa�s8




$
	
(

c

Cs`g}
d}|r|d7}n|tkr8|d7}n|	rjx)|	D]}|d||	|f7}qEWn|d7}|
j|�|j�\}
}|r|
jd�xR|jD]G}|r�||kr�q�n|
jd|
|tjt|��f�q�W|
jd�n|r,|j||||�}n	|j}x�|jD]�}|
jd�x�t	|j|j
|�D]�\}}}|r�||kr�qkn|d	kr�|
jd
|
|tjt|��f�qk|dkr|
jd|
|tjt|��f�qk|
jd
|
|tjt|��f�qkWq?W|
jd�|
jd�dj|
�}|S(Ns<tables border="1"s frame="vsides" rules="cols"s %s="%s"Rcs    <tr>sW        <th style="padding-left: %dem; padding-right: %dem; text-align: center">%s</th>s	    </tr>R%sU        <td style="padding-left: %dem; padding-right: %dem; text-align: left">%s</td>R&sV        <td style="padding-left: %dem; padding-right: %dem; text-align: right">%s</td>sW        <td style="padding-left: %dem; padding-right: %dem; text-align: center">%s</td>s</table>s
(RKR5RCRRdReR"R@R	RTRRN(RR;R<RR=R>RDRER
R^RQRgRhRARBR#R	R$R*RiRS((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR`�sH





-	
(,,1

N(t__name__t
__module__R.tTrueRRRRR+RR/R0R4R6R8R@RCRtFalseRFRRLRJRMR_R\RaR`(((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyR)s, 	
									!!:''!	$cCs#tddddg�}|jdd�|jdddd	g�|jd
ddd
g�|jddddg�|jddddg�|jddddg�|jddddg�|jddd d!g�|GHttj�d"krtjd"d#krd$GH|jd%ddg�d&GH|jd'd(d)d*�d+GHd,GH|jd-t�d.GH|jd-t�d/GH|jd-t	�d0GH|jd1t
�|jd1t
d2t
�d3GH|jd2t
�d4GH|jd5d�|jd5d�|jd5dd6t�d7GH|jd8�|j�|jd*�|j�|j
d*�|jd8�|j�|jd9�|j�|j
d�|jd�|jd(�d:GH|jd;d;d;�|j�|jd<d=d>�|j�|jd?d@dA�dBGH|jd'd(d)d*d%ddgd2t
d-t�dCGHt�}|jddd
dddddg�|jddddddddDg�|jdddddddd g�|jdd	d
ddddd!g�|j�dEGH|j�|jd2t
�|jd2t�|jdFt
�|jdGidHdI6dHdJ6�ndS(KNs	City nametAreat
PopulationsAnnual RainfallR%tAdelaideiis�gĂ@tBrisbaneii:Xg������@tDarwinipiD�g�����ʚ@tHobartiMi�"g\�@tSydneyi
i�*Bg33333��@t	Melbourneii�:g333337�@tPerthi
iQ�g33333+�@ittestsTesting field subset selection:RsTesting row subset selection:R;iR<isTesting hrules settings:sFRAME:R
sALL:sNONE:sTesting lack of headers:RDREsTesting lack of borders:sTesting sorting:R=R>sTesting padding parameter:iisTesting changing characterst*t!t~toRRRsTesting everything at once:sRebuilding by columns:i	s
Testing HTML:R]R^ttabletnametid(RR+R6R tsystargvRFRRZRKRmRlRR/R0R.R4R8R_(tx((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pytmain&s�(













.	%%%%

t__main__(
RdRRHRRRZRKRR�Rj(((s=/opt/alt/python27/lib/python2.7/site-packages/lprettytable.pyt<module> s��	I

Zerion Mini Shell 1.0