Viewing File: /usr/lib/python2.7/site-packages/prettytable.pyo


F`Qc@sdZddlZddlZddlZddlZddlZddlZddlZddlZej	ddkZ
e
reZeZ
eZeZeZddlmZn(ejZejZeZddlmZe
oej	ddkrddlmZnddlmZdZdZdZdZd	Z d
Z!dZ"dZ#ej$d
Z%dZ&de'fdYZ(dZ)dZ*e+dZ,dZ-defdYZ.dZ/dZ0dZ1e2dkre1ndS(s0.7.2iNii(t
HTMLParserii(tescapei
iiis\[[0-9;]*mcCsJ|jd}t|}tg|D]}t|^q%}||fS(Ns
(tsplittlentmaxt_str_block_width(ttexttlinestheighttlinetwidth((s//usr/lib/python2.7/site-packages/prettytable.pyt	_get_sizeLs%tPrettyTablecBs-eZdgdZdZdZdZdZerHdZ	n	dZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZeeeZdZdZ eee Z!dZ"dZ#ee"e#Z$dZ%dZ&ee%e&Z'd Z(d!Z)ee(e)Z*d"Z+d#Z,ee+e,Z-d$Z.d%Z/ee.e/Z0d&Z1d'Z2ee1e2Z3d(Z4d)Z5ee4e5Z6d*Z7d+Z8ee7e8Z9d,Z:d-Z;ee:e;Z<d.Z=d/Z>ee=e>Z?d0Z@d1ZAee@eAZBd2ZCd3ZDeeCeDZEd4ZFd5ZGeeFeGZHd6ZId7ZJeeIeJZKd8ZLd9ZMeeLeMZNd:ZOd;ZPeeOePZQd<ZRd=ZSeeReSZTd>ZUd?ZVeeUeVZWd@ZXdAZYeeXeYZZdBZ[dCZ\ee[e\Z]dDZ^dEZ_ee^e_Z`dFZadGZbeeaebZcdHZddIZeeedeeZfdJZgdKZheegehZidLZjdMZkdNZldOZmdPZndQZodRZpdSZqdTdUdVZrdWZsdXZtdYZudZZvd[Zwd\Zxd]Zyd^Zzd_Z{d`Z|daZ}dbZ~dcZddZdeZdfZRS(hcKs |jdd|_g|_i|_i|_i|_g|_|rT||_n	g|_dj	|_
|j
jdj	|j
jdj	x>|j
D]3}||kr|j|||qd#||<qW|dpd|_|dpd#|_|d	pd#|_|d
ttfkr8|d
|_n	t|_|dpNd#|_|dttfkrz|d|_n	t|_|d
pt|_|dpt|_|dpd#|_|dttfkr|d|_n	t|_|dpd|_|dpi|_|dp!i|_|dp4d|_|dpGd#|_ |dpZd#|_!|dpv|j"d|_#|dp|j"d|_$|dp|j"d|_%|dttfkr|d|_&n	t|_&|d pt|_'|d!pt|_(|d"pi|_)d#S($sReturn a new PrettyTable instance

        Arguments:

        encoding - Unicode encoding scheme used to decode any encoded input
        field_names - list or tuple of field names
        fields - list or tuple of field names to include in displays
        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)
        header - print a header showing field names (True or False)
        header_style - stylisation to apply to field names in header ("cap", "title", "upper", "lower" or None)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: FRAME, HEADER, ALL, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        vertical_char - single character string used to draw vertical lines
        horizontal_char - single character string used to draw horizontal lines
        junction_char - single character string used to draw line junctions
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        valign - default valign for each row (None, "t", "m" or "b")
        reversesort - True or False to sort in descending or ascending ordertencodingsUTF-8sZstart end fields header border sortby reversesort sort_key attributes format hrules vrulessLint_format float_format padding_width left_padding_width right_padding_widthsQvertical_char horizontal_char junction_char header_style valign xhtml print_emptytstartitendtfieldstheadertheader_styletborderthrulestvrulestsortbytreversesorttsort_keycSs|S(N((tx((s//usr/lib/python2.7/site-packages/prettytable.pyt<lambda>st
int_formattfloat_formatt
padding_widthitleft_padding_widthtright_padding_widtht
vertical_chart|thorizontal_chart-t
junction_chart+tprint_emptytformattxhtmlt
attributesN(*tgetR
t_field_namest_alignt_valignt
_max_widtht_rowstfield_namest_widthsRt_optionstextendt_validate_optiontNonet_startt_endt_fieldstTruetFalset_headert
_header_stylet_bordertFRAMEt_hrulestALLt_vrulest_sortbyt_reversesortt	_sort_keyt_int_formatt
_float_formatt_padding_widtht_left_padding_widtht_right_padding_widtht_unicodet_vertical_chart_horizontal_chart_junction_chart_print_emptyt_formatt_xhtmlt_attributes(tselfR0tkwargstoption((s//usr/lib/python2.7/site-packages/prettytable.pyt__init__Ts^										cCsIt|tst|}nt|tsEt||jd}n|S(Ntstrict(t
isinstancet
basestringtstrtunicodeR
(RRtvalue((s//usr/lib/python2.7/site-packages/prettytable.pyRJs
cCs|t|}|dkr(||dS|dkr@|d|S|drt|drz|dd||dddS|ddd||ddSn|dd||ddSdS(Ntlt trii(R(RRRR
taligntexcess((s//usr/lib/python2.7/site-packages/prettytable.pyt_justifys
 #cCsl|dkrt|jS|dkr\|jr;t|jS|jrUt|jdSdSnt|dS(Ntrowcounttcolcounti(RR/R+tAttributeError(RRtname((s//usr/lib/python2.7/site-packages/prettytable.pyt__getattr__s
	
	cCst}|j|_x2|jD]'}t|d|t|d|qWt|dt|dt|trxa|j|D]}|j|qWn<t|t	r|j|j|nt
dt||S(Nt_R,s0Index %s is invalid, must be an integer or slice(RR0R2tsetattrtgetattrRWtsliceR/tadd_rowtintt	ExceptionRY(RRtindextnewtattrtrow((s//usr/lib/python2.7/site-packages/prettytable.pyt__getitem__s	%cCs
|jS(N(t__unicode__(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt__str__scCs|jj|jS(N(RstencodeR
(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRtscCs
|jS(N(t
get_string(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRsscCs|dkr|j|n|dkr;|j||nb|d	krZ|j||nC|d
kry|j||n$|dkr|j||n|dkr|j||n|d
kr|j||n|dkr|j||n|dkr|j|n|dkr0|j	||nm|dkrO|j
||nN|dkrn|j||n/|dkr|j||nt
d|dS(NR0RRt	max_widthRRRR'RRRRRRRRR(R&RRRR R"R$R)sUnrecognised option: %s!(sstartsends	max_widths
padding_widthsleft_padding_widthsright_padding_widthsformat(sheadersbordersreversesortsxhtmlsprint_empty(s
vertical_charshorizontal_chars
junction_char(t_validate_field_namest_validate_nonnegative_intt_validate_field_namet_validate_functiont_validate_hrulest_validate_vrulest_validate_all_field_namest_validate_true_or_falset_validate_header_stylet_validate_int_formatt_validate_float_formatt_validate_single_chart_validate_attributesRm(RRRTtval((s//usr/lib/python2.7/site-packages/prettytable.pyR4s6cCs|jrIyWqItk
rEtdt|t|jfqIXn|jryWqtk
rtdt|t|jdfqXnyWntk
rtdnXdS(NsJField name list has incorrect number of values, (actual) %d!=%d (expected)isField names must be unique!(R+tAssertionErrorRmRR/(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyRxs	
,	
0
cCs(yWntk
r#tdnXdS(Ns;Invalid header style, use cap, title, upper, lower or None!(RRm(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyR0s
cCs,yWn!tk
r'td|nXdS(Ns'Alignment %s is invalid, use l, c or r!(RRm(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_validate_align6s
cCs,yWn!tk
r'td|nXdS(Ns-Alignment %s is invalid, use t, m, b or None!(RRm(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_validate_valign<s
cCs;yWn0tk
r6td||j|fnXdS(NsInvalid value for %s: %s!(RRmRJ(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRyBs
cCs,yWn!tk
r'td|nXdS(Ns-Invalid value for %s!  Must be True or False.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRHs
cCs<|dkrdSyWn!tk
r7td|nXdS(Nts8Invalid value for %s!  Must be an integer format string.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRNs
cCsK|dkrdSy|jd}Wn!tk
rFtd|nXdS(NRt.s5Invalid value for %s!  Must be a float format string.(RRRm(RRReRtbits((s//usr/lib/python2.7/site-packages/prettytable.pyRWs
cCs,yWn!tk
r'td|nXdS(Ns*Invalid value for %s!  Must be a function.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyR{ds
cCs,yWn!tk
r'td|nXdS(Ns:Invalid value for %s!  Must be ALL, FRAME, HEADER or NONE.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyR|js
cCs,yWn!tk
r'td|nXdS(Ns3Invalid value for %s!  Must be ALL, FRAME, or NONE.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyR}ps
cCs,yWn!tk
r'td|nXdS(NsInvalid field name: %s!(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRzvs
cCsIy%x|D]}|j||q
WWntk
rDtdnXdS(Ns)fields must be a sequence of field names!(RzRRm(RRReRR((s//usr/lib/python2.7/site-packages/prettytable.pyR~|s


cCs,yWn!tk
r'td|nXdS(Ns4Invalid value for %s!  Must be a string of length 1.(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRs
cCs(yWntk
r#tdnXdS(Ns4attributes must be a dictionary of name/value pairs!(RRm(RRReR((s//usr/lib/python2.7/site-packages/prettytable.pyRs
cCs|jS(N(R+(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_field_namesscCsg|D]}|j|^q}|jd||jrH|j}n||_|jr|rx1t||D] \}}|j||j|<qpWxT|D](}||jkr|jj|qqWn!x|jD]}d|j|<qW|jrd|rdx1t||D] \}}|j||j|<q
WxT|D](}||jkr5|jj|q5q5Wn!x|jD]}d|j|<qnWdS(NR0tctt(RJR4R+R,tziptpopR-(RRRRt	old_namestold_nametnew_nametfield((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_field_namess*"	
	

cCs|jS(N(R,(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_get_alignscCs2|j|x|jD]}||j|<qWdS(N(RR+R,(RRRR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_set_aligns
cCs|jS(N(R-(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_valignscCs2|j|x|jD]}||j|<qWdS(N(RR+R-(RRRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_valigns
cCs|jS(N(R.(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_max_widthscCs5|jd|x|jD]}||j|<qWdS(NRw(R4R+R.(RRRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_max_widthscCs|jS(sList or tuple of field names to include in displays

        Arguments:

        fields - list or tuple of field names to include in displays(R8(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_fieldsscCs|jd|||_dS(NR(R4R8(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_fieldsscCs|jS(s{Start index of the range of rows to print

        Arguments:

        start - index of first data row to include in output(R6(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_get_startscCs|jd|||_dS(NR(R4R6(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_set_startscCs|jS(sEnd index of the range of rows to print

        Arguments:

        end - index of last data row to include in output PLUS ONE (list slice style)(R7(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_endscCs|jd|||_dS(NR(R4R7(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_endscCs|jS(s_Name of field by which to sort rows

        Arguments:

        sortby - field name to sort by(RB(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_sortbyscCs|jd|||_dS(NR(R4RB(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_sortbyscCs|jS(sControls direction of sorting (ascending vs descending)

        Arguments:

        reveresort - set to True to sort by descending order, or False to sort by ascending order(RC(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_reversesortscCs|jd|||_dS(NR(R4RC(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_reversesortscCs|jS(sSorting key function, applied to data points before sorting

        Arguments:

        sort_key - a function which takes one argument and returns something to be sorted(RD(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_get_sort_key	scCs|jd|||_dS(NR(R4RD(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt
_set_sort_keyscCs|jS(sControls printing of table header with field names

        Arguments:

        header - print a header showing field names (True or False)(R;(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_headerscCs|jd|||_dS(NR(R4R;(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_headerscCs|jS(sControls stylisation applied to field names in header

        Arguments:

        header_style - stylisation to apply to field names in header ("cap", "title", "upper", "lower" or None)(R<(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_header_style!scCs|j|||_dS(N(RR<(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_header_style(s
cCs|jS(s~Controls printing of border around table

        Arguments:

        border - print a border around the table (True or False)(R=(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_border-scCs|jd|||_dS(NR(R4R=(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_border4scCs|jS(sControls printing of horizontal rules after rows

        Arguments:

        hrules - horizontal rules style.  Allowed values: FRAME, ALL, HEADER, NONE(R?(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_hrules9scCs|jd|||_dS(NR(R4R?(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_hrules@scCs|jS(sControls printing of vertical rules between columns

        Arguments:

        vrules - vertical rules style.  Allowed values: FRAME, ALL, NONE(RA(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_vrulesEscCs|jd|||_dS(NR(R4RA(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_vrulesLscCs|jS(sbControls formatting of integer data
        Arguments:

        int_format - integer format string(RE(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_int_formatQscCs%x|jD]}||j|<q
WdS(N(R+RE(RRRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_int_formatWscCs|jS(srControls formatting of floating point data
        Arguments:

        float_format - floating point format string(RF(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_float_format]scCs%x|jD]}||j|<q
WdS(N(R+RF(RRRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_float_formatcscCs|jS(sThe number of empty spaces between a column's edge and its content

        Arguments:

        padding_width - number of spaces, must be a positive integer(RG(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_padding_widthiscCs|jd|||_dS(NR(R4RG(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_padding_widthpscCs|jS(sThe number of empty spaces between a column's left edge and its content

        Arguments:

        left_padding - number of spaces, must be a positive integer(RH(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_left_padding_widthuscCs|jd|||_dS(NR(R4RH(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_left_padding_width|scCs|jS(sThe number of empty spaces between a column's right edge and its content

        Arguments:

        right_padding - number of spaces, must be a positive integer(RI(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_right_padding_widthscCs|jd|||_dS(NR(R4RI(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_right_padding_widthscCs|jS(sThe charcter used when printing table borders to draw vertical lines

        Arguments:

        vertical_char - single character string used to draw vertical lines(RK(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_vertical_charscCs,|j|}|jd|||_dS(NR (RJR4RK(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_vertical_charscCs|jS(sThe charcter used when printing table borders to draw horizontal lines

        Arguments:

        horizontal_char - single character string used to draw horizontal lines(RL(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_horizontal_charscCs,|j|}|jd|||_dS(NR"(RJR4RL(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_horizontal_charscCs|jS(sThe charcter used when printing table borders to draw line junctions

        Arguments:

        junction_char - single character string used to draw line junctions(RM(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_junction_charscCs,|j|}|jd|||_dS(NR (RJR4RM(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_junction_charscCs|jS(s~Controls whether or not HTML tables are formatted to match styling options

        Arguments:

        format - True or False(RO(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_formatscCs|jd|||_dS(NR'(R4RO(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_formatscCs|jS(sControls whether or not empty tables produce a header and frame or just an empty string

        Arguments:

        print_empty - True or False(RN(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_print_emptyscCs|jd|||_dS(NR&(R4RN(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_print_emptyscCs|jS(sA dictionary of HTML attribute name/value pairs to be included in the <table> tag when printing HTML

        Arguments:

        attributes - dictionary of attributes(RQ(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_attributesscCs|jd|||_dS(NR)(R4RQ(RRR((s//usr/lib/python2.7/site-packages/prettytable.pyt_set_attributesscCsfi}xY|jD]N}||krG|j|||||||<qt|d|||<qW|S(NRg(R2R4Ri(RRRStoptionsRT((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_optionsscCst|tkr|jnW|tkr2|jn>|tkrK|jn%|tkrd|jntddS(NsInvalid pre-set style!(	tDEFAULTt_set_default_styletMSWORD_FRIENDLYt_set_msword_stylet
PLAIN_COLUMNSt_set_columns_styletRANDOMt_set_random_styleRm(RRtstyle((s//usr/lib/python2.7/site-packages/prettytable.pyt	set_styles



cCs^t|_t|_t|_t|_d|_d|_d|_	d|_
d|_d|_dS(NiR!R#R%(
R9RRR>R?R@RARRRR R"R$(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRs									cCsCt|_t|_t|_d|_d|_d|_d|_dS(NiR!(	R9RRtNONER?RRRR (RR((s//usr/lib/python2.7/site-packages/prettytable.pyRs						cCs1t|_t|_d|_d|_d|_dS(Niii(R9RR:RRRR(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRs
				cCstjttf|_tjttf|_tjtttt	f|_
tjttt	f|_tjdd|_
tjdd|_tjd|_tjd|_tjd|_dS(Niis ~!@#$%^&*()_+|-=\{}[];':",./;<>?(trandomtchoiceR9R:RRR@R>tHEADERRR?RAtrandintRRR R"R$(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRscCs|jrLt|t|jkrLtdt|t|jfn|jsgtdt|D]}d|d^qk|_n|jjt|dS(sAdd 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)isField %diN(R+RRmtrangeR0R/tappendtlist(RRRqtn((s//usr/lib/python2.7/site-packages/prettytable.pyRk(s
	$(	6cCsI|t|jdkr;td|t|jfn|j|=dS(sDelete a row to the table

        Arguments:

        row_index - The index of the row you want to delete.  Indexing starts at 0.is4Cant delete row at index %d, table only has %d rows!N(RR/Rm(RRt	row_index((s//usr/lib/python2.7/site-packages/prettytable.pytdel_row7s"RRcCst|jdt|fkr|j||j||jj|||j|<||j|<xtdt|D]J}t|j|dkr|jjgn|j|j||q{Wn%t	dt|t|jfdS(sAdd 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 right
        valign - desired vertical alignment for new columns - "t" for top, "m" for middle and "b" for bottomiis2Column length %d does not match number of rows %d!N(
RR/RRR+RR,R-RRm(RRt	fieldnametcolumnR_tvalignti((s//usr/lib/python2.7/site-packages/prettytable.pyt
add_columnCs!



cCs
g|_dS(s?Delete all rows from the table but keep the current field namesN(R/(RR((s//usr/lib/python2.7/site-packages/prettytable.pyt
clear_rows\scCsg|_g|_g|_dS(sWDelete all rows and field names from the table, maintaining nothing but styling optionsN(R/R+R1(RR((s//usr/lib/python2.7/site-packages/prettytable.pytclearbs		cCs
tj|S(N(tcopytdeepcopy(RR((s//usr/lib/python2.7/site-packages/prettytable.pyRnscCst|tr?||jkr?|jd|j||}n?t|tr~||jkr~|jd|j||}n|j|S(Ns%%%sds%%%sf(RWRlRERJtfloatRF(RRRR[((s//usr/lib/python2.7/site-packages/prettytable.pyt
_format_valueus
!!c	Cs|dr3g|jD]}t|d^q}nt|jdg}x|D]}xt|D]}\}}|j|}||jkrt||tt|d|j|||<qct||t|d||<qcWqPW||_dS(NRi(	R+RRR0t	enumerateRwRtminR1(	RRtrowsRRtwidthsRqRnR[R((s//usr/lib/python2.7/site-packages/prettytable.pyt_compute_widths|s
)

4)cCsX|ddk	r|d}n
|d}|ddk	rD|d}n
|d}||fS(NRRR(R5(RRRtlpadtrpad((s//usr/lib/python2.7/site-packages/prettytable.pyt_get_padding_widthss



cCstj|j|d|d!}|dr|jj|d}g|D]}||g|^qH}|jd|dd|dg|D]}|d^q}n|S(	sReturn only those data rows that should be printed, based on slicing and sorting.

        Arguments:

        options - dictionary of option settings.RRRtreverseRtkeyRi(RRR/R+Rntsort(RRRRt	sortindexRq((s//usr/lib/python2.7/site-packages/prettytable.pyt	_get_rowss!
$ cCs5gt|j|D]\}}|j||^qS(N(RR+R(RRRqRRR[((s//usr/lib/python2.7/site-packages/prettytable.pyt_format_rowscCs#g|D]}|j||^qS(N(R(RRRRRq((s//usr/lib/python2.7/site-packages/prettytable.pyt_format_rowsscKsD|j|}g}|jdkr>|ds:|dr>dS|j|}|j||}|j|||j||_|dr|j|j|n3|dr|dt	t
fkr|j|jnx'|D]}|j|j||qW|dr.|dt
kr.|j|jn|jdj
|S(s"Return 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
        header - print a header showing field names (True or False)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: ALL, FRAME, HEADER, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        vertical_char - single character string used to draw vertical lines
        horizontal_char - single character string used to draw horizontal lines
        junction_char - single character string used to draw line junctions
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        reversesort - True or False to sort in descending or ascending order
        print empty - if True, stringify just the header for an empty table, if False return an empty string iR&RRRRs
(RRbRRRt_stringify_hrulet_hruleRt_stringify_headerR@R>t_stringify_rowRJtjoin(RRRSRRRtformatted_rowsRq((s//usr/lib/python2.7/site-packages/prettytable.pyRvs"%
 
cCsP|dsdS|j|\}}|dttfkrI|dg}n
|dg}|js}|j|ddj|Sxt|j|jD]~\}}|dr||dkrqn|j||||d|dtkr|j|dq|j|dqW|dtkrC|j|j|dndj|S(NRRRR$R"R(	RR@R>R+RRRR1R(RRRRRRRR
((s//usr/lib/python2.7/site-packages/prettytable.pyRs(

	
"
c	Csg}|j|\}}|dr|dttfkr[|j|j|jdn|dttfkr|j|dq|jdn|js|dttfkr|j|dq|jdnx2t|j|jD]\}}|dr||dkrqn|jdkr8|j	}n`|jd	krV|j
}nB|jd
krt|j}n$|jdkr|j}n|}|jd||j
|||j|d||dr|dtkr|j|dq	|jdqqW|drE|dtkrE|j|j|dn|dr|dtkr|jd|j|jndj|S(
NRRs
RR R]RtcapttitletuppertlowerR(RR@R>RRR+RR1R<t
capitalizeRRRRaR,RRR(RRRRRRRR
R((s//usr/lib/python2.7/site-packages/prettytable.pyRsJ
	"3


c
Csxttdt||j||jD]\}}}}|jd}g}xB|D]:}	t|	|krtj|	|}	n|j	|	qYW|}dj
|}|||<q+Wd}
x3|D]+}t|d}||
kr|}
qqWg}
|j|\}}xotd|
D]^}|
j	g|dr!|dt
tfkrk|
|j	|jq|
|j	dq!q!Wxt|j||jD]u\}}}|j|}|jd}|
t|}|rT|dkr dgt|d	|dg|t|d	}qT|d
kr@dg||}qT|dg|}nd}x|D]}|dr||dkrqan|
|j	d||j|||j|d||dr|dt
kr|
|j	|jq|
|j	dn|d7}qaWqWxWtd|
D]F}|dr%|dtkr%|
|j|
|j	|dq%q%W|dr|d
t
kr|
|
dj	d|
|
dj	|jnx.td|
D]}dj
|
||
|<qWdj
|
S(Nis
iRRR]tmRitbRR R(RRRR+R1RRttextwraptfillRRRRR@R>R R-RlRaR,RR(RRRqRRnRR[R
Rt	new_linesR	t
row_heightRthRRRtyRtdHeightR\((s//usr/lib/python2.7/site-packages/prettytable.pyR:sj=




(
7
7
cKs>|j|}|dr+|j|}n|j|}|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
        header - print a header showing field names (True or False)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: ALL, FRAME, HEADER, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        attributes - dictionary of name/value pairs to include as HTML attributes in the <table> tag
        xhtml - print <br/> tags if True, <br> tags if falseR'(Rt_get_formatted_html_stringt_get_simple_html_string(RRRSRtstring((s//usr/lib/python2.7/site-packages/prettytable.pytget_html_strings

cCsg}|drd}nd}g}|jd|drsx4|dD]%}|jd||d|fqGWn|jd|jdj||d	r|jd
xT|jD]I}|dr||dkrqn|jdt|jd
|qW|jdn|j|}|j||}x|D]}	|jd
xct|j|	D]O\}}
|dr||dkrqbn|jdt|
jd
|qbW|jdq<W|jd|jd
j|S(NR(s<br/>s<br>s<tableR)s %s="%s"t>RRs    <tr>Rs        <th>%s</th>s
s	    </tr>s        <td>%s</td>s</table>(	RRR+RtreplaceRRRRJ(RRRRt	linebreaktopen_tagt	attr_nameRRRRqtdatum((s//usr/lib/python2.7/site-packages/prettytable.pyRs:
	

&


'

'
cCsg}|j|\}}|dr.d}nd}g}|jd|drd|dtkr|dtkr|jdqd|dtkr|dtkr|jd	qd|dtkr|dtkr|jd
qd|dtkr|jdqd|dtkr!|jdqd|dtkrA|jd
qd|dtkrd|jdqdn|drx4|dD]%}|jd||d|fqyWn|jd|jdj||drO|jdx]|jD]R}|dr||dkrqn|jd||t|jd|fqW|jdn|j|}	|j	|	|}
g}g}xk|jD]`}|jidd6dd6dd6|j
||jidd 6d!d"6d#d$6|j|qWx|
D]}
|jdx~t|j|
||D]d\}}}}|drO||dkrOqn|jd%||||t|jd|fqW|jdqW|jd&|j
dj|S('NR(s<br/>s<br>s<tableRRRs frame="box" rules="all"s frame="box"s frame="box" rules="cols"s frame="hsides"s frame="hsides" rules="rows"s frame="vsides"s frame="vsides" rules="cols"R)s %s="%s"RRRs    <tr>RsW        <th style="padding-left: %dem; padding-right: %dem; text-align: center">%s</th>s
s	    </tr>tleftR\trightR^tcenterRttopRtmiddleRtbottomRsg        <td style="padding-left: %dem; padding-right: %dem; text-align: %s; vertical-align: %s">%s</td>s</table>(RRR@R>RR+RRRRR,R-RRJ(RRRRRRRRRRRRtalignstvalignsRqRR_R((s//usr/lib/python2.7/site-packages/prettytable.pyR
sd
	

   
&


0-1

+6
N(t__name__t
__module__R5RURJRaRfRrtpy3kRtRsR4RxRRRRyRRRR{R|R}RzR~RRRRtpropertyR0RRR_RRRRRRwRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRR"RRR$RRR'RRR&RRR)RRRRRRRkRRRRRRRRRRRRvRRRRRR
(((s//usr/lib/python2.7/site-packages/prettytable.pyRRs]																
							
																																																						
	
	
														=		/	L	 	(cCsd|kodknr dSd|ko7dknr@dSd|koWdknr`dStjt|ryd	Sd
