id`6ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlZdZdZdZdZd Zd Zd Zd Zd ZdZdZdZdZejdZdZ GddZ!dZ"d d!dZ#dZ$dZ%Gdde Z&dZ'dZ(dS)") annotationsN)escape) HTMLParser)Any base_align_valuez\033\[[0-9;]*m|\033\(Bc|d}t|}td|D}||fS)N c34K|]}t|VdSN_str_block_width.0lines L/opt/cloudlinux/venv/lib/python3.11/site-packages/prettytable/prettytable.py z_get_size..Is+994 &&999999)splitlenmax)textlinesheightwidths r _get_sizer&FsD JJt  E ZZF 995999 9 9E &=rcJ eZdZdddZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZeddZeddZedd!Zejd"Zed#Z e jd$Z ed%Z!e!jd&Z!ed'Z"e"jd(Z"ed)Z#e#jd*Z#ed+Z$e$jd,Z$ed-Z%e%jd.Z%ed/Z&e&jd0Z&ed1Z'e'jd2Z'ed3Z(e(jd4Z(ed5Z)e)jd6Z)ed7Z*e*jd8Z*ed9Z+e+jd:Z+ed;Z,e,jd<Z,ed=Z-e-jd>Z-ed?Z.e.jd@Z.edAZ/e/jdBZ/edCZ0e0jdDZ0edEZ1e1jdFZ1edGZ2e2jdHZ2edIZ3e3jdJZ3edKZ4e4jdLZ4edMZ5e5jdNZ5edOZ6e6jdPZ6edQZ7e7jdRZ7edSZ8e8jdTZ8edUZ9e9jdVZ9edWZ:e:jdXZ:edYZ;e;jdZZ;ed[Ze>jd`Z>edaZ?e?jdbZ?edcZ@e@jddZ@edeZAeAjdfZAedgZBeBjdhZBediZCeCjdjZCedkZDeDjdlZDedmZEeEjdnZEedoZFeFjdpZFedqZGeGjdrZGedsZHeHjdtZHeduZIeIjdvZIedwZJeJjdxZJdyZKddzZLd{ZMd|ZNd}ZOd~ZPdZQdZRdZSdZTddZUddddZVddZW dddZXdddZYddZZddZ[ddZ\dZ]dddZ^dZ_dZ`dZadZbdZcdZddZedZfddZgddZhdZidZjdZkdddZlddZmddZnddZodZpdZqddZrdZsdZtdS) PrettyTableNreturnNonec B|dd|_g|_g|_g|_i|_i|_i|_i|_i|_ i|_ i|_ |r||_ ng|_ gd|_|jD](}||vr||||#d||<)|dpd|_|dpd|_|dpd|_|d pd|_i|_|d d vr|d |_nd |_|d pd|_|dd vr|d|_nd |_|dd vr|d|_nd|_|dpt2|_|dpt6|_|dpd|_|dd vr|d|_nd|_|dpd|_|dpi|_|dpi|_|dpi|_|dpi|_|dpi|_ |dpi|_ |dpi|_ |dpi|_ |dpd|_!|d pd|_"|d!d"|_#n |d!|_#|d#pd|_$|d$pd|_%|d%pd&|_&|d'pd(|_'|d)|_(|d*pd+|_)|d,|_*|d-|_+|d.|_,|d/|_-|d0|_.|d1|_/|d2|_0|d3|_1|d4d vr|d4|_2nd |_2|d5d vr|d5|_3nd|_3|d6pd|_4|d7pd|_5|d8pi|_6dS)9a Return a new PrettyTable instance Arguments: encoding - Unicode encoding scheme used to decode any encoded input title - optional table title 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) preserve_internal_border - print a border inside the table even if border is disabled (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 custom_format - controls formatting of any column using callable min_table_width - minimum desired table width, in characters max_table_width - maximum desired table width, in characters min_width - minimum desired field width, in characters max_width - maximum desired field width, in characters 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 horizontal_align_char - single character string used to indicate alignment junction_char - single character string used to draw line junctions top_junction_char - single character string used to draw top line junctions bottom_junction_char - single character string used to draw bottom line junctions right_junction_char - single character string used to draw right line junctions left_junction_char - single character string used to draw left line junctions top_right_junction_char - single character string used to draw top-right line junctions top_left_junction_char - single character string used to draw top-left line junctions bottom_right_junction_char - single character string used to draw bottom-right line junctions bottom_left_junction_char - single character string used to draw bottom-left line junctions sortby - name of field to sort rows by sort_key - sorting key function, applied to data points before sorting align - default align for each column (None, "l", "c" or "r") valign - default valign for each row (None, "t", "m" or "b") reversesort - True or False to sort in descending or ascending order oldsortslice - Slice rows before sorting in the "old style" encodingzUTF-8),titlestartendfieldsheaderborderpreserve_internal_bordersortby reversesortsort_key attributesformathrulesvrules int_format float_format custom_formatmin_table_widthmax_table_width padding_widthleft_padding_widthright_padding_width vertical_charhorizontal_charhorizontal_align_char junction_char header_stylevalignxhtml print_empty oldsortslicetop_junction_charbottom_junction_charright_junction_charleft_junction_chartop_right_junction_chartop_left_junction_charbottom_right_junction_charbottom_left_junction_charalignrH max_width min_width none_formatNr-r.rr/r0r1TFTrGr2r3Fr9r:r4r5r6c|Sr)xs rz&PrettyTable.__init__..s!rrTrHrUrVr;r<r=rWr>r?r@rrArBrC|rD-rErF+rLrMrNrOrPrQrRrSrJrKr8rIr7)7getr, _field_names_rows _dividersrTrHrUrVr;r<r= field_names_widths_options_validate_option_title_start_end_fields _none_format_header _header_style_border_preserve_internal_borderFRAME_hrulesALL_vrules_sortby _reversesort _sort_keyrW_min_table_width_max_table_width_padding_width_left_padding_width_right_padding_width_vertical_char_horizontal_char_horizontal_align_char_junction_char_top_junction_char_bottom_junction_char_right_junction_char_left_junction_char_top_right_junction_char_top_left_junction_char_bottom_right_junction_char_bottom_left_junction_char _print_empty _oldsortslice_format_xhtml _attributes)selfrdkwargsoptions r__init__zPrettyTable.__init__NsOp :w77 (*!# %'    )*D  &(DL- - -  \m & &F%%ffVn====!%vWo- Wo* 5M)T h'/4 .0 ( } , ,!(+DLLDL#N3;t ( } , ,!(+DLLDL , - > >-34N-OD * *-2D *h'05 h'.3 h'/4 - M 1 1 &} 5D   %D  +< G_* X&,"  ,2 ,2 .4"">28b#O4:!-06B &'8 9 AT &'8 9 AT / " *"#D  "("9D #)*>#?#G4 $*+@$A$IT!$_5< &'8 9 @S&,-D&E#$_5<"()<"=%+,B%C"$*+@$A!#)*>#? (./H(I%'-.F'G$+12N+O(*01L*M' - M 1 1 &} 5D   $D  . !] 2 2!'!7D  !&D h'05 Wo. !,/52rc|t|z }|dkr||dzzS|dkr|dz|zS|dzr@t|dzr|dzdz|z|dzdzdzzS|dzdzdz|z|dzdzzS|dzdz|z|dzdzzS)Nl rrrr)rr"r%rTexcesss r_justifyzPrettyTable._justifys)$/// C<<&3,& & c\\C<$& &z H$D))A-P"aK3.51qC8OOO#aK!Os2T9Vq[C|jrt|jS|jrt|jdSdSt|)Nrowcountcolcountr)r rbraAttributeError)rnames r __getattr__zPrettyTable.__getattr__,ss :  tz?? " Z    4,--- 4:a=)))q && &rc t}|j|_|jD]'}t|d|zt |d|z(t|dt |dt |t r&|j|D]}||nIt |tr!||j|ntd|d|S)N__alignzIndex z( is invalid, must be an integer or slice) r(rdrfsetattrgetattr isinstanceslicerbadd_rowint IndexError)rindexnewattrrows r __getitem__zPrettyTable.__getitem__9smm*M @ @D CtWT3:%>%> ? ? ? ?XwtX66777 eU # # Wz%( ! ! C     ! s # # W KK 5) * * * *UeUUUVV V rc*|Sr get_stringrs r__str__zPrettyTable.__str__H   rc*|Srrrs r__repr__zPrettyTable.__repr__Krrc*|S)zs Returns get_html_string value by default as the repr call in Jupyter notebook environment )get_html_stringrs r _repr_html_zPrettyTable._repr_html_Ns ##%%%rc|dkr||dS|dkr||dS|dvr|||dS|dkr|||dS|dkr|||dS|dkr|||dS|dkr|||dS|dkr|||dS|d vr|||dS|d kr| |dS|d kr| ||dS|d kr| ||dS|d kr7| D] \}}||d||!dS|dvr| ||dS|dkr|||dSdS)NrdrW) r.r/rUrVr>r?r@rArBr8r4r6r9r:r0)r1r2r3r5rIrJrKrGr;r<r=.) rCrDrErFrLrMrNrOrPrQrRrSr7)_validate_field_names_validate_none_format_validate_nonnegative_int_validate_field_name_validate_function_validate_hrules_validate_vrules_validate_all_field_names_validate_true_or_false_validate_header_style_validate_int_format_validate_float_formatitems_validate_single_char_validate_attributes)rrvalk formatters rrgzPrettyTable._validate_optionbs ] " "  & &s + + + + + } $ $  & &s + + + + +       * *63 7 7 7 7 7 x    % %fc 2 2 2 2 2 z ! !  # #FC 0 0 0 0 0 x    ! !&# . . . . . x    ! !&# . . . . . x    * *63 7 7 7 7 7      ( ( 5 5 5 5 5 ~ % %  ' ' , , , , , | # #  % %fc 2 2 2 2 2 ~ % %  ' ' 4 4 4 4 4  & & #  D D 9''6ACCCC D D       & &vs 3 3 3 3 3 | # #  % %fc 2 2 2 2 2$ #rc x|jrDnC#t$r6tdt|dt|jdwxYw|jrJnI#t$r<tdt|dt|jddwxYwdS#t$rtdwxYw)Nz9Field name list has incorrect number of values, (actual) != (expected)rzField names must be unique)raAssertionError ValueErrorr rbrrs rrz!PrettyTable._validate_field_namess*    !    P #CPP,/0A,B,BPPP  :  !    L #CLL,/ 1 ,>,>LLL   ; ; ; ; ;9:: : ;sAA ABB9cJ |dSdS#t$rtdwxYw)Nz>Replacement for None value must be a string if being supplied.r TypeErrorrs rrz!PrettyTable._validate_none_formatsD    P  s"c@dS#t$rtdwxYw)Nz:Invalid header style, use cap, title, upper, lower or Nonerrrs rrz"PrettyTable._validate_header_styles<     L  cHdS#t$rtd|dwxYw)N Alignment z is invalid, use l, c or rrrs r_validate_alignzPrettyTable._validate_alignsG K K K K KI#IIIJJ J K!cHdS#t$rtd|dwxYw)Nrz is invalid, use t, m, b or Nonerrs r_validate_valignzPrettyTable._validate_valignsG Q Q Q Q QO#OOOPP P QrcLdS#t$rtd|d|wxYw)NInvalid value for : rrrrs rrz%PrettyTable._validate_nonnegative_intsL A A A A A?$??#??@@ @ As #cHdS#t$rtd|dwxYw)Nrz. Must be True or False.rrs rrz#PrettyTable._validate_true_or_falsesG R R R R RP$PPPQQ Q RrcX|dkrdSdS#t$rtd|dwxYw)Nrz#. Must be an integer format string.rrs rrz PrettyTable._validate_int_formatsW "99 F     NTNNN  s)c|dkrdS |d}dS#t$rtd|dwxYw)Nrrrz . Must be a float format string.)rrr)rrrbitss rrz"PrettyTable._validate_float_formatsg "99 F 99S>>DDD   KTKKK  s!?cHdS#t$rtd|dwxYw)Nrz. Must be a function.rrs rrzPrettyTable._validate_functionsG O O O O OM$MMMNN N OrcHdS#t$rtd|dwxYw)Nrz%. Must be ALL, FRAME, HEADER or NONE.rrs rrzPrettyTable._validate_hrulessG     PTPPP  rcHdS#t$rtd|dwxYw)Nrz. Must be ALL, FRAME, or NONE.rrs rrzPrettyTable._validate_vrulessG X X X X XV$VVVWW W XrcFdS#t$rtd|wxYw)NzInvalid field name: rrs rrz PrettyTable._validate_field_names> ; ; ; ; ;9C99:: : ;s cx |D]}|||dS#t$rtdwxYw)Nz(Fields must be a sequence of field names)rrr)rrrr[s rrz%PrettyTable._validate_all_field_namessh I 3 3))$2222 3 3 I I IGHH H Is9cHdS#t$rtd|dwxYw)Nrz. Must be a string of length 1.rrs rrz!PrettyTable._validate_single_char#sG Y Y Y Y YW$WWWXX X Yrc@dS#t$rtdwxYw)Nz3Attributes must be a dictionary of name/value pairsrrs rrz PrettyTable._validate_attributes)s< S S S S SQRR R Sr list[Any]c |jddSr)rbrs rrowszPrettyTable.rows2sz!!!}r list[bool]c |jddSr)rcrs rdividerszPrettyTable.dividers6s~aaa  rboolc|jS)z,Print
tags if True,
tags if False)rrs rrIzPrettyTable.xhtml:s {rc@|d|||_dS)NrI)rgrrs rrIzPrettyTable.xhtml?# gs+++ rc|jSr)rlrs rrWzPrettyTable.none_formatDs   rc|js i|_dS|(t|tr)t |dkr|jD] }d|j|< dS|||jD] }||j|< dS)Nr)rarlrdictr rrrfields rrWzPrettyTable.none_formatHs  / "D    [ZT22[s3xx1}}* 0 0+/!%(( 0 0  & &s + + +* / /+.!%(( / /rc|jS)zList or tuple of field names When setting field_names, if there are already field names the new list of field names must be the same length. Columns are renamed and row data remains unchanged.)rars rrdzPrettyTable.field_namesTs   rcrd|D}|d|d}|jr|jdd}||_|jrV|rTt||D]\}}|j||j|<|D]%}||jvr|j|&n3|jr%|jD]}|jt |j|<nd|_|jrW|rUt||D]\}}|j||j|<|D]%}||jvr|j|&dSd|_dS)Nc,g|]}t|SrZstrrr[s r z+PrettyTable.field_names.._s###!s1vv###rrdct) rgrarzippopBASE_ALIGN_VALUErT_valignrH)rr old_namesold_namenew_name field_names rrdzPrettyTable.field_names]s##s### mS111   -)!!!,I ; 9 &))S&9&9 > >"((, H(= H%%% . .4;..KOOH--- .[ "/ H H *.+6F*G J'' HDJ < I &))S&9&9 @ @"()-h)? X&&% / /4<//L$$X... / /DKKKrc|jS)zdControls alignment of fields Arguments: align - alignment, one of "l", "c", or "r" rrs rrTzPrettyTable.alignys {rc4|(t|tr@t|dkr-|jstdi|_dS|jD] }d|j|< dS|||jst|i|_dS|jD] }||j|< dS)Nrr)rrr rarrrrs rrTzPrettyTable.aligns ;:c400;SXX]]$ -/5 !.--E),DK&&--   % % %$ -/5 !.--E),DK&&--rc|jS)zwControls vertical alignment of fields Arguments: valign - vertical alignment, one of "t", "m", or "b" )r rs rrHzPrettyTable.valigns |rc|js i|_dS|(t|tr)t |dkr|jD] }d|j|< dS|||jD] }||j|< dS)Nrr)rar rrr rrs rrHzPrettyTable.valigns  *DLLL [ZT22[s3xx1}}* * *&) U## * *  ! !# & & &* * *&) U## * *rc|jS)z^Controls maximum width of fields Arguments: max_width - maximum width integer) _max_widthrs rrUzPrettyTable.max_width rc|(t|trt|dkr i|_dS|d||jD] }||j|< dS)NrrU)rrr rrgrars rrUzPrettyTable.max_widtho ;:c400;SXX]] DOOO  ! !+s 3 3 3* - -),&& - -rc|jS)z^Controls minimum width of fields Arguments: min_width - minimum width integer) _min_widthrs rrVzPrettyTable.min_widthrrc|(t|trt|dkr i|_dS|d||jD] }||j|< dS)NrrV)rrr rrgrars rrVzPrettyTable.min_widthrrc|jSr)rxrs rr>zPrettyTable.min_table_width $$rc@|d|||_dS)Nr>)rgrxrs rr>zPrettyTable.min_table_width' /555 #rc|jSr)ryrs rr?zPrettyTable.max_table_widthrrc@|d|||_dS)Nr?)rgryrs rr?zPrettyTable.max_table_widthrrc|jS)z3List or tuple of field names to include in displays)rkrs rr0zPrettyTable.fieldss |rc@|d|||_dS)Nr0)rgrkrs rr0zPrettyTable.fields# h,,, rc|jS)zEOptional table title Arguments: title - table title)rhrs rr-zPrettyTable.title {rc.t||_dSr)rrhrs rr-zPrettyTable.titles#hh rc|jS)z{Start index of the range of rows to print Arguments: start - index of first data row to include in output)rirs rr.zPrettyTable.startr%rc@|d|||_dS)Nr.)rgrirs rr.zPrettyTable.startrrc|jS)zEnd index of the range of rows to print Arguments: end - index of last data row to include in output PLUS ONE (list slice style))rjrs rr/zPrettyTable.ends yrc@|d|||_dS)Nr/)rgrjrs rr/zPrettyTable.ends# eS))) rc|jS)z_Name of field by which to sort rows Arguments: sortby - field name to sort by)rurs rr4zPrettyTable.sortby  |rc@|d|||_dS)Nr4)rgrurs rr4zPrettyTable.sortbyr#rc|jS)zControls direction of sorting (ascending vs descending) Arguments: reveresort - set to True to sort by descending order, or False to sort by ascending order)rvrs rr5zPrettyTable.reversesort   rc@|d|||_dS)Nr5)rgrvrs rr5zPrettyTable.reversesort$& mS111rc|jS)zSorting key function, applied to data points before sorting Arguments: sort_key - a function which takes one argument and returns something to be sorted)rwrs rr6zPrettyTable.sort_key)s ~rc@|d|||_dS)Nr6)rgrwrs rr6zPrettyTable.sort_key3s# j#...rc|jS)zControls printing of table header with field names Arguments: header - print a header showing field names (True or False))rmrs rr1zPrettyTable.header8r,rc@|d|||_dS)Nr1)rgrmrs rr1zPrettyTable.headerAr#rc|jS)zControls stylisation applied to field names in header Arguments: header_style - stylisation to apply to field names in header ("cap", "title", "upper", "lower" or None))rnrs rrGzPrettyTable.header_styleFs !!rc>||||_dSr)rrnrs rrGzPrettyTable.header_stylePs$ ##C((( rc|jS)z~Controls printing of border around table Arguments: border - print a border around the table (True or False))rors rr2zPrettyTable.borderUr,rc@|d|||_dS)Nr2)rgrors rr2zPrettyTable.border^r#rc|jS)zControls printing of border inside table Arguments: preserve_internal_border - print a border inside the table even if border is disabled (True or False))rprs rr3z$PrettyTable.preserve_internal_bordercs --rc@|d|||_dS)Nr3)rgrprs rr3z$PrettyTable.preserve_internal_borderms' 8#>>>),&&&rc|jS)zControls printing of horizontal rules after rows Arguments: hrules - horizontal rules style. Allowed values: FRAME, ALL, HEADER, NONE)rrrs rr9zPrettyTable.hrulesrr,rc@|d|||_dS)Nr9)rgrrrs rr9zPrettyTable.hrules{r#rc|jS)zControls printing of vertical rules between columns Arguments: vrules - vertical rules style. Allowed values: FRAME, ALL, NONE)rtrs rr:zPrettyTable.vrulesr,rc@|d|||_dS)Nr:)rgrtrs rr:zPrettyTable.vrulesr#rc|jS)zbControls formatting of integer data Arguments: int_format - integer format string) _int_formatrs rr;zPrettyTable.int_formats rc|(t|trt|dkr i|_dS|d||jD] }||j|< dS)Nrr;)rrr rArgrars rr;zPrettyTable.int_formatss ;:c400;SXX]]!D     ! !, 4 4 4* . .*- '' . .rc|jS)zrControls formatting of floating point data Arguments: float_format - floating point format string) _float_formatrs rr<zPrettyTable.float_formats !!rc|(t|trt|dkr i|_dS|d||jD] }||j|< dS)Nrr<)rrr rDrgrars rr<zPrettyTable.float_formatss ;:c400;SXX]]!#D     ! !.# 6 6 6* 0 0,/"5)) 0 0rc|jS)zControls formatting of any column using callable Arguments: custom_format - Dictionary of field_name and callable)_custom_formatrs rr=zPrettyTable.custom_formats ""rcP| i|_dSt|tr<|D]\}}|d||||_dSt |dr,|d||jD] }||j|< dStd)Nz custom_value.__call__ custom_valuez>The custom_format property need to be a dictionary or callable)rGrrrrhasattrrar)rrrvrs rr=zPrettyTable.custom_formats ;"$D    T " "   @ @1''(;(;(;Q????"%D    S* % %   # #NC 8 8 8* 1 1-0#E** 1 1P rc|jS)zThe number of empty spaces between a column's edge and its content Arguments: padding_width - number of spaces, must be a positive integer)rzrs rr@zPrettyTable.padding_width ""rc@|d|||_dS)Nr@)rgrzrs rr@zPrettyTable.padding_widths& os333!rc|jS)zThe number of empty spaces between a column's left edge and its content Arguments: left_padding - number of spaces, must be a positive integer)r{rs rrAzPrettyTable.left_padding_widths ''rc@|d|||_dS)NrA)rgr{rs rrAzPrettyTable.left_padding_widths' 2C888#&   rc|jS)zThe number of empty spaces between a column's right edge and its content Arguments: right_padding - number of spaces, must be a positive integer)r|rs rrBzPrettyTable.right_padding_widths ((rc@|d|||_dS)NrB)rgr|rs rrBzPrettyTable.right_padding_widths' 3S999$'!!!rc|jS)zThe character used when printing table borders to draw vertical lines Arguments: vertical_char - single character string used to draw vertical lines)r}rs rrCzPrettyTable.vertical_charrNrc^t|}|d|||_dS)NrC)rrgr}rs rrCzPrettyTable.vertical_char1#hh os333!rc|jS)zThe character used when printing table borders to draw horizontal lines Arguments: horizontal_char - single character string used to draw horizontal lines)r~rs rrDzPrettyTable.horizontal_chars $$rc^t|}|d|||_dS)NrD)rrgr~rs rrDzPrettyTable.horizontal_char s2#hh /555 #rc|jp|jS)zThe character used to indicate column alignment in horizontal lines Arguments: horizontal_align_char - single character string used to indicate alignmentrrFrs rrEz!PrettyTable.horizontal_align_chars.D$2DDrc^t|}|d|||_dS)NrE)rrgrrs rrEz!PrettyTable.horizontal_align_chars2#hh 5s;;;&)###rc|jS)zThe character used when printing table borders to draw line junctions Arguments: junction_char - single character string used to draw line junctions)rrs rrFzPrettyTable.junction_char rNrc^t|}|d|||_dS)NrF)rrgrrs rrFzPrettyTable.junction_char)rVrc|jp|jS)zThe character used when printing table borders to draw top line junctions Arguments: top_junction_char - single character string used to draw top line junctions)rrFrs rrLzPrettyTable.top_junction_char/s&<$*<s)?T-??rc^t|}|d|||_dS)NrM)rrgrrs rrMz PrettyTable.bottom_junction_charHs2#hh 4c:::%("""rc|jp|jS)zThe character used when printing table borders to draw right line junctions Arguments: right_junction_char - single character string used to draw right line junctions)rrFrs rrNzPrettyTable.right_junction_charNs(>D,>>rc^t|}|d|||_dS)NrN)rrgrrs rrNzPrettyTable.right_junction_charXs2#hh 3S999$'!!!rc|jp|jS)zThe character used when printing table borders to draw left line junctions Arguments: left_junction_char - single character string used to draw left line junctions)rrFrs rrOzPrettyTable.left_junction_char^s'=4+==rc^t|}|d|||_dS)NrO)rrgrrs rrOzPrettyTable.left_junction_chargs2#hh 2C888#&   rc|jp|jS)z The character used when printing table borders to draw top-right line junctions Arguments: top_right_junction_char - single character string used to draw top-right line junctions)rrFrs rrPz#PrettyTable.top_right_junction_charms,B0BBrc^t|}|d|||_dS)NrP)rrgrrs rrPz#PrettyTable.top_right_junction_charxs2#hh 7===(+%%%rc|jp|jS)z The character used when printing table borders to draw top-left line junctions Arguments: top_left_junction_char - single character string used to draw top-left line junctions)rrFrs rrQz"PrettyTable.top_left_junction_char~s+At/AArc^t|}|d|||_dS)NrQ)rrgrrs rrQz"PrettyTable.top_left_junction_chars2#hh 6<<<'*$$$rc|jp|jS)zThe character used when printing table borders to draw bottom-right line junctions Arguments: bottom_right_junction_char - single character string used to draw bottom-right line junctions)rrFrs rrRz&PrettyTable.bottom_right_junction_chars/E43EErc^t|}|d|||_dS)NrR)rrgrrs rrRz&PrettyTable.bottom_right_junction_chars2#hh :C@@@+.(((rc|jp|jS)zThe character used when printing table borders to draw bottom-left line junctions Arguments: bottom_left_junction_char - single character string used to draw bottom-left line junctionsrZrs rrSz%PrettyTable.bottom_left_junction_chars.D$2DDrc^t|}|d|||_dS)NrS)rrgrrs rrSz%PrettyTable.bottom_left_junction_chars2#hh 93???*-'''rc|jS)z~Controls whether or not HTML tables are formatted to match styling options Arguments: format - True or False)rrs rr8zPrettyTable.formatr,rc@|d|||_dS)Nr8)rgrrs rr8zPrettyTable.formatr#rc|jS)zControls whether or not empty tables produce a header and frame or just an empty string Arguments: print_empty - True or False)rrs rrJzPrettyTable.print_emptyr/rc@|d|||_dS)NrJ)rgrrs rrJzPrettyTable.print_emptyr1rc|jS)zA dictionary of HTML attribute name/value pairs to be included in the tag when printing HTML Arguments: attributes - dictionary of attributes)rrs rr7zPrettyTable.attributess rc@|d|||_dS)Nr7)rgrrs rr7zPrettyTable.attributess& lC000rc|jS)z?)randomchoicer1r2rsrqHEADERrrrrtrandintrArBrCrDrFr3rs rrzPrettyTable._set_random_style[smM22 mM22 }c5&$%?@@ }c5$%788 "(.A"6"6#)>!Q#7#7 #]+OPP%}-QRR#]+OPP(. m(D(D%%%rc:|D]}||dS)zAdd rows to the table Arguments: rows - rows of data, should be an iterable of lists, each list with as many elements as the table has fieldsN)r)rrrs radd_rowszPrettyTable.add_rowsls2  C LL      rF)dividerc|jrZt|t|jkr5tdt|dt|jd|js,dtdt|D|_|jt||j|dS)zAdd a row to the table Arguments: row - row of data, should be a list with as many elements as the table has fieldsz-Row has incorrect number of values, (actual) rrcg|] }d|dz S)zField rrZ)rns rrz'PrettyTable.add_row..s%MMMQ 0Q 0 0MMMrrN) rar rrangerdrbappendlistrc)rrrs rrzPrettyTable.add_rowvs   SS1B-C-C!C!CLHHLL(+D,=(>(>LLL   NMM%3s88:L:LMMMD  $s))$$$ g&&&&&rc|t|jdz kr(td|dt|jd|j|=|j|=dS)zDelete a row from the table Arguments: row_index - The index of the row you want to delete. Indexing starts at 0.rzCan't delete row at index z, table only has z rowsN)r rbrrc)r row_indexs rdel_rowzPrettyTable.del_rowsu s4:* * *9Y99"%dj//999  Jy ! N9 % % %rrrrTrrHct|jdt|fvr|||||j|||j|<||j|<tdt|D]w}t|j|dzkr4|jg|j d|j|||xdStdt|dt|j)aAdd 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 bottomrrFzColumn length z does not match number of rows N) r rbrrrarrr rrcr)r fieldnamecolumnrTrHis r add_columnzPrettyTable.add_columnsF tz??q#f++. . .   ' ' '  ! !& ) ) )   $ $Y / / /%*DK "&,DL #1c&kk** 0 0tz??QU**J%%b)))N))%000 1 $$VAY////  0 0 %V%%tz??%% rIndexrc|jd||j|j|<|j|j|<t |jD]\}}|d|dzdS)zAdd an auto-incrementing index column to the table. Arguments: fieldname - name of the field to contain the new column of datarrN)rainsertrTrrHr  enumeraterb)rrrrs r add_autoindexzPrettyTable.add_autoindexs{   I...!% I"&+ Y ++ ! !FAs JJq!a%  ! !rc ||jvr@td|ddtt|j|j|}|j|=|jD]}||=dS)zxDelete a column from the table Arguments: fieldname - The field name of the column you want to delete.zCan't delete column z; which is not a field name of this table. Field names are: z, N)rarjoinmapreprrrb)rr col_indexrs r del_columnzPrettyTable.del_columns D- - -*99diiD$2C(D(DEEEG  %++I66  i (:  CI  rc"g|_g|_dS)z?Delete all rows from the table but keep the current field namesN)rbrcrs r clear_rowszPrettyTable.clear_rowss rc>g|_g|_g|_g|_dS)z_Delete all rows and field names from the table, maintaining nothing but styling optionsN)rbrcrarers rclearzPrettyTable.clears%  rc*tj|Sr)copydeepcopyrs rrzPrettyTable.copys}T"""rr" out_formatc |dkr |jd i|S|dkr |jd i|S|dkr |jd i|S|dkr |jd i|S|dkr |jd i|St d|d) zReturn string representation of specified format of table in current state. Arguments: out_format - resulting table format kwargs - passed through to function that performs formatting r"htmljsoncsvlatexzInvalid format z1. Must be one of: text, html, json, csv, or latexNrZ)rrget_json_stringget_csv_stringget_latex_stringr)rrrs rget_formatted_stringz PrettyTable.get_formatted_strings   "4?,,V,, ,   '4'11&11 1   '4'11&11 1   &4&0000 0  (4(22622 2 >j > > >   rct|tr||jvrd|j|z|zSt|tr||jvrd|j|z|zS|j|d}|||S)Nz%%%sdz%%%sfc t|Srr)frLs rr\z+PrettyTable._format_value.. s Qr)rrrAfloatrDrGr`)rrvaluers r _format_valuezPrettyTable._format_values eS ! ! Aet/?&?&?d.u55> > u % % A%43E*E*Ed0775@ @'++E4G4GII y&&&rc |dttfvrdnd}t||}t |jD]2\}}|dr|dr||dvr||j||zz }3|S)Nr:rrr0)rqrssum_get_padding_widthsrrdre)rrw table_widthper_col_paddingrrs r_compute_table_widthz PrettyTable._compute_table_width s"8, <.s%IIIei&&q)IIIrrr*g?cXg|]&}ttj|z'SrZrmathfloorrwscales rrz/PrettyTable._compute_widths..4/EEE#djU3344EEErr-r:rr2rr3cTg|]$}t%SrZ)rr)rrrwrs rrz/PrettyTable._compute_widths..Ls/LLLS11'::;;LLLrcXg|]&}ttj|z'SrZrrs rrz/PrettyTable._compute_widths..Trr)rar rdrrWr`rUr!minr&rVreryrrxrrrqrsr>)rrrwwidthsrrrrr title_widthr>rVborders content_widthrs` ` @r_compute_widthszPrettyTable._compute_widthssa 8  1IIt7HIIIFF)**aS0F R RC )# R R u ,U3 #'' 22>%- $ 0 4 4Y ? ?..$'u Ie,,Q/ 1JKK%%F5MM %(u y7G7G7J$K$KF5M..$'u t~i7P$Q$QF5M R    &33G<.us%;;;sS^$s*;;;rr5r6)reversekeyc"g|] }|dd S)rNrZ)rrs rrz)PrettyTable._get_rows..ys ,,,CG,,,r)rrrbrarsort)rrwrrs @r _get_rowszPrettyTable._get_rowsds > " -=GG,9:D rc|dr.tj|j|d|d}ntj|j}|dr d|D}|S)zReturn only those dividers that should be printed, based on slicing. Arguments: options - dictionary of option settings.rKr.r/r4cg|]}dS)FrZ)rrs rrz-PrettyTable._get_dividers..s666'666r)rrrc)rrwrs r _get_dividerszPrettyTable._get_dividerssm > " 5}T^GG4Dwu~4U%VWWHH}T^44H 8  766X666HrcFfdtj|DS)NcBg|]\}}||SrZ)r)rrrrs rrz+PrettyTable._format_row..s=      ue , ,   r)rra)rrs` r _format_rowzPrettyTable._format_rows;    "%d&7"="=    rc fd|DS)Nc:g|]}|SrZ)r)rrrs rrz,PrettyTable._format_rows..s'666#  %%666rrZ)rrs` r _format_rowszPrettyTable._format_rowss66666666rc ||}g}|jdkr|dr|dsdS||}||}||}||||||_|dp|j}|r)| | |||dr)| | |n|dr{|dttfvre| ||d |r9|d ttfvr#|j|d d d z|jz|d <t!|d d |d d D]`\}} | ||||j| r*| ||d a|rE| ||d |||d |dr;|dtkr*| ||d d|jvrP|jdurGt)} |D]*} | | d+d| D}d|S)a Return string representation of table in current state. Arguments: title - optional table title 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) preserve_internal_border - print a border inside the table even if border is disabled (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 custom_format - controls formatting of any column using callable 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 horizontal_align_char - single character string used to indicate alignment junction_char - single character string used to draw line junctions junction_char - single character string used to draw line junctions top_junction_char - single character string used to draw top line junctions bottom_junction_char - single character string used to draw bottom line junctions right_junction_char - single character string used to draw right line junctions left_junction_char - single character string used to draw left line junctions top_right_junction_char - single character string used to draw top-right line junctions top_left_junction_char - single character string used to draw top-left line junctions bottom_right_junction_char - single character string used to draw bottom-right line junctions bottom_left_junction_char - single character string used to draw bottom-left 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 stringrrJr2rr-r1r9top_)wherer:rrNbottom_rTrc.g|]}d|ddzdzS)r]rrrZrs rrz*PrettyTable.get_string..s*<<<S4":%+<<> ? ? ? 8   LL//88 9 9 9 9 X  78#4e #D#D LL..wf.EE F F F *sEl::+eBi"o=@XXb  ss 3Xcrc]CC N NLC LL,,S'4;GG H H H N T227)2LLMMM   LL##"2&))')CC    8  J!2e!;!; LL..wi.HH I I I  % %$,$*>*>&&C - - 4::d++,,,,<<<< ? ? ?774==  14<@@ 8 8LE5x  U'(2C%C%CDL4'73D+EED* C;u%336abbAD;u%339t'BBD KK   x C'' GEO$;<==== G$567777 8 e , , HHJJJ KK(= => ? ? ? - . wx7H ":Dwwt}}rcg}||\}}|dr|dtkr>t|d<|||dt|d<n:|dtkr)|||dg}|dttfvr|dr|dnd}||d|z|zd|zz}|||t |jdz d|||d|d |S) Nr2r:rrCrrrrr) rrsrqrrrr rr)rr-rwr#rrrendpoints rrzPrettyTable._stringify_title3s}--g66 d 8  Ex C''$)! T227FCCDDD$'!!"e++ T227FCCDDDx S%L00WX5F0 O $ $  Hd U"S4Z/ DMM%T[)9)9A)=sCCDDD H RWWT]]###yyrc 6g}||\}}|dr|dttfvr|||d|dr9|dttfvr#|j|dddz|jz|d<|d|dttfvr||d n|d |jsG|dttfvr||d n|d t|j|j D]L\}}|d r ||d vr|j d kr| }nb|j dkr| }nB|j d kr| }n"|j dkr|}n|}t||kr |d|}|d |z||||j|zd |zz|ds|drC|dtkr||d 7|d N|ds1|dr)||d |dr@|dtkr/|||d |ds|dr@|dt&kr/|d||jd|S)Nr2r9rr-r:rrrrCrr0capupperlowerr3r)rrsrqrrrOrNrarrern capitalizer-rrrrrrrrr)rrwrrrrr%rs rrzPrettyTable._stringify_headerJs--g66 d 8  !x S%L00 D11'6BBCCC7#(9c5\(I(I/r(1R4.)23H  D!!!x S%L00 GO45555 C     !x S%L00 GO45555 C    14<@@ % %LE5x  U'(2C%C%C!U**!,,.. #w..!KKMM #w..!KKMM #w..!KKMM !  **U22%fuf- KKd -- 5$+e2DEEF*    x  %G,F$G %8$++KK 89999KK$$$x  W-G%H  HHJJJ KK    8  2!2e!;!; HHJJJ KK0 1 1 1 H  %)C!D %' K KK KK    KK $ $ $wwt}}rc ttdt||j||jD]\}}}}|d}g} |D]l} | dkr'|j| |j|} t| |krtj | |} | | m| }d |}|||<d} |D]} t| d} | | kr| } g}||\}}td| D]q}| g|drR|dtt fvr!|| |jV|| drt|j||jD]S\}}}|j|}|d}| t|z }|rS|dkr4d gt'|d z z|zd g|t'|d z z zz}n|d kr d g|z|z}n |d g|zz}d}|D]} |d r ||d vr|| d|z|| ||j|zd|zz|ds|d rM|dtkr!|| |jn|| d|dz }U|ds=|d r5|d|d dtd| D]V}|drL|dt kr;|||| |dW|drM|dtkr<|| dz  d|| dz  |td| D] }d ||||<!d |S)Nrrr*rr2r:rmrrbr0r3rrCr9)rrr rarerrWr`rtextwrapfillrrr&rrsrqrCr rrrr)rrrwhrulerrrr%r# new_linesr row_heightrhrrryrHd_heights rr zPrettyTable._stringify_rows*- !SXX   13 + +    &E5%KK%%EI ' '6>>d&6&:&:5&A&A&M+E2D#D))E11#=u55D  &&&&EIIe$$ECJJ   A! QA:~~ --g66 dq*%% ( (A KKOOOx  (8$e 44GNN4#56666GNN3'''#&t'8#t|#L#L   E5%\%(FKK%%E!CJJ.H 4S==s8a<000 $(SA->->">?@E s]]D8Oe3EE!RD8O3EA  8$gh6G)G)GQ$JmmD%U1CDDEDj! 8$,0J(K,x(C//Qt'9::::Qs+++Q $x  !W-G%H ! HLLNNN HOOC q*%% 9 9Ax  9WX%6%%?%?Q Qw7888 8  /!2c!9!9 a ' ' - - - a ' ' . . .q*%% ' 'Aggd1g&&DGGyyr: page_lengthr line_breakc Ng}|dd|d<|d|j} t|d|z||d<||jdi||d|krn|dxx|z cc<Z||S)Nr.rr/TrZ)r`rrrrr)rr#r$rpagestrue_ends rpaginatezPrettyTable.paginates **Wa00w::eT]33 +w+ =xHHF5M LL22622 3 3 3e}(( 7OOO{ *OOO  + u%%%rc ||fd|D}tj}t j|fi|}dr||j| D]}||| S)aReturn string representation of CSV formatted table in the current state Keyword arguments are first interpreted as table formatting options, and then any unused keyword arguments are passed to csv.writer(). For example, get_csv_string(header=False, delimiter=' ') would use header as a PrettyTable formatting option (skip the header row) and delimiter as a csv.writer keyword argument. c$i|] \}}|v || SrZrZrrrrws r z.PrettyTable.get_csv_string..s0   %33g;M;MC;M;M;Mrr1) rxrioStringIOrwriterr`writerowrargetvalue)rr csv_options csv_buffer csv_writerrrws @rrzPrettyTable.get_csv_strings##F++    )/   []] Z ::k:: ;;x  3    1 2 2 2>>'** % %C    $ $ $ $""$$$rc ||tddd}|fd|Dg}dr||j|D]7}|tt|j |8tj |fi|S)aReturn string representation of JSON formatted table in the current state Keyword arguments are first interpreted as table formatting options, and then any unused keyword arguments are passed to json.dumps(). For example, get_json_string(header=False, indent=2) would use header as a PrettyTable formatting option (skip the header row) and indent as a json.dumps keyword argument. ),rT)indent separators sort_keysc$i|] \}}|v || SrZrZr+s rr,z/PrettyTable.get_json_string..s) O O OJCCw>'** > >C NN4D$5s ; ;<< = = = =z'22\222rc ||}|dr||}n||}|S)aReturn string representation of HTML formatted version of table in current state. Arguments: title - optional table title 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) preserve_internal_border - print a border inside the table even if border is disabled (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 custom_format - controls formatting of any column using callable 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
tag format - Controls whether or not HTML tables are formatted to match styling options (True or False) xhtml - print
tags if True,
tags if Falser8)rx_get_formatted_html_string_get_simple_html_stringrrrwstrings rrzPrettyTable.get_html_string*sRB##F++ 8  ;44W==FF11'::F rc g}|drd}nd}dg}|dr3|dD]*}|d|d|d|d+|d |d ||d p|j}|r|d |d |dr|d|d|jD]N}|dr ||dvr|dt |d|zO|d|d|d||}||} | D]} |dt|j| D]Q\}} |dr ||dvr|dt | d|zR|d|d|dd|S)NrI