|kodknsd|kod
knrdSd|kodknrdSd|kodknrdS|dkrdS|dkrd	SdS(Ni!i~iiNiiiiii@0i0i0i0ii`i0i>0iiii(ii(ii(tunicodedatat	combiningtuni_chr(tchar((s//usr/lib/python2.7/site-packages/prettytable.pyt_char_block_widths&8cCs(ttttttjd|S(NR(tsumtitermapR'tordt_retsub(R((s//usr/lib/python2.7/site-packages/prettytable.pyR/scKstjj|jd}|jdtj||}t|}|r[||_nYtrgt	|D]}|j
^qn|_n(g|j	D]}|j
^q|_x4|D],}|jg|D]}|j
^qqW|S(Nii(tcsvtSniffertsnifftreadtseektreaderRR0R!tnexttstripRk(tfpR0RStdialectR2ttableRRq((s//usr/lib/python2.7/site-packages/prettytable.pytfrom_csv7s
+(
*cKsd|jr`t|}g|jD]}|d^q|_x!|jD]}|j|qEW|SdS(Ni(tdescriptionRR0tfetchallRk(tcursorRSR7tcolRq((s//usr/lib/python2.7/site-packages/prettytable.pytfrom_db_cursorKs	#tTableHandlercBs>eZdZdZdZdZdZdZRS(cKsYtj|||_g|_g|_g|_d|_d|_d|_	t
|_dS(NiR(RRURSttablestlast_rowRt
max_row_widthR5tactivetlast_contentR:tis_last_row_header(RRRS((s//usr/lib/python2.7/site-packages/prettytable.pyRUVs
							cCs%||_|dkr!t|_ndS(Ntth(RBR9RD(RRttagtattrs((s//usr/lib/python2.7/site-packages/prettytable.pythandle_starttagas	cCs|dkr.|jj}|jj|n|dkr|jj|j|jft|jt|j|_g|_t	|_n|dkr|j
|j}|jj|g|_nd|_d|_
dS(NREttdttrR7R](sthRI(RCR4R@RRRDRRARR:tgenerate_tableR?R5RB(RRRFtstripped_contentR7((s//usr/lib/python2.7/site-packages/prettytable.pyt
handle_endtagfs			cCs|j|7_dS(N(RC(RRtdata((s//usr/lib/python2.7/site-packages/prettytable.pythandle_dataxscCst|j}x|jD]}t|d|jkr}|jt|d}x+td|D]}|djdq_Wn|dtkr|j|d|d|_	q|j
|dqW|S(sE
        Generates from a list of rows a PrettyTable object.
        iiR#(RRSRRRARRR9tmake_fields_uniqueR0Rk(RRRR7RqtappendsR((s//usr/lib/python2.7/site-packages/prettytable.pyRK{scCsoxhtdt|D]Q}xHt|dt|D]-}||||kr6||cd7<q6q6WqWdS(sB
        iterates over the row and make each field unique
        iit'N(RR(RRRRtj((s//usr/lib/python2.7/site-packages/prettytable.pyRPs (RR RURHRMRORKRP(((s//usr/lib/python2.7/site-packages/prettytable.pyR>Ts					cKs t|}|j||jS(s
    Generates a list of PrettyTables from a string of HTML code. Each <table> in
    the HTML becomes one PrettyTable object.
    (R>tfeedR?(t	html_codeRStparser((s//usr/lib/python2.7/site-packages/prettytable.pyt	from_htmls
cKs;t||}yWntk
r2tdnX|dS(sf
    Generates a PrettyTables from a string of HTML code which contains only a
    single <table>
    sDMore than one <table> in provided HTML code!  Use from_html instead.i(RWRRm(RURSR?((s//usr/lib/python2.7/site-packages/prettytable.pyt
from_html_ones
cCstddddg}d|_t|_d|jd<d|_d|jd<|jdd	d
dg|jdd
ddg|jddddg|jddddg|jddddg|jddddg|jd d!d"d#g|GHdS($Ns	City nametAreat
PopulationsAnnual Rainfallt04ds6.1fR\tAdelaideiisgĂ@tBrisbaneii:Xg@tDarwinipiDgʚ@tHobartiMi"g\@tSydneyi
i*Bg33333@t	Melbourneii:g333337@tPerthi
iQg33333+@(RRR9RRRR_Rk(R((s//usr/lib/python2.7/site-packages/prettytable.pytmains		
	
t__main__(3t__version__RR-RtretsysRt	itertoolsR#tversion_infoR!RYRZRXtmapR)RtiterziptchrR%thtml.parserRtimaptiziptunichrthtmlRtcgiR>R@RRRRRRtcompileR+RtobjectRR'RR5R8R=R>RWRXRcR(((s//usr/lib/python2.7/site-packages/prettytable.pyt<module> s`				!			B	
		
Back to Directory File Manager