rr- r1 r0z r z 
%s
%s
) rrrhrarreplacerrr) rrwr# linebreakopen_tag attr_namer-rrr rdatums rrBz#PrettyTable._get_simple_html_stringTs 7  III: <  V$\2 V V  TI T T1Fy1Q T T TUUUU RWWX&&''' /DK  < LL:::: ; ; ; 8  ) LL ' ' ' LL ( ( (*  8$gh6G)G)G -u 0E0EdI0V0VV LL ) ) ) LL ( ( (  ]###~~g&&**400! * *C LL ( ( ( #D$5s ; ;   u8$gh6G)G)G -u 0E0EdI0V0VV LL ) ) ) ) ^$$$ Z   yyrc g}||\}}|drd}nd}dg}|drD|dtkr(|dtkr|dn |dtkr'|dtkr|d n|dtkr'|dtkr|d n|dtkr|d nt|dtkr|d nM|dtkr|d n&|dtkr|d|ds|dr|d|dr3|dD]*}|d|d|d|d+|d|d||dp|j}|r|d|d|dr|d|d|jD]Q} |dr | |dvr|d||t| d|fzR|d |d!|d"| |} | | } g} g} |jD]V} | d#d$d%d&|j | | d'd(d)d*|j | W| D]}|dt|j|| | D]X\} }}}|dr | |dvr|d+||||t|d|fzY|d |d,|d-d|S).NrIrFrGrHr2r9r:z frame="box" rules="all"z frame="box"z frame="box" rules="cols"z frame="hsides"z frame="hsides" rules="rows"z frame="vsides"z frame="vsides" rules="cols"r3z rules="cols"r7rrIrJrKrr-rLrMr1rNrOr0z[ %srrPrQrRleftrightcenter)rrrtopmiddlebottom)rrrzk %srSrT)rrsrrqrrhrarrUrrrr r)rrwr#rrrVrWrXr-rrr alignsvalignsrrYrTrHs rrAz&PrettyTable._get_formatted_html_strings--g66 d 7  III: 8  @x C''GH,=,D,D :;;;;"e++0AU0J0J////"e++0AS0H0H ;<<<<"e++ 12222"c)) >????"e++ 12222"c)) >???x  -W-G%H - OOO , , , <  V$\2 V V  TI T T1Fy1Q T T TUUUU RWWX&&''' /DK  < LL:::: ; ; ; 8  ) LL ' ' ' LL ( ( (*  8$gh6G)G)G qT6%==#8#8y#I#IJK LL ) ) ) LL ( ( (  ]###~~g&&**400&  E MM7::4;u;MN    NN(::4<;NO    " * *C LL ( ( (/2!300  +ueV8$gh6G)G)G Bu --dI>>      LL ) ) ) ) ^$$$ Z   yyrc ||}|dr||}n||}|S)aReturn string representation of LaTex 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) preserve_internal_border - print a border inside the table even if border is disabled (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 sortby - name of field to sort rows by sort_key - sorting key function, applied to data points before sorting format - Controls whether or not HTML tables are formatted to match styling options (True or False) r8)rx_get_formatted_latex_string_get_simple_latex_stringrCs rrzPrettyTable.get_latex_stringsQ0##F++ 8  <55g>>FF227;;F rc| g}g drfdjD nj dfd D}d|z}||dr+|d dz}|}|D]N} fd t j|D}|d|dzO|d d |S) Nr0c(g|]}|dv |Sr0rZrrrws rrz8PrettyTable._get_simple_latex_string.. /AR8R8R8R8R8Rrrc*g|]}j|SrZrrrrs rrz8PrettyTable._get_simple_latex_string.. s LLLUdk%0LLLr\begin{tabular}{%s}r1 &  \\c"g|] \}}|v | SrZrZrrd wanted_fieldss rrz8PrettyTable._get_simple_latex_string.. .aQ-=O=O=O=O=Or \end{tabular} )rarrrrr) rrwr# alignments begin_cmdrr r wanted_datarss `` @rrez$PrettyTable._get_simple_latex_string s~ 8  .#'#4MM!-MWWLLLLmLLLMM *Z7  Y 8  > LLM22W< = = =~~g&&**400! < .' rjrc*g|]}j|SrZrrls rrz;PrettyTable._get_formatted_latex_string..- s KKKET[/KKKrr2r:r]r3rrmr9z\hliner1rnroc"g|] \}}|v | SrZrZrqs rrz;PrettyTable._get_formatted_latex_string..J rtrrurv) rarsrrqrrrrr) rrwr#wanted_alignments alignment_strrxrr rryrss `` @rrdz'PrettyTable._get_formatted_latex_string" s 8  .#'#4MM!-MKKKK]KKK 8  7!2c!9!9HH%677MM" 7w/I'J 7HH%677MMGG$566M 8  6!2sEl!B!B-/#5M*]:  Y 8  $!2sEl!B!B LL # # # 8  > LLM22W< = = = H  $)C!D $' K 6]KK LL # # #~~g&&**400~~g&&! ( (C!$"3S99K LLK007: ; ; ;x  (WX%6#%=%= Y''' 8  $!2e!;!; LL # # # %&&&{{5!!!rrr)r*)r)r)r)r)r)r)rr)rTrrHrr)r*)r)rr)r")rrr)r)r)r)r)r!r")r#rr$r)u__name__ __module__ __qualname__rrrrrrrrgrrrrrrrrrrrrrrrrpropertyrrrIsetterrWrdrTrHrUrVr>r?r0r-r.r/r4r5r6r1rGr2r3r9r:r;r<r=r@rArBrCrDrErFrLrMrNrOrPrQrRrSr8rJr7rKrxrrrr{r}rrrrrrrrrrrrrrrrrrrrrrrrrrr r(rrrrBrArrerdrZrrr(r(MsG6G6G6G6G6RHHH* ' ' '   !!!!!!&&&(?3?3?3B;;;0KKK QQQ AAA RRR   &OOO XXX ;;; IIIYYY SSSX!!!X!X \\!!X! / / /!!X!6X \ - -\ -X ] * *] *X---X---%%X%$$$%%X%$$$X ]]X \\X \\X ZZX ]]!!X!   X__X ]]""X"!!!X ]]..X.$--%$-X ]]X ]]  X ...""X"000##X# ##X#"""((X('''))X)(( (##X#""" %%X%$$$ EEXE!**"!* ##X#""" ==X=&&& @@X@ ))! ) ??X?(( ( >>X>''' CCXC#,,$#, BBXB"++#"+ FFXF &//'&/ EEXE%..&%. X ]]!!X!     X ""X"!!!6666( * * *///*!!!%%% / / / / / / E E E"',''''''$ & & & & BE@!!!!!& ###     4'''@&@&@&D   :"   777k k k k Z%%%%N   .@@@DVVVp & & & & &%%%%633338((((T0 0 0 dU U U v@"""B4"4"4"4"4"rr(c\tjtd|S)Nr)wcwidthwcswidth_resub)rs rrr^ s!  CGGB,, - --rrd Any | Nonec i}dD]}||vr||||<|rtj|fi|}nctj|d}|dtj||}tdi|}|r||_ndt|D|_|D]!}| d|D"|S)N) delimiter doublequote escapecharlineterminator quotecharquotingskipinitialspacestrictirc6g|]}|SrZstriprs rrzfrom_csv.. s ===1QWWYY===rc6g|]}|SrZrrs rrzfrom_csv.. s ...Qqwwyy...rrZ) rrreaderSniffersniffreadseekr(rdnextr) fprdr fmtparamsparamrdialecttablers rfrom_csvrg sI  1 1 F??%zz%00Ie )B,,),,+--%%bggdmm44  B((  ! !& ! !E>'==V ===00 ..#...//// Lrc |jrPtdi|}d|jD|_|D]}|||SdS)Ncg|] }|d SrrZ)rcols rrz"from_db_cursor.. sBBBSVBBBrrZ) descriptionr(rdfetchallr)cursorrrrs rfrom_db_cursorr sv %%f%%BBv/ABBB??$$  C MM#     rc tdi|}tj|}|d|_|ddD]*fd|jD}||+|S)Nrrc g|] }| SrZrZ)rrobjs rrzfrom_json.. s555Cs3x555rrZ)r(rloadsrdr) json_stringrrr?rrs @r from_jsonr s~  ! !& ! !Ej%%G Eqrr{55555#4555 c Lrc<eZdZd dZd dZd dZd dZdZd dZd S) TableHandlerr)r*c tj|||_g|_g|_g|_d|_d|_d|_d|_ d|_ dS)NrrF) rrrtableslast_rowr max_row_widthactive last_contentis_last_row_headercolspan)rrs rrzTableHandler.__init__ sYD!!! "$ #% !  "' rcr||_|dkrd|_|D]\}}|dkrt||_ dS)NthTr)rrrr)rtagattrsrrs rhandle_starttagzTableHandler.handle_starttag sP $;;&*D # * *JCi"5zz  * *rc^|dvrs|j}|j||jr9t d|jD]}|jdd|_|dkr`|j|j|jft|j t|j|_ g|_d|_|dkr;| |j}|j |g|_d|_d|_ dS) N)rtdrrrtrFrr)rrrrrrrrr!rr generate_tablerr)rrstripped_contentrrs r handle_endtagzTableHandler.handle_endtag s# ,  #06688  M !1 2 2 2| !q$,//--AM((,,,,  $;; I  dmT-DE F F F!$T%7T]9K9K!L!LD DM&+D # '>>'' 22E K  u % % %DI rc&|xj|z c_dSr)r)rdatas r handle_datazTableHandler.handle_data s T!rctdi|j}|jD]}t|d|jkrK|jt|dz }t d|D]}|dd|dr)||d|d|_| |d|S)zE Generates from a list of rows a PrettyTable object. rrr^rZ) r(rrr rrrmake_fields_uniquerdr)rrrrappendsrs rrzTableHandler.generate_table s**dk**9 & &C3q6{{T///,s3q6{{:q'**''AFMM#&&&&1v &''A///$'F!! c!f%%%% rctdt|D]G}t|dzt|D]$}||||kr||xxdz cc<%HdS)zB iterates over the row and make each field unique rr'N)rr )rr0rjs rrzTableHandler.make_fields_unique sq#f++&& % %A1q5#f++.. % %!9q ))1III$III % % %rNr) rrrrrrrrrrZrrrr s    *****""""$%%%%%%rrc Rtdi|}|||jS)z Generates a list of PrettyTables from a string of HTML code. Each in the HTML becomes one PrettyTable object. rZ)rfeedr) html_coderparsers r from_htmlr s1  # #F # #F KK  =rc ht|fi|}n#t$rtdwxYw|dS)zf Generates a PrettyTables from a string of HTML code which contains only a single
zCMore than one
in provided HTML code. Use from_html instead.r)rrr)rrrs r from_html_oner sZ y + +F + +F     Q     !9s)r)rdr)) __future__rrrr-rrrrerrr html.parserrtypingrrrqrsrrrzr|r~rrrrrrcompilerr&r(rrrrrrrrZrrrsD#""""" """"""       %bj*++I$"I$"I$"I$"I$"I$"I$"I$"bH...BF%F%F%F%F%:F%F%F%R     r