
    +pj                   ^   % S SK Jr  S SKJr  S SKJr  S SKJrJrJ	r	  Sr
\
(       a+  S SKJrJrJr  S SKJrJrJr  S SKJr  S S	KJr   " S
 S\5      r " S S\5      r " S S\5      r " S S\5      rS rS\S'   SrS\S'   SrS\S'   SrS\S'   \R>                  r S\S'   \RB                  r"S\S'   \RF                  r$S\S'   \RJ                  r&S\S'   \RN                  r(S\S'   \RR                  r*S\S'   \RV                  r,S\S '   \RZ                  r.S\S!'   S"r/S\S#'   \0\   r1S$\S%'   \S&   r2S$\S''   \S(   r3S$\S)'   \S*   S+-  r4S$\S,'    " S- S.\5\6\4   5      r7\S>S/ j5       r8 " S0 S15      r9\S?S2 j5       r:S@SAS3 jjr;SBS4 jr<SCS5 jr=S6 r> " S7 S85      r?SDS9 jr@SES: jrASFS; jrBSGS< jrCSHS= jrDg+)I    )annotations)IntEnum)	lru_cache)AnyLiteralcastF)CallableMappingSequence)Final	TypeAlias	TypedDict)SupportsRichComparison)Selfc                      \ rS rSr% S\S'   S\S'   S\S'   S\S	'   S
\S'   S
\S'   S
\S'   S
\S'   S\S'   S
\S'   S\S'   S\S'   S\S'   S
\S'   S\S'   S\S'   S\S'   S\S'   S\S '   S\S!'   S\S"'   S\S#'   S\S$'   S\S%'   S&\S''   S&\S('   S&\S)'   S\S*'   S&\S+'   S,\S-'   S
\S.'   S
\S/'   S
\S0'   S&\S1'   S&\S2'   S&\S3'   S&\S4'   S&\S5'   S&\S6'   S&\S7'   S&\S8'   S9\S:'   S;\S<'   S=\S>'   S=\S?'   S@\SA'   S
\SB'   S
\SC'   S
\SD'   SErgF)GOptionsType.   
str | Nonetitleintstart
int | NoneendSequence[str | None] | Nonefieldsboolheaderuse_header_widthborderpreserve_internal_bordersortbyreversesort+Callable[[RowType], SupportsRichComparison]sort_keyCallable[[RowType], bool]
row_filterdict[str, str]
attributesformat
HRuleStylehrules
VRuleStylevrulesstr | dict[str, str] | None
int_formatfloat_formatGCallable[[str, Any], str] | dict[str, Callable[[str, Any], str]] | Nonecustom_formatmin_table_widthmax_table_widthpadding_widthleft_padding_widthright_padding_widthstrvertical_charhorizontal_charhorizontal_align_charheader_horizontal_charjunction_charHeaderStyleTypeheader_stylexhtmlprint_emptyoldsortslice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dict[str, AlignType]aligndict[str, VAlignType]valignint | dict[str, int] | None	min_width	max_width"str | dict[str, str | None] | Nonenone_formatescape_headerescape_databreak_on_hyphens N)__name__
__module____qualname____firstlineno____annotations____static_attributes__rW       S/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/prettytable/prettytable.pyr   r   .   s&   
++"&&==--""//11S	
 $###&&''"" **%%!!  !$$ ##$''#&&##%%....77r^   r   c                  $    \ rS rSrSrSrSrSrSrg)r*   d   r            rW   N)	rX   rY   rZ   r[   FRAMEALLNONEHEADERr]   rW   r^   r_   r*   r*   d   s    E
CDFr^   r*   c                       \ rS rSrSrSrSrSrg)r,   k   r   rb   rc   rW   N)rX   rY   rZ   r[   re   rf   rg   r]   rW   r^   r_   r,   r,   k   s    E
CDr^   r,   c                  8    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrg)
TableStyleq   
                           rW   N)rX   rY   rZ   r[   DEFAULTMSWORD_FRIENDLYPLAIN_COLUMNSMARKDOWNORGMODEDOUBLE_BORDERSINGLE_BORDERRSTRANDOMr]   rW   r^   r_   rl   rl   q   s/    GOMHGMM
CFr^   rl   r   _DEPRECATED_FRAMErb   _DEPRECATED_ALLrc   _DEPRECATED_NONErd   _DEPRECATED_HEADER_DEPRECATED_DEFAULT_DEPRECATED_MSWORD_FRIENDLY_DEPRECATED_PLAIN_COLUMNS_DEPRECATED_MARKDOWN_DEPRECATED_ORGMODE_DEPRECATED_DOUBLE_BORDER_DEPRECATED_SINGLE_BORDER_DEPRECATED_RANDOMbase_align_valueBASE_ALIGN_VALUEr   RowTypelcr	AlignTypetmb
VAlignType)capr   upperlowerNr>   c                  <   ^  \ rS rSrSrU 4S jrSU 4S jjrSrU =r$ )ObservableDict   a  A dictionary that notifies a callback when items are set or changed.

This dictionary subclass allows setting a callback function that will be
invoked whenever an item is set or its value changes. This is used to
maintain consistency between related format dictionaries.
c                4   > [         TU ]  " U0 UD6  SU l        g)zInitialize the observable dictionary.

Arguments:
    *args: Positional arguments passed to dict.__init__
    **kwargs: Keyword arguments passed to dict.__init__
N)super__init__callback)selfargskwargs	__class__s      r_   r   ObservableDict.__init__   s     	$)&)r^   c                   > U R                  U5      nU R                  b  X2:w  a  U R                  XU5        [        TU ]  X5        g)a  Set an item and trigger callback if value changed.

Sets the item in the dictionary and calls the callback function
(if set) with the key, old value, and new value when the value
actually changes.

Arguments:
    key: The dictionary key
    value: The new value to set
N)getr   r   __setitem__)r   keyvalue	old_valuer   s       r_   r   ObservableDict.__setitem__   s<     HHSM	==$);MM#%0C'r^   )r   )r   r8   r   r   )	rX   rY   rZ   r[   __doc__r   r   r]   __classcell__r   s   @r_   r   r      s    ( (r^   r   c                d    U R                  S5      n[        U5      n[        S U 5       5      nX24$ )N
c              3  8   #    U  H  n[        U5      v   M     g 7fN_str_block_width.0lines     r_   	<genexpr>_get_size.<locals>.<genexpr>   s     954 &&5   )splitlenmax)textlinesheightwidths       r_   	_get_sizer      s1    JJtEZF9599E=r^   c                  &   \ rS rSr% S\S'   S\S'   S\S'   S\S	'   S\S
'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S '   S!\S"'   S#\S$'   S%\S&'   S%\S''   S(\S)'   S\S*'   S\S+'   S\S,'   S-\S.'   S-\S/'   S\S0'   S\S1'   S-\S2'   S\S3'   S\S4'   S\S5'   S\S6'   S\S7'   S\S8'   S\S9'   S\S:'   S\S;'   S\S<'   S\S='   S%\S>'   S\S?'   S\S@'   SA\SB'   S\SC'   SD\SE'   S-\SF'   S\SG'   SSSI jjrGS SJ jrGSSK jrSL rGSSM jr	GSSN jr
GSSO jrGSSP jrGS SQ jrSR rSS rST rSU rSV rSW rSX rSY rSZ rS[ rS\ rS] rS^ rS_ rS` rSa r\GSSb j5       r\GSSc j5       r \GSSd j5       r!\!RD                  GSSe j5       r!\GSSf j5       r#\#RD                  GS	Sg j5       r#\GS
Sh j5       r$\$RD                  GSSi j5       r$Sj r%\GSSk j5       r&\&RD                  GSSl j5       r&Sm r'\GSSn j5       r(\(RD                  GSSo j5       r(Sp r)\GSSq j5       r*\*RD                  GSSr j5       r*Ss r+\GSSt j5       r,\,RD                  GSSu j5       r,\GSSv j5       r-\-RD                  GSSw j5       r-\GSSx j5       r.\.RD                  GSSy j5       r.\GSSz j5       r/\/RD                  GSS{ j5       r/\GSS| j5       r0\0RD                  GSS} j5       r0\GSS~ j5       r1\1RD                  GSS j5       r1\GSS j5       r2\2RD                  GSS j5       r2\GSS j5       r3\3RD                  GSS j5       r3\GSS j5       r4\4RD                  GSS j5       r4\GSS j5       r5\5RD                  GSS j5       r5\GSS j5       r6\6RD                  GSS j5       r6\GSS j5       r7\7RD                  GSS j5       r7\GSS j5       r8\8RD                  GSS j5       r8\GSS j5       r9\9RD                  GSS j5       r9\GSS j5       r:\:RD                  GSS j5       r:\GSS j5       r;\;RD                  GSS j5       r;\GS S j5       r<\<RD                  GS!S j5       r<\GS"S j5       r=\=RD                  GS#S j5       r=\GS$S j5       r>\>RD                  GS%S j5       r>\GS$S j5       r?\?RD                  GS%S j5       r?S r@S rA\GS&S j5       rB\BRD                    GS'S j5       rB\GSS j5       rC\CRD                  GSS j5       rC\GSS j5       rD\DRD                  GSS j5       rD\GSS j5       rE\ERD                  GSS j5       rE\GSS j5       rF\FRD                  GSS j5       rF\GSS j5       rG\GRD                  GSS j5       rG\GSS j5       rH\HRD                  GSS j5       rH\GSS j5       rI\IRD                  GSS j5       rI\GSS j5       rJ\JRD                  GSS j5       rJ\GSS j5       rK\KRD                  GSS j5       rK\GSS j5       rL\LRD                  GSS j5       rL\GSS j5       rM\MRD                  GSS j5       rM\GSS j5       rN\NRD                  GSS j5       rN\GSS j5       rO\ORD                  GSS j5       rO\GSS j5       rP\PRD                  GSS j5       rP\GSS j5       rQ\QRD                  GSS j5       rQ\GSS j5       rR\RRD                  GSS j5       rR\GSS j5       rS\SRD                  GSS j5       rS\GSS j5       rT\TRD                  GSS j5       rT\GS$S j5       rU\URD                  GS(S j5       rU\GSS j5       rV\VRD                  GSS j5       rV\GSS j5       rW\WRD                  GSS j5       rW\GSS j5       rX\XRD                  GSS j5       rX\GSS j5       rY\YRD                  GSS j5       rYGS)S jrZGS*S jr[GS S jr\GS S jr]GS S jr^GS S jr_GS S jr`GS S jraGS S jrbGS S jrcGS S jrdSS.GS+S jjreSS.GS,S jjrfGS-S jrgGS S jrh  GS.         GS/S jjriGS0GS1S jjrjGS1S jrkGS S jrlGS S jrmGS2S jrnGS3GS4S jjroGS5S jrpGSS jrqGS6S jrrGS7S jrsGS8S jrtGS9S jruGS:S jrvGS;S jrwGSS jrx GS<     GS=S jjryGS>S jrzGS?S jr{GS@S jr|GSAGSBS jjr}GSS jr~GSS jrGSS jrGS?S jrGS?S jrGSS jrGS?S jrGS?S jrGSS jrSrgH(C  PrettyTable   r   _xhtmlrK   _alignrM   _valigndict[str, int]
_min_width
_max_widthr   _min_table_width_max_table_widthr   _fieldsr   _titler   _start_end_sortby_reversesortr#   	_sort_keyr%   _row_filter_header_use_header_widthr>   _header_style_border_preserve_internal_borderr*   _hrulesr,   _vrulesr'   _int_format_float_format$dict[str, Callable[[str, Any], str]]_custom_format_padding_width_left_padding_width_right_padding_widthr8   _vertical_char_horizontal_char_horizontal_align_char_header_horizontal_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_format_print_empty_oldsortslice_attributes_escape_header_escape_datazTableStyle | None_styleorgmodez	list[int]_widths_hrule_break_on_hyphensNc                
   UR                  SS5      U l        / U l        / U l        / U l        SU l        / SQU l        [        5       U l        U R                  U R                  l
        [        5       U l        U R                  U R                  l
        [        5       U l        U R                  U R                  l
        [        5       U l        U R                  U R                  l
        [        5       U l        SU R                  [         '   U R"                  U R                  l
        [        5       U l        U R&                  U R$                  l
        [        5       U l        U R*                  U R(                  l
        [        5       U l        U R.                  U R,                  l
        0 U l        U(       a  Xl        O/ U l        U R                   HB  nX2;   a'  U R7                  X2U   5        X#   U R0                  U'   M/  SX#'   SU R0                  U'   MD     US   =(       d    SU l        US   =(       d    SU l        US	   =(       d    SU l        US
   =(       d    SU l        US   S;   a  US   U l         OSU l         US   S;   a  US   U l!        OSU l!        US   =(       d    SU l"        US   S;   a  US   U l#        OSU l#        US   S;   a  US   U l$        OSU l$        US   =(       d    [J        RL                  U l'        US   =(       d    [P        RR                  U l*        US   =(       d    SU l+        US   S;   a  US   U l,        OSU l,        US   =(       d    S U l-        US   =(       d    S U l.        US   S;   a  US   U l/        OSU l/        US   S;   a  US   U l0        OSU l0        U Rc                  5         US   =(       d    SU l2        US   =(       d    SU l3        US   c  S U l4        O
US   U l4        US!   =(       d    SU l5        US"   =(       d    SU l6        US#   =(       d    S$U l7        US%   =(       d    S&U l8        US'   U l9        US(   U l:        US)   =(       d    S*U l;        US+   U l<        US,   U l=        US-   U l>        US.   U l?        US/   U l@        US0   U lA        US1   U lB        US2   U lC        US3   S;   a  US3   U lD        OSU lD        US4   S;   a  US4   U lE        OSU lE        US5   =(       d    SU lF        US6   =(       d    SU lG        US7   =(       d    0 U lH        US8   S;   a  US8   U lI        gSU lI        g)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)
use_header_width - reflect width of header (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: HRuleStyle
vrules - controls printing of vertical rules between columns.
    Allowed values: VRuleStyle
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
header_horizontal_char - single character string used to draw the header
    separator, or None to use the same as horizontal_char
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
row_filter - filter function applied on rows
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"
break_on_hyphens - Whether long lines are broken on hyphens or not, default: True
encodingzUTF-8N)1r   r   r   r   r   r   r   r    r!   r"   r$   r&   r(   r)   r+   r-   r/   r0   r2   r3   r4   r5   r6   r7   r9   r:   r;   r<   r=   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rL   rN   rQ   rP   rS   rT   rU   rV   r   r   r   r   r   r   r   TFTr   r?   r   r    Fr+   r-   r!   r"   r$   c                    U $ r   rW   xs    r_   <lambda>&PrettyTable.__init__.<locals>.<lambda>  s    !r^   r&   c                    gNTrW   r  s    r_   r  r    s    dr^   rU   rT   r3   r4   r5   rb   r6   r7   r9   |r:   -r;   r<   r=   +rC   rD   rE   rF   rG   rH   rI   rJ   rA   rB   r)   r@   r(   rV   )Jr   r   _field_names_rows	_dividersr   _optionsr   _none_format_remove_custom_format_callbackr   r   r   r   _custom_format_callbackr   r   _align_callbackr   _valign_callbackr   _max_width_callbackr   _min_width_callback_kwargsfield_namesr   _validate_optionr   r   r   r   r   r   r   r   r   r*   re   r   r,   rf   r   r   r   r   r   r   r   _column_specific_argsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r  r   options       r_   r   PrettyTable.__init__   s   z 

:w7 (*$&
%'2
h 4B3C%)%H%H"2@2B$($G$G!4B4D&*&I&I#DRDT'+'C'C$-;-=(+$%#33.<.> $ 5 51?1A#'#;#; 1?1A#'#;#; *&(DLmmF%%fVn='-~V$!%'+V$ $ Wo-Wo*5M)T	h'/4(},!(+DLDL$%6%+,>%?D"%)D"#N3;t(},!(+DLDL,->-34N-OD*-2D*h';:+;+;h'9:>>h'/4- M1 &} 5D %D
+<!,/CN- M1 &} 5D $D/"m3"("9D"&D""$ &'8 9 AT &'8 9 AT/"*"#D"("9D#)*>#?#G4 $*+@$A$IT!$_5< &'8 9 @S&,-D&E#'-.F'G$$_5<"()<"=%+,B%C"$*+@$A!#)*>#? (./H(I%'-.F'G$+12N+O(*01L*M'- M1 &} 5D $D.!]2!'!7D!&Dh'05Wo.!,/52$%6%+,>%?D"%)D"r^   c                |    S H6  n[        XXR                  ;   a  U R                  U   =(       d    0 O0 5        M8     g )N)rL   rN   rQ   rP   r/   r0   r2   rS   )setattrr  )r   attrs     r_   r  !PrettyTable._column_specific_args  s8    	
D $,,:NT\\$/52TV	
r^   c                    SS K nUS:X  a  UR                  X5      $ US:X  a  UR                  X5      $ UR                  X5      $ )Nr   r   r   )wcwidthljustrjustcenter)r   r   r   rL   r"  s        r_   _justifyPrettyTable._justify  s@    C<==--c\==-->>$..r^   c                    US:X  a  [        U R                  5      $ US:X  a  [        U R                  5      $ [        U5      e)Nrowcountcolcount)r   r  r  AttributeError)r   names     r_   __getattr__PrettyTable.__getattr__  s<    :tzz?"Zt(()) &&r^   c           
        [        5       nU R                  Ul        U R                   H   n[        USU 3[	        U SU 35      5        M"     [        U[        5      (       a)  U R                  U    H  nUR                  U5        M     U$ [        U[        5      (       a   UR                  U R                  U   5        U$ SU S3n[        U5      e)N_zIndex z( is invalid, must be an integer or slice)r   r  r  r  getattr
isinstanceslicer  add_rowr   
IndexError)r   indexnewr  rowmsgs         r_   __getitem__PrettyTable.__getitem__  s    m**MMDC1TFWTQtf:%>? "eU##zz%(C  ) 
 s##KK

5)* 
 5'!IJCS/!r^   c                "    U R                  5       $ r   
get_stringr   s    r_   __str__PrettyTable.__str__        r^   c                "    U R                  5       $ r   r=  r?  s    r_   __repr__PrettyTable.__repr__  rB  r^   c                "    U R                  5       $ )z[
Returns get_html_string value by default
as the repr call in Jupyter notebook environment
)get_html_stringr?  s    r_   _repr_html_PrettyTable._repr_html_   s    
 ##%%r^   c                   US:X  a  U R                  U5        g US:X  a  U R                  U5        g US;   a  U R                  X5        g US:X  a  U R                  X5        g US;   a  U R	                  X5        g US:X  a  U R                  X5        g US:X  a  U R                  X5        g US:X  a  U R                  X5        g US	;   a  U R                  X5        g US
:X  a  U R                  U5        g US:X  a  U R                  X5        g US:X  a  U R                  X5        g US:X  a1  UR                  5        H  u  p4U R	                  U SU 3U5        M     g US;   a  U R                  X5        g US:X  a  U R                  X5        g g )Nr  rS   )	r   r   rQ   rP   r3   r4   r5   r6   r7   r!   )r$   r&   r+   r-   r   )r   r   r   r    r"   r@   r)   rA   rB   rT   rU   rV   r?   r/   r0   r2   .)r9   r:   r;   r<   r=   rC   rD   rE   rF   rG   rH   rI   rJ   r(   )_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_formatitems_validate_single_char_validate_attributes)r   r  valk	formatters        r_   r  PrettyTable._validate_option4  s   ]"&&s+}$&&s+ 

 

 **67x%%f211##F0x!!&.x!!&.x**67 
 
 ((5~%'',|#%%f2~%''4& #		''6(!A3C !, 
 
 &&v3|#%%f2 $r^   c                b   U R                   (       a&   [        U5      [        U R                   5      :X  d   e U R                  (       a)   [        U5      [        U R                  S   5      :X  d   e  [        U5      [        [        U5      5      :X  d   eg ! [         a1    S[        U5       S[        U R                   5       S3n[        U5      ef = f! [         a4    S[        U5       S[        U R                  S   5       S3n[        U5      ef = f! [         a    Sn[        U5      ef = f)Nz9Field name list has incorrect number of values, (actual) != (expected)r   zField names must be unique)r  r   AssertionError
ValueErrorr  setr   r[  r9  s      r_   rL  !PrettyTable._validate_field_namesz  s-   &3x3t'8'8#9999 ::&3x3tzz!}#5555	"s8s3s8},,,# " &  #CzC0A0A,B+C;P  !o%& " &  #CzC

1,>+?{L  !o%&  	".CS/!	"s#   $B 
'C 3#D ;C>DD.c                r     Ub  [        U[        5      (       d   eg g ! [         a    Sn[        U5      ef = f)Nz>Replacement for None value must be a string if being supplied.)r2  r8   rb  	TypeErrorre  s      r_   rM  !PrettyTable._validate_none_format  sB    	!!#s++++  	!RCC. 	!s    6c                L     US;   d   eg ! [          a    Sn[        U5      ef = f)N)r   r   r   r   Nz:Invalid header style, use cap, title, upper, lower or Nonerb  rc  re  s      r_   rU  "PrettyTable._validate_header_style  s4    	"BBBB 	"NCS/!	"s    #c                T     US;   d   eg ! [          a    SU S3n[        U5      ef = f)Nr   
Alignment z is invalid, use l, c or rrk  re  s      r_   _validate_alignPrettyTable._validate_align  s=    	"/))) 	"se#=>CS/!	"    'c                T     US;   d   eg ! [          a    SU S3n[        U5      ef = f)Nr   rn  z is invalid, use t, m, brk  re  s      r_   _validate_valignPrettyTable._validate_valign  s=    	"/))) 	"se#;<CS/!	"rq  c                j     [        U5      S:  d   eg ! [         a    SU SU 3n[        U5      ef = f)Nr   Invalid value for : )r   rb  rc  r   r,  r[  r9  s       r_   rN  %PrettyTable._validate_nonnegative_int  sB    	"s8q= = 	"&tfBse4CS/!	"s    2c                T     US;   d   eg ! [          a    SU S3n[        U5      ef = f)Nr  rv  z. Must be True or False.rk  rx  s       r_   rT  #PrettyTable._validate_true_or_false  s=    	"-''' 	"&tf,DECS/!	"rq  c                    US:X  a  g  [        U[        5      (       d   eUR                  5       (       d   eg ! [         a    SU S3n[	        U5      ef = f)N rv  z#. Must be an integer format string.)r2  r8   isdigitrb  rc  rx  s       r_   rV   PrettyTable._validate_int_format  s\    "9	"c3'''';;== = 	"&tf,OPCS/!	"s	   .8 Ac                   US:X  a  g  [        U[        5      (       d   eSU;   d   eUR                  S5      n[        U5      S::  d   eUS   S:X  d  US   R	                  5       (       d   eUS   S:X  dO  US   R	                  5       (       d6  US   S   S:X  a'  US   R                  S5      R	                  5       (       d   eg g g ! [         a    SU S	3n[        U5      ef = f)
Nr}  rK  rc   r   rb   frv  z . Must be a float format string.)r2  r8   r   r   r~  rstriprb  rc  )r   r,  r[  bitsr9  s        r_   rW  "PrettyTable._validate_float_format  s    "9	"c3''''#::99S>Dt9>!>7b=DGOO$5$555Q27??$$GBK3&47>>#+>+F+F+H+HJ+H %   	"&tf,LMCS/!	"s   B:C C"c                h     [        U5      (       d   eg ! [         a    SU S3n[        U5      ef = f)Nrv  z. Must be a function.)callablerb  rc  rx  s       r_   rP  PrettyTable._validate_function  s=    	"C== = 	"&tf,ABCS/!	"s    1c                n     U[        [        5      ;   d   eg ! [         a    SU S3n[        U5      ef = f)Nrv  z. Must be HRuleStyle.)listr*   rb  rc  rx  s       r_   rQ  PrettyTable._validate_hrules  B    	"$z**** 	"&tf,ABCS/!	"    4c                n     U[        [        5      ;   d   eg ! [         a    SU S3n[        U5      ef = f)Nrv  z. Must be VRuleStyle.)r  r,   rb  rc  rx  s       r_   rR  PrettyTable._validate_vrules  r  r  c                l     X R                   ;   d  Ub   eg g ! [         a    SU 3n[        U5      ef = f)NzInvalid field name: )r  rb  rc  rx  s       r_   rO   PrettyTable._validate_field_name  sG    	",,,#+>>+, 	"(.CS/!	"s    3c                p     U H  nU R                  X5        M     g ! [         a    Sn[        U5      ef = f)Nz(Fields must be a sequence of field names)rO  rb  rc  )r   r,  r[  r  r9  s        r_   rS  %PrettyTable._validate_all_field_names  s=    	"))$2  	"<CS/!	"s    5c                f     [        U5      S:X  d   eg ! [         a    SU S3n[        U5      ef = f)Nrb   rv  z. Must be a string of length 1.)r   rb  rc  rx  s       r_   rY  !PrettyTable._validate_single_char   sB    	"#C(A--- 	"&tf,KLCS/!	"s    0c                j     [        U[        5      (       d   eg ! [         a    Sn[        U5      ef = f)Nz3Attributes must be a dictionary of name/value pairs)r2  dictrb  rh  rx  s       r_   rZ   PrettyTable._validate_attributes  s8    	!c4(((( 	!GCC. 	!s    2c                     U R                   S S  $ r   )r  r?  s    r_   rowsPrettyTable.rows  s    zz!}r^   c                     U R                   S S  $ r   r  r?  s    r_   dividersPrettyTable.dividers  s    ~~a  r^   c                    U R                   $ )z,Print <br/> tags if True, <br> tags if False)r   r?  s    r_   r@   PrettyTable.xhtml  s     {{r^   c                4    U R                  SU5        Xl        g )Nr@   )r  r   r   r[  s     r_   r@   r        gs+r^   c                    U R                   $ r   )r  r?  s    r_   rS   PrettyTable.none_format#  s       r^   c                   [        U[        5      (       aU  U R                   H  nSU R                  U'   M     U R	                  U5        U R                   H  nXR                  U'   M     g[        U[
        5      (       a@  U(       a9  UR                  5        H$  u  p#U R	                  U5        X0R                  U'   M&     gU R                  R                  5         g)zlRepresentation of None values:

Arguments:

val - The alternative representation to be used for None values
N)r2  r8   r  r  rM  r  rX  clearr   r[  fieldfvals       r_   rS   r  '  s     c3**+/!!%( +&&s+**+.!!%( +T""s"yy{**40+/!!%(  + ##%r^   c                    U R                   $ )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.)r  r?  s    r_   r  PrettyTable.field_names<  s        r^   c           	     h   [        SU Vs/ s H  n[        U5      PM     sn5      nU R                  SU5        S nU R                  (       a  U R                  S S  nXl        U R	                  5         U R
                  (       ad  U(       a]  [        X15       H!  u  pEU R
                  U   U R
                  U'   M#     U H&  nXA;  d  M
  U R
                  R                  US 5        M(     OLU R
                  (       a4  U R                   H#  nU R
                  [           U R
                  U'   M%     OSU l	        U R                  (       ad  U(       a]  [        X15       H!  u  pEU R                  U   U R                  U'   M#     U H&  nXA;  d  M
  U R                  R                  US 5        M(     g SU l        g s  snf )N	list[str]r  r   r   )r   r8   r  r  r  r   zippopr   rL   r   rN   )r   r[  r  	old_namesold_namenew_name
field_names          r_   r  r  E  sS   ; 5AQ 56mS1	))!,I""$;;9&))&9"(,H(=H% ':%&KKOOHd3 & [["//
*.++6F*GJ' 0 DJ<<I&))&9")-h)?X& ':%&LL$$Xt4 & DK7 !6s   F/
c                &    U R                  U5        g)a/  Callback to call validators if dict attrs are modified.

This callback is triggered when a field is modified from align dict and
calls the validator for the new value.

Arguments:
    field_name: Name of the field being modified
    old_value: Previous value (unused)
    new_value: New value (unused)

N)ro  r   r  r   	new_values       r_   r  PrettyTable._align_callbackd  s     	Y'r^   c                    U R                   $ )zTControls alignment of fields
Arguments:

align - alignment, one of "l", "c", or "r" )r   r?  s    r_   rL   PrettyTable.alignr  s     {{r^   c                   [        U[        5      (       aA  U R                  (       d  [        U0U l        g U R                   H  nXR                  U'   M     g [        U[
        5      (       a/  U(       a(  UR                  5        H  u  p#X0R                  U'   M     g U R                  (       a#  U R                   H  nSU R                  U'   M     g [        S0U l        g )Nr   )r2  r8   r  r   r   r  rX  r  s       r_   rL   r  z  s    c3$$/5!..E),KK& /T""s"yy{%)E"  +**%(E" + ,S1DKr^   c                &    U R                  U5        g)a0  Callback to call validators if dict attrs are modified.

This callback is triggered when a field is modified from valign dict
and calls the validator for the new value.

Arguments:
    field_name: Name of the field being modified
    old_value: Previous value (unused)
    new_value: New value (unused)

N)rs  r  s       r_   r  PrettyTable._valign_callback  s     	i(r^   c                    U R                   $ )zgControls vertical alignment of fields
Arguments:

valign - vertical alignment, one of "t", "m", or "b" )r   r?  s    r_   rN   PrettyTable.valign  s     ||r^   c                   U R                   (       d  U R                  R                  5         [        U[        5      (       a"  U R                    H  nXR                  U'   M     g [        U[
        5      (       a/  U(       a(  UR                  5        H  u  p#X0R                  U'   M     g U R                    H  nSU R                  U'   M     g )Nr   )r  r   r  r2  r8   r  rX  r  s       r_   rN   r    s      LL c3**&)U# +T""s"yy{&*U#  + **&)U# +r^   c                (    U R                  SU5        g)a3  Callback to call validators if dict attrs are modified.

This callback is triggered when a field is modified from max_width dict
and calls the validator for the new value.

Arguments:
    field_name: Name of the field being modified
    old_value: Previous value (unused)
    new_value: New value (unused)

rQ   Nr  r  s       r_   r  PrettyTable._max_width_callback       	k95r^   c                    U R                   $ )zNControls maximum width of fields
Arguments:

max_width - maximum width integer)r   r?  s    r_   rQ   PrettyTable.max_width       r^   c                .   [        U[        5      (       a"  U R                   H  nXR                  U'   M     g [        U[        5      (       a/  U(       a(  UR                  5        H  u  p#X0R                  U'   M     g U R                  R                  5         g r   )r2  r   r  r   r  rX  r  r  s       r_   rQ   r    j    c3**),& +T""s"yy{)-&  + OO!!#r^   c                (    U R                  SU5        g)a3  Callback to call validators if dict attrs are modified.

This callback is triggered when a field is modified from min_width dict
and calls the validator for the new value.

Arguments:
    field_name: Name of the field being modified
    old_value: Previous value (unused)
    new_value: New value (unused)

rP   Nr  r  s       r_   r  PrettyTable._min_width_callback  r  r^   c                    U R                   $ )zNControls minimum width of fields
Arguments:

min_width - minimum width integer)r   r?  s    r_   rP   PrettyTable.min_width  r  r^   c                .   [        U[        5      (       a"  U R                   H  nXR                  U'   M     g [        U[        5      (       a/  U(       a(  UR                  5        H  u  p#X0R                  U'   M     g U R                  R                  5         g r   )r2  r   r  r   r  rX  r  r  s       r_   rP   r    r  r^   c                    U R                   $ r   )r   r?  s    r_   r3   PrettyTable.min_table_width      $$$r^   c                4    U R                  SU5        Xl        g )Nr3   )r  r   r  s     r_   r3   r        /5 #r^   c                    U R                   $ r   )r   r?  s    r_   r4   PrettyTable.max_table_width  r  r^   c                4    U R                  SU5        Xl        g )Nr4   )r  r   r  s     r_   r4   r    r  r^   c                    U R                   $ )z3List or tuple of field names to include in displays)r   r?  s    r_   r   PrettyTable.fields  s     ||r^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r        h,r^   c                    U R                   $ )z5Optional table title

Arguments:

title - table title)r   r?  s    r_   r   PrettyTable.title       {{r^   c                $    [        U5      U l        g r   )r8   r   r  s     r_   r   r    s    #hr^   c                    U R                   $ )zkStart index of the range of rows to print

Arguments:

start - index of first data row to include in output)r   r?  s    r_   r   PrettyTable.start  r  r^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r  #  r  r^   c                    U R                   $ )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))r   r?  s    r_   r   PrettyTable.end(  s     yyr^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r  1  s    eS)	r^   c                    U R                   $ )zOName of field by which to sort rows

Arguments:

sortby - field name to sort by)r   r?  s    r_   r!   PrettyTable.sortby6       ||r^   c                4    U R                  SU5        Xl        g )Nr!   )r  r   r  s     r_   r!   r  ?  r  r^   c                    U R                   $ )zControls direction of sorting (ascending vs descending)

Arguments:

reveresort - set to True to sort by descending order, or False to sort by
    ascending order)r   r?  s    r_   r"   PrettyTable.reversesortD          r^   c                4    U R                  SU5        Xl        g )Nr"   )r  r   r  s     r_   r"   r  N      mS1r^   c                    U R                   $ )zSorting key function, applied to data points before sorting

Arguments:

sort_key - a function which takes one argument and returns something to be
sorted)r   r?  s    r_   r$   PrettyTable.sort_keyS  s     ~~r^   c                4    U R                  SU5        Xl        g )Nr$   )r  r   r  s     r_   r$   r  ]  s    j#.r^   c                    U R                   $ )z{Filter function, applied to data points

Arguments:

row_filter - a function which takes one argument and returns a Boolean)r   r?  s    r_   r&   PrettyTable.row_filterb  s     r^   c                4    U R                  SU5        Xl        g )Nr&   )r  r   r  s     r_   r&   r  k      lC0r^   c                    U R                   $ )z{Controls printing of table header with field names

Arguments:

header - print a header showing field names (True or False))r   r?  s    r_   r   PrettyTable.headerp  r  r^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r  y  r  r^   c                    U R                   $ )zControls whether header is included in computing width

Arguments:

use_header_width - respect width of fieldname in header to calculate column
    width (True or False)
)r   r?  s    r_   r   PrettyTable.use_header_width~  s     %%%r^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r        0#6!$r^   c                    U R                   $ )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))r   r?  s    r_   r?   PrettyTable.header_style  s     !!!r^   c                2    U R                  U5        Xl        g r   )rU  r   r  s     r_   r?   r    s    ##C( r^   c                    U R                   $ )znControls printing of border around table

Arguments:

border - print a border around the table (True or False))r   r?  s    r_   r   PrettyTable.border  r  r^   c                4    U R                  SU5        Xl        g )Nr   )r  r   r  s     r_   r   r    r  r^   c                    U R                   $ )zControls printing of border inside table

Arguments:

preserve_internal_border - print a border inside the table even if
    border is disabled (True or False))r   r?  s    r_   r    $PrettyTable.preserve_internal_border  s     ---r^   c                4    U R                  SU5        Xl        g )Nr    )r  r   r  s     r_   r    r    s    8#>),&r^   c                    U R                   $ )zzControls printing of horizontal rules after rows

Arguments:

hrules - horizontal rules style.  Allowed values: HRuleStyle)r   r?  s    r_   r+   PrettyTable.hrules  r  r^   c                4    U R                  SU5        Xl        g )Nr+   )r  r   r  s     r_   r+   r    r  r^   c                    U R                   $ )z{Controls printing of vertical rules between columns

Arguments:

vrules - vertical rules style.  Allowed values: VRuleStyle)r   r?  s    r_   r-   PrettyTable.vrules  r  r^   c                4    U R                  SU5        Xl        g )Nr-   )r  r   r  s     r_   r-   r
    r  r^   c                    U R                   $ )zRControls formatting of integer data
Arguments:

int_format - integer format string)r   r?  s    r_   r/   PrettyTable.int_format  s     r^   c                v   [        U[        5      (       a4  U R                  SU5        U R                   H  nXR                  U'   M     g [        U[
        5      (       aA  U(       a:  UR                  5        H%  u  p#U R                  SU5        X0R                  U'   M'     g U R                  R                  5         g )Nr/   )r2  r8   r  r  r   r  rX  r  r  s       r_   r/   r    s    c3!!,4***-  ' +T""s"yy{%%lD9*.  '  + ""$r^   c                    U R                   $ )zbControls formatting of floating point data
Arguments:

float_format - floating point format string)r   r?  s    r_   r0   PrettyTable.float_format  s     !!!r^   c                v   [        U[        5      (       a4  U R                  SU5        U R                   H  nXR                  U'   M     g [        U[
        5      (       aA  U(       a:  UR                  5        H%  u  p#U R                  SU5        X0R                  U'   M'     g U R                  R                  5         g )Nr0   )r2  r8   r  r  r   r  rX  r  r  s       r_   r0   r    s    c3!!.#6**,/""5) +T""s"yy{%%nd;,0""5)  + $$&r^   c                >    XR                   ;   a  U R                   U	 gg)a  Callback to remove custom format when a field is removed from format dicts.

This callback is triggered when a field is removed from _none_format,
_int_format, or _float_format dictionaries, and removes the corresponding
entry from _custom_format if it exists.

Arguments:
    field_name: Name of the field being removed
    old_value: Previous value (unused)
    new_value: New value (unused)
Nr   r  s       r_   r  *PrettyTable._remove_custom_format_callback   s#     ,,,##J/ -r^   c                    XR                   ;   a  U R                   U	 XR                  ;   a  U R                  U	 XR                  ;   a  U R                  U	 gg)a  Callback to remove std formats when a field is removed from custom_format.

This callback is triggered when a field is removed from _custom_format
dictionary, and removes the corresponding entries from _float_format,
_int_format, and _none_format if they exist.

Arguments:
    field_name: Name of the field being removed
    old_value: Previous value (unused)
    new_value: New value (unused)
N)r   r   r  r  s       r_   r  #PrettyTable._custom_format_callback  sW     +++"":.)))  ,***!!*- +r^   c                    U R                   $ )zrControls formatting of any column using callable
Arguments:

custom_format - Dictionary of field_name and callabler  r?  s    r_   r2   PrettyTable.custom_format"  s     """r^   c                   Uc  U R                   R                  5         g[        U[        5      (       a=  UR	                  5        H(  u  p#U R                  SU 3U5        X0R                   U'   M*     g[        U5      (       a4  U R                  SU5        U R                   H  nXR                   U'   M     gSn[        U5      e)aK  Set custom format for columns using callable functions.

Arguments:
    val: Can be:
        - None: Clears all custom formats
        - dict: Dictionary mapping field names to callable functions
        - callable: A single callable function applied to all fields

Raises:
    TypeError: If val is not None, a dict, or a callable
Nzcustom_value.custom_valuez>The custom_format property need to be a dictionary or callable)	r   r  r2  r  rX  rP  r  r  rh  )r   r[  r  r  r9  s        r_   r2   r  *  s      ;%%'T"""yy{''-w(?F-1##E*  + c]]##NC8**-0##E* + SCC. r^   c                    U R                   $ )zThe number of empty spaces between a column's edge and its content

Arguments:

padding_width - number of spaces, must be a positive integer)r   r?  s    r_   r5   PrettyTable.padding_widthH       """r^   c                4    U R                  SU5        Xl        g )Nr5   )r  r   r  s     r_   r5   r  Q      os3!r^   c                    U R                   $ )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   r?  s    r_   r6   PrettyTable.left_padding_widthV  s     '''r^   c                4    U R                  SU5        Xl        g )Nr6   )r  r   r  s     r_   r6   r!  _  s    2C8#& r^   c                    U R                   $ )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   r?  s    r_   r7   PrettyTable.right_padding_widthd  s     (((r^   c                4    U R                  SU5        Xl        g )Nr7   )r  r   r  s     r_   r7   r$  m  s    3S9$'!r^   c                    U R                   $ )zThe character used when printing table borders to draw vertical lines

Arguments:

vertical_char - single character string used to draw vertical lines)r   r?  s    r_   r9   PrettyTable.vertical_charr  r  r^   c                J    [        U5      nU R                  SU5        Xl        g )Nr9   )r8   r  r   r  s     r_   r9   r'  {  !    #hos3!r^   c                    U R                   $ )zThe character used when printing table borders to draw horizontal lines

Arguments:

horizontal_char - single character string used to draw horizontal lines)r   r?  s    r_   r:   PrettyTable.horizontal_char  s     $$$r^   c                J    [        U5      nU R                  SU5        Xl        g )Nr:   )r8   r  r   r  s     r_   r:   r+    s"    #h/5 #r^   c                @    U R                   =(       d    U R                  $ )zThe character used to indicate column alignment in horizontal lines

Arguments:

horizontal_align_char - single character string used to indicate alignment)r   r=   r?  s    r_   r;   !PrettyTable.horizontal_align_char  s     **@d.@.@@r^   c                J    [        U5      nU R                  SU5        Xl        g )Nr;   )r8   r  r   r  s     r_   r;   r.    s"    #h5s;&)#r^   c                    U R                   $ )zThe character used when printing the header separator line

Arguments:

header_horizontal_char - single character string used to draw the header
separator, or None to use the same as horizontal_char)r   r?  s    r_   r<   "PrettyTable.header_horizontal_char  s     +++r^   c                P    Ub  [        U5      nU R                  SU5        Xl        g )Nr<   )r8   r  r   r  s     r_   r<   r1    s'    ?c(C!!":C@'*$r^   c                    U R                   $ )zThe character used when printing table borders to draw line junctions

Arguments:

junction_char - single character string used to draw line junctions)r   r?  s    r_   r=   PrettyTable.junction_char  r  r^   c                J    [        U5      nU R                  SU5        Xl        g )Nr=   )r8   r  r   r  s     r_   r=   r4    r)  r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rC   PrettyTable.top_junction_char  s     &&<$*<*<<r^   c                J    [        U5      nU R                  SU5        Xl        g )NrC   )r8   r  r   r  s     r_   rC   r7    s"    #h137"%r^   c                @    U R                   =(       d    U R                  $ )zThe character used when printing table borders to draw bottom line junctions

Arguments:

bottom_junction_char -
    single character string used to draw bottom line junctions)r   r=   r?  s    r_   rD    PrettyTable.bottom_junction_char  s     ))?T-?-??r^   c                J    [        U5      nU R                  SU5        Xl        g )NrD   )r8   r  r   r  s     r_   rD   r:    s"    #h4c:%("r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rE   PrettyTable.right_junction_char  s     ((>D,>,>>r^   c                J    [        U5      nU R                  SU5        Xl        g )NrE   )r8   r  r   r  s     r_   rE   r=    s"    #h3S9$'!r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rF   PrettyTable.left_junction_char  s     ''=4+=+==r^   c                J    [        U5      nU R                  SU5        Xl        g )NrF   )r8   r  r   r  s     r_   rF   r@    s"    #h2C8#& r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rG   #PrettyTable.top_right_junction_char  s     ,,B0B0BBr^   c                J    [        U5      nU R                  SU5        Xl        g )NrG   )r8   r  r   r  s     r_   rG   rC    s"    #h7=(+%r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rH   "PrettyTable.top_left_junction_char  s     ++At/A/AAr^   c                J    [        U5      nU R                  SU5        Xl        g )NrH   )r8   r  r   r  s     r_   rH   rF    s"    #h6<'*$r^   c                @    U R                   =(       d    U R                  $ )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)r   r=   r?  s    r_   rI   &PrettyTable.bottom_right_junction_char  s     //E43E3EEr^   c                J    [        U5      nU R                  SU5        Xl        g )NrI   )r8   r  r   r  s     r_   rI   rI  *  s"    #h:C@+.(r^   c                @    U R                   =(       d    U R                  $ )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 junctions)r   r=   r?  s    r_   rJ   %PrettyTable.bottom_left_junction_char0  s     ..D$2D2DDr^   c                J    [        U5      nU R                  SU5        Xl        g )NrJ   )r8   r  r   r  s     r_   rJ   rL  ;  s"    #h93?*-'r^   c                    U R                   $ )znControls whether or not HTML tables are formatted to match styling options

Arguments:

format - True or False)r   r?  s    r_   r)   PrettyTable.formatA  r  r^   c                4    U R                  SU5        Xl        g )Nr)   )r  r   r  s     r_   r)   rO  J  r  r^   c                    U R                   $ )zControls whether or not empty tables produce a header and frame or just an
empty string

Arguments:

print_empty - True or False)r   r?  s    r_   rA   PrettyTable.print_emptyO  r  r^   c                4    U R                  SU5        Xl        g )NrA   )r  r   r  s     r_   rA   rR  Y  r  r^   c                    U R                   $ )zA dictionary of HTML attribute name/value pairs to be included in the
<table> tag when printing HTML

Arguments:

attributes - dictionary of attributes)r   r?  s    r_   r(   PrettyTable.attributes^  s     r^   c                4    U R                  SU5        Xl        g )Nr(   )r  r   r  s     r_   r(   rU  h  r  r^   c                    U R                   $ )z<oldsortslice - Slice rows before sorting in the "old style" )r   r?  s    r_   rB   PrettyTable.oldsortslicem  s     !!!r^   c                4    U R                  SU5        Xl        g )NrB   )r  r   r  s     r_   rB   rX  r  s    nc2 r^   c                    U R                   $ )z0Escapes the text within a header (True or False))r   r?  s    r_   rT   PrettyTable.escape_headerw  s     """r^   c                4    U R                  SU5        Xl        g )NrT   )r  r   r  s     r_   rT   r[  |  r  r^   c                    U R                   $ )z4Escapes the text within a data field (True or False))r   r?  s    r_   rU   PrettyTable.escape_data  s        r^   c                4    U R                  SU5        Xl        g )NrU   )r  r   r  s     r_   rU   r^    r  r^   c                    U R                   $ )z*Break longlines on hyphens (True or False))r   r?  s    r_   rV   PrettyTable.break_on_hyphens  s     %%%r^   c                4    U R                  SU5        Xl        g )NrV   )r  r   r  s     r_   rV   ra    r  r^   c                    0 nU R                    H1  nX1;   a  U R                  X1U   5        X   X#'   M$  [        X5      X#'   M3     [        SU5      $ )Nr   )r  r  r1  r   )r   r   optionsr  s       r_   _get_optionsPrettyTable._get_options  sQ    "$mmF%%fVn="(.")$"7 $ M7++r^   c                   U R                  5         Xl        U[        R                  :X  a  U R	                  5         g U[        R
                  :X  a  U R                  5         g U[        R                  :X  a  U R                  5         g U[        R                  :X  a  U R                  5         g U[        R                  :X  a  U R                  5         g U[        R                  :X  a  U R                  5         g U[        R                  :X  a  U R!                  5         g U[        R"                  :X  a  U R%                  5         g U[        R&                  :w  a  Sn[)        U5      eg )NzInvalid pre-set style)_set_default_styler   rl   rx   _set_msword_stylery   _set_columns_stylerz   _set_markdown_styler{   _set_orgmode_styler|   _set_double_border_styler}   _set_single_border_styler~   _set_rst_styler   _set_random_stylerw   rc  )r   styler9  s      r_   	set_stylePrettyTable.set_style  s   !J...""$j...##%j)))$$&j(((##%j...))+j...))+jnn$!j'''""$j((()CS/! )r^   c                    SU l         g r  )r   r?  s    r_   rl  PrettyTable._set_orgmode_style  s	    r^   c                    SU l         SU l        [        R                  U l        SU l        SU l        SU l        SU l        SU l	        SU l
        g )NTrb   r	  :)r   r   r*   rh   r   r5   r6   r7   r9   r=   r   r?  s    r_   rk  PrettyTable._set_markdown_style  sM    !(("##$   &)#r^   c                    SU l         SU l        [        R                  U l        SU l        SU l        SU l        SU l        SU l	        SU l
        S U l        SU l        g )NTrb   r	  r  r
  =)r   r   r*   rf   r   r5   r6   r7   r9   r=   r:   r   r<   r?  s    r_   ro  PrettyTable._set_rst_style  s[    !~~"##$   "&*#&)#r^   c                T   SU l         SU l        [        R                  U l        [
        R                  U l        SU l        SU l	        SU l
        SU l        SU l        S U l        S U l        SU l        S U l        S U l        S U l        S U l        S U l        S U l        S U l        S U l        g )NTrb   r	  r
  r  )r   r   r*   re   r   r,   rf   r   r5   r6   r7   r9   r:   r   r<   r=   r   r   r   r   r   r   r   r   r?  s    r_   rh  PrettyTable._set_default_style  s    !''!~~"##$  "&*#&*# "&%)"$(!#' (,%'+$+/(*.'r^   c                    SU l         SU l        [        R                  U l        SU l        SU l        SU l        SU l        g )NTrb   r	  )	r   r   r*   rg   r   r5   r6   r7   r9   r?  s    r_   ri  PrettyTable._set_msword_style  s;    !"##$  r^   c                J    SU l         SU l        SU l        SU l        SU l        g )NTFrb   r      )r   r   r5   r6   r7   r?  s    r_   rj  PrettyTable._set_columns_style  s(    "##$ r^   c                    SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        S	U l        S
U l	        SU l
        g )Nu   ═u   ║u   ╬u   ╦u   ╩u   ╣u   ╠u   ╗u   ╔u   ╝u   ╚r:   r9   r=   rC   rD   rE   rF   rG   rH   rI   rJ   r?  s    r_   rm  $PrettyTable._set_double_border_style  Z    $""!&$)!#( "'',$&+#*/').&r^   c                    SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        S	U l        S
U l	        SU l
        g )Nu   ─u   │u   ┼u   ┬u   ┴u   ┤u   ├u   ┐u   ┌u   ┘u   └r  r?  s    r_   rn  $PrettyTable._set_single_border_style  r  r^   c                   SS K nUR                  S5      U l        UR                  S5      U l        UR                  [	        [
        5      5      U l        UR                  [	        [        5      5      U l        UR                  SS5      U l
        UR                  SS5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        g )Nr   r     z!~!@#$%^&*()_+|-=\{}[];':\",./;<>?)randomchoicer   r   r  r*   r   r,   r   randintr6   r7   r9   r:   r=   r    )r   r  s     r_   rp  PrettyTable._set_random_style  s    mmM2mmM2}}T*%56}}T*%56"(..A"6#)>>!Q#7 #]]+OP%}}-QR#]]+OP(.m(D%r^   Fdividerc                   USS  H  nU R                  U5        M     [        U5      S:  a  U R                  US   US9  gg)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 fields

divider - add row divider after the row block
Nr  r   r  )r4  r   )r   r  r  r8  s       r_   add_rowsPrettyTable.add_rows,  sF     9CLL  t9q=LLb7L3 r^   c                  U R                   (       aR  [        U5      [        U R                   5      :w  a0  S[        U5       S[        U R                   5       S3n[        U5      eU R                   (       d0  [        [        U5      5       Vs/ s H  nSUS-    3PM     snU l        U R
                  R                  [        U5      5        U R                  R                  U5        gs  snf )zuAdd 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) r`  ra  zField rb   N)	r  r   rc  ranger  r  appendr  r  )r   r8  r  r9  ns        r_   r4  PrettyTable.add_row<  s     SS1B1B-C!CH:RD,=,=(>'?{L  S/!  :?C/J/Q&Q 0/JD

$s)$g&  Ks   C%c                    U[        U R                  5      S-
  :  a'  SU S[        U R                  5       S3n[        U5      eU R                  U	 U R                  U	 g)ztDelete a row from the table

Arguments:

row_index - The index of the row you want to delete.  Indexing starts at 0.rb   zCan't delete row at index z, table only has z rowsN)r   r  r5  r  )r   	row_indexr9  s      r_   del_rowPrettyTable.del_rowO  sc     s4::**,YK 8""%djj/!2%9  S/!JJy!NN9%r^   c                V    [        U R                  5      S:  a  SU R                  S'   gg)zAdd a divider to the tablerb   Tr  N)r   r  r?  s    r_   add_dividerPrettyTable.add_divider_  s&    t~~!#!%DNN2 $r^   c                v   [        U R                  5      S[        U5      4;   a  U R                  U5        U R                  U5        U R                  R                  U5        X0R                  U'   X@R                  U'   [        [        U5      5       Hu  n[        U R                  5      US-   :  a6  U R                  R                  / 5        U R                  R                  S5        U R                  U   R                  X%   5        Mw     gS[        U5       S[        U R                  5       3n[        U5      e)a  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 right
valign - desired vertical alignment for new columns - "t" for top,
    "m" for middle and "b" for bottomr   rb   FzColumn length z does not match number of rows N)r   r  ro  rs  r  r  r   r   r  r  rc  )r   	fieldnamecolumnrL   rN   ir9  s          r_   
add_columnPrettyTable.add_columnd  s    & tzz?q#f+..  '!!&)$$Y/%*KK	"&,LL#3v;'tzz?QU*JJ%%b)NN))%0

1$$VY/	 ( !V-Ltzz?#%  S/!r^   c                6   U R                   R                  SU5        U R                  S   =(       d    SU R                  U'   U R                  S   =(       d    SU R                  U'   [        U R                  5       H  u  p#UR                  SUS-   5        M     g)z~Add an auto-incrementing index column to the table.
Arguments:
fieldname - name of the field to contain the new column of datar   rL   r   rN   r   rb   N)r  insertr  r   r   	enumerater  )r   r  r  r8  s       r_   add_autoindexPrettyTable.add_autoindex  sy     	  I.!%g!6!=#I"&,,x"8"?CY

+FAJJq!a%  ,r^   c           	     $   XR                   ;  aD  SR                  USR                  [        [        U R                   5      5      5      n[        U5      eU R                   R                  U5      nU R                   U	 U R                   H  nXC	 M     g)zhDelete a column from the table

Arguments:

fieldname - The field name of the column you want to delete.zUCan't delete column {!r} which is not a field name of this table. Field names are: {}z, N)r  r)   joinmapreprrc  r6  r  )r   r  r9  	col_indexr8  s        r_   
del_columnPrettyTable.del_column  s     ---''-vtyyT43D3D)EF(  S/!%%++I6	i(::C r^   c                     / U l         / U l        g)z?Delete all rows from the table but keep the current field namesN)r  r  r?  s    r_   
clear_rowsPrettyTable.clear_rows  s     
r^   c                <    / U l         / U l        / U l        / U l        g)zWDelete all rows and field names from the table, maintaining nothing but
styling optionsN)r  r  r  r   r?  s    r_   r  PrettyTable.clear  s!     
r^   c                ,    SS K nUR                  U 5      $ Nr   )copydeepcopy)r   r  s     r_   r  PrettyTable.copy  s    }}T""r^   c                D   US:X  a  U R                   " S	0 UD6$ US:X  a  U R                  " S	0 UD6$ US:X  a  U R                  " S	0 UD6$ US:X  a  U R                  " S	0 UD6$ US:X  a  U R                  " S	0 UD6$ US:X  a  U R
                  " S	0 UD6$ SU S3n[        U5      e)
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   htmljsoncsvlatex	mediawikizInvalid format z;. Must be one of: text, html, json, csv, latex or mediawikirW   )r>  rG  get_json_stringget_csv_stringget_latex_stringget_mediawiki_stringrc  )r   
out_formatr   r9  s       r_   get_formatted_string PrettyTable.get_formatted_string  s     ??,V,,''1&11''1&11&&000 ((2622$,,6v66 j\ *H H 	 or^   c                P   [        U[        5      (       a%  XR                  ;   a  SU R                  U    S3U-  $ [        U[        5      (       a%  XR                  ;   a  SU R                  U    S3U-  $ U R
                  R                  US 5      nU" X5      R                  5       $ )N%dr  c                    [        U5      $ r   )r8   )r  vs     r_   r  +PrettyTable._format_value.<locals>.<lambda>  s    Qr^   )r2  r   r   floatr   r   r   
expandtabs)r   r  r   r]  s       r_   _format_valuePrettyTable._format_value  s    eS!!e/?/?&?((/02e;;u%%%3E3E*E**512!4==''++E4GI	 &1133r^   c                P   US   [         R                  :X  a  SnOUS   [         R                  :X  a  SnOSn[        U R	                  U5      5      n[        U R                  5       H<  u  pEUS   (       a  US   (       d  M  XQS   ;   d  M%  X R                  U   U-   S-   -  nM>     U$ )Nr-   rc   rb   r   r   )r,   re   rf   sum_get_padding_widthsr  r  r   )r   rd  table_widthper_col_paddingr6  r  s         r_   _compute_table_width PrettyTable._compute_table_width  s    8
 0 00KX*..0KKd66w?@ )$*:*: ;E8$!!i83D&D||E2_DqHH	 !<
 r^   c           
     F   US   (       a3  US   (       a)  U R                    Vs/ s H  n[        U5      S   PM     nnO[        U R                  5      S/-  nU GH"  n[	        U5       GH  u  pgU R                  U   nUS:X  a   U R
                  R                  U5      =n	b  U	nXR                  ;   a4  [        XF   [        [        U5      S   U R                  U   5      5      XF'   O[        XF   [        U5      S   5      XF'   XR                  ;   a  [        XF   U R                  U   5      XF'   U R                  [        R                  :X  d  M  U R                  U   S;   a  Sn
OSn
[        XU   5      XF'   GM     GM%     X@l        [!        U R#                  U5      5      nU R$                  (       a~  U R'                  U5      nXR$                  :  a^  U[        U5      -  [        U5      -   S-
  nU R$                  U-
  X-
  -  nU Vs/ s H  n[        S[)        X-  5      5      PM     snU l        U R*                  (       d  US   (       GaC  US   (       aT  [        S	 US   R-                  S
5       5       5      U-   nUS   [.        R0                  [.        R2                  4;   a  US-  nOSnU R4                  =(       d    Sn[        UU5      n
US   (       a  [        U5      S-   nOUS   (       a  [        U5      nOSnU
[!        U Vs/ s H  nUPM     sn5      U-   -  n
[!        U5      =(       d    SnUU
:  aT  SU
-  U-  nU Vs/ s H  n[)        X-  5      PM     nn[!        U5      U
:  a  US==   U
[!        U5      -
  -  ss'   X@l        g g g s  snf s  snf s  snf s  snf )Nr   r   r   None)r   r   rb   rd   r   c              3  8   #    U  H  n[        U5      v   M     g 7fr   r   r   s     r_   r   .PrettyTable._compute_widths.<locals>.<genexpr>4  s     X;W4(..;Wr   r   r-   rc   r   r    g      ?r  )r  r   r   r  r  rS   r   rQ   r   minrP   r   rl   rz   r   r   r  r  r   r  r   r   r   r,   re   rf   r3   )r   r  rd  r  widthsr8  r6  r   r  none_valrP   r  r  markup_charsscalewtitle_widthr3   bordersr0  content_widths                        r_   _compute_widthsPrettyTable._compute_widths  sb   8);!<7;7H7HI7Hei&q)7HFIF))*aS0FC )# ,,U3	VO%)%5%5%9%9)%DDQ$E.$'Ie,Q/	1JK%FM
 %(y7G7J$KFM.$'t~~i7P$QFM;;*"5"55{{9-;$%	$%	$'	%=$AFM/ !/ 4 d66w?@  33G<K222.V<s6{JQN..=. AGG1As19~ 6G   GG$4$4wX77;K;Q;QRV;WXX%&  8$)9)9:>>(JJ1$K"227aOK9Ix f+/34f+ v>v!ov>?'IIIK,1My(i-7289&Q#ai.&9v;*2J)c&k"99J% )1 %5[ JT  H. ? :s   N!NN
Nc                P    US   b  US   nOUS   nUS   b  US   nX#4$ US   nX#4$ )Nr6   r5   r7   rW   )r   rd  lpadrpads       r_   r  PrettyTable._get_padding_widthsQ  sX    '(4/0D?+D()501D z ?+Dzr^   c                   US   (       a  U R                   US   US    nOU R                   nU Vs/ s H  o1S   " U5      (       d  M  UPM     nnUS   (       a`  U R                  R                  US   5      nU Vs/ s H  o3U   /U-   PM     nnUR                  US   US   S9  U Vs/ s H  o3S	S
 PM	     nnUS   (       d
  X!S   US    nU$ s  snf s  snf s  snf )zReturn only those data rows that should be printed, based on slicing and
sorting.

Arguments:

options - dictionary of option settings.rB   r   r   r&   r!   r"   r$   )reverser   rb   N)r  r  r6  sort)r   rd  r  r8  	sortindexs        r_   	_get_rowsPrettyTable._get_rows\  s     >"::gg.@D::D#Bt|'<S'AtB 8))//0ABI6:;ds^$s*dD;IIgm4'*:MIN'+,tGtD, ~&(75>:D! C < -s   CC<C*Cc                    US   (       a  U R                   US   US    nOU R                   nUS   (       a  U Vs/ s H  nSPM     nnU$ s  snf )zzReturn only those dividers that should be printed, based on slicing.

Arguments:

options - dictionary of option settings.rB   r   r   r!   Fr  )r   rd  r  r  s       r_   _get_dividersPrettyTable._get_dividers{  sT     >"~~gg&6HH~~H8-56X'XH6 7s   Ac                    [        U R                  U5       VVs/ s H  u  p#U R                  X#5      PM     snn$ s  snnf r   )r  r  r  )r   r8  r  r   s       r_   _format_rowPrettyTable._format_row  sC     #&d&7&7"=
"= u,"=
 	
 
s   ;c                N    U Vs/ s H  o R                  U5      PM     sn$ s  snf r   )r  )r   r  r8  s      r_   _format_rowsPrettyTable._format_rows  s#    156#  %666s   "c                P   U R                  U5      n/ nU R                  S:X  a  US   (       a
  US   (       d  gU R                  U5      nU R                  U5      nU R	                  U5      nU R                  Xb5        U R                  U5      U l        US   =(       d    U R                  nU(       ax  U R                  [        R                  :w  a!  UR                  U R                  Xr5      5        O9UR                  UR                  S5       Vs/ s H	  nSU S3PM     snS/-   5        US   (       a!  UR                  U R!                  U5      5        OUS   (       a  US	   ["        R$                  ["        R&                  4;   a  UR                  U R                  US
S95        U(       av  US   [(        R$                  [(        R&                  4;   aO  [+        U R,                  5      n	[+        U R.                  5      n
U R,                  US   X*  -   U R.                  -   US'   [1        USS USS 5       HY  u  pUR                  U R3                  XU R                  5      5        U(       d  M9  UR                  U R                  U5      5        M[     U(       a3  UR                  U R3                  US   UU R                  USS95      5        US   (       a6  US	   ["        R&                  :X  a  UR                  U R                  USS95        SU R4                  ;   aq  U R6                  (       a`  [+        U R,                  5      n	[+        U R.                  5      n
U VVs/ s H'  nUR                  S5        H  nSXU
*  -   S-   PM     M)     nnnSR9                  U5      $ s  snf s  snnf )a1
  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)
use_header_width - reflect width of header (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: HRuleStyle
vrules - controls printing of vertical rules between columns.
    Allowed values: VRuleStyle
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
header_horizontal_char - single character string used to draw the header
    separator, or None to use the same as horizontal_char
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
row_filter - filter function applied on rows
print empty - if True, stringify just the header for an empty table,
    if False return an empty stringr   rA   r   r}  r   r   z**r   r+   top_)wherer-   r  Nbottom_r   r	  )re  r)  r  r  r  r  _stringify_hruler   r   r   rl   rz   r  _stringify_titleextendr   _stringify_headerr*   rf   re   r,   r   rF   rE   r  _stringify_row__dict__r   r  )r   r   rd  r   r  r  formatted_rowsr   r   
left_j_lenright_j_lenr8  r  old_linenew_lines                  r_   r>  PrettyTable.get_string  sF   f ##F+ ==Aw}'=WXEV ~~g&%%g. **40 	^5++G4  /DKK{{j111T225BCD8IJ8I4&m8IJbTQR 8LL//89X78#4NN9
 $
 LL..wf.EF*z~~z?O?O.PP !8!89
!$":":;++Bi
<89../ b	  s 3Xcr]CLCLL,,S4;;GHwT227;< D LL##"2&))')C 8!2j6F6F!FLL..wi.HI%$,,T445Jd667K !& %H (t 4H h;,77#= 4 > %   yy] KPs   N.N"c                   US   (       d  US   (       d  gU R                  U5      u  p4US   [        R                  [        R                  4;   a	  X S3   /nOUS   /nU R                  (       d'  UR                  X S3   5        SR                  U5      $ [        U R                  U R                  5       H  u  pgUS   (       a
  XaS   ;  a  M  Xs-   U-   US   -  nU R                  (       aP  U R                  U   S	;   a  S
U R                  -   USS  -   nU R                  U   S;   a  US S U R                  -   S
-   nUR                  U5        US   [        R                  :X  a  UR                  X S3   5        M  UR                  US   5        M     US   [        R                  [        R                  4;   a&  UR                  5         UR                  X S3   5        US   (       a  US   (       d  USS nSR                  U5      $ )Nr   r    r}  r-   rF   r:   rE   r   )r   r    rc   )r   r   r=   rb   r  )r  r,   rf   re   r  r  r  r  r   r   r   r  )	r   rd  r  r  r  r  r  r   r   s	            r_   r   PrettyTable._stringify_hrule	  s    x 1K)L--g6
81A1A BBg%789:D-./D  KK')< =>?774=  1 14<<@LEx U(2C%CL4'73D+EED **;;u%3!<!<<tABxGD;;u%39t'B'BBSHDKKx JNN2Gg]$;<=G$567# A$ 81A1A BBHHJKK')< =>?-.wx7H":Dwwt}r^   c           	        / nUS   (       a  US   [         R                  :X  aH  [         R                  US'   UR                  U R	                  US5      5        [         R                  US'   O8US   [         R                  :X  a!  UR                  U R	                  US5      5        US   [         R                  [         R                  4;   a  US   (       a  US   OSnU R                  U5      u  pV[        U R                   Vs/ s H  owU-   U-   S-   PM     sn5      nUR                  S5       H:  n	SU-  U	-   SU-  -   n
UR                  X@R                  XS-
  S5      -   U-   5        M<     SR                  U5      $ s  snf )	Nr   r-   r  r9   r  rb   r   r   )r,   rf   re   r  r   r  r  r   r   r&  r  )r   r   rd  r   endpointr  r  r  
sum_widths
title_linepaddeds              r_   r  PrettyTable._stringify_title>	  s`   8x JNN2$.$4$4!T227FCD$.NN!"j&6&66T227FCD x Z^^Z5E5E$FF! O$ 	 	 --g6
t||D|!d(T/A-|DE
++d+J4Z*,sTz9FLL==aEEP ,
 yy Es   E=c           
     L   / nU R                  U5      u  p4US   (       Ga&  US   [        R                  [        R                  4;   a  UR	                  U R                  US5      5        US   (       av  US   [        R                  [        R                  4;   aO  [        U R                  5      n[        U R                  5      nU R                  US   XV*  -   U R                  -   US'   UR	                  S5        US   [        R                  [        R                  4;   a  UR	                  US   5        OUR	                  S	5        U R                  (       dM  US   [        R                  [        R                  4;   a  UR	                  US   5        OUR	                  S	5        [        U R                  U R                  5       GHD  u  pxUS
   (       a
  XqS
   ;  a  M  U R                  S:X  a  UR                  5       n	OeU R                  S:X  a  UR                  5       n	ODU R                  S:X  a  UR!                  5       n	O#U R                  S:X  a  UR#                  5       n	OUn	[%        U	5      U:  a  U	S U n	UR	                  S	U-  U R'                  XU R(                  U   5      -   S	U-  -   5        US   (       d  US   (       d  GM  US   [        R                  :X  a  UR	                  US   5        GM3  UR	                  S	5        GMG     US   (       d+  US   (       a!  UR+                  5         UR	                  S	5        US   (       a;  US   [        R                  :X  a$  UR+                  5         UR	                  US   5        US   (       d
  US   (       ay  US   [        R,                  :w  ab  UR	                  S5        US   (       a,  0 UESUS   0En
UR	                  U R                  U
5      5        OUR	                  U R.                  5        SR1                  U5      $ )Nr   r+   r  r   r-   r  r   r9   r  r   r   r   r   r    r<   r:   r}  )r  r*   rf   re   r  r   r,   r   rF   rE   r  r  r   r   
capitalizer   r   r   r   r&  r   r  rg   r   r  )r   rd  r  r  r  r  r  r  r   r  header_optionss              r_   r  PrettyTable._stringify_headerV	  s   --g6
8x Z^^Z5E5E$FFD11'6BC7#(9NN$$> ) "%T%<%<!=J"%d&>&>"?K//r(:l;<223 H
 D!x Z^^Z5E5E$FFGO45C   x Z^^Z5E5E$FFGO45C  1 14<<@LEx U(2C%C!!U*!,,.	##w.!KKM	##w.!KKM	##w.!KKM	!		*U2%fu-	KKd
--	$++e2DEF*
 x G,F$G$G8$
6KK 89KK$1 A8 x W-G%HHHJKK 8!2j6F6F!FHHJKK01H)C!D'K
__K KK/0""%w/G'H" D11.ABDKK(wwt}r^   c                D   SS K n[        [        [        U5      5      U R                  XR
                  5       H  u  pVpxUR                  S5      n	/ n
U	 Hk  nUS:X  a   U R                  R                  U5      =nb  Un[        U5      U:  a"  SR                  UR                  XUS   S95      nU
R                  U5        Mm     U
n	SR                  U	5      nXqU'   M     [        S U 5       5      n/ nU R                  U5      u  nn[        U5       H{  nUR                  / 5        US   (       d  M   US   [        R                   [        R"                  4;   a   UU   R                  U R$                  5        Mg  UU   R                  S	5        M}     [        U R                  XR
                  5       GHN  u  pgnU R&                  U   nUR                  S5      n	U[        U	5      -
  nU(       aK  US
:X  a,  S/[)        US-  5      -  U	-   S/U[)        US-  5      -
  -  -   n	OUS:X  a
  S/U-  U	-   n	O	U	S/U-  -   n	[+        U	5       H  u  nnUS   (       a
  XbS   ;  a  M  UU   R                  S	U-  U R-                  XU R.                  U   5      -   S	U-  -   5        US   (       d  US   (       d  Mm  US   [        R                   :X  a   UU   R                  U R$                  5        M  UU   R                  S	5        M     GMQ     US   (       d1  US   (       a'  US   R1                  5         US   R                  S	5        [        U5       HR  nUS   (       d  M  US   [        R"                  :X  d  M(  UU   R1                  5         UU   R                  US   5        MT     US   (       aC  US   [2        R                   :X  a,  XS-
     R                  S5        XS-
     R                  U5        U Vs/ s H  nSR                  U5      PM     nnSR                  U5      $ s  snf )Nr   r   r  rV   )rV   c              3  >   #    U  H  n[        U5      S    v   M     g7f)rb   N)r   )r   r   s     r_   r   -PrettyTable._stringify_row.<locals>.<genexpr>	  s     6#Q1a#s   r   r-   r  r   r}  rc   r   r   r    r  r9   r+   rb   )r"  r  r  r   r  r   r   rS   r   r   r  wrapr  r   r  r,   rf   re   r9   r   r   r  r&  r   r  r*   )r   r8  rd  hruler"  r6  r  r   r   r   	new_linesr   r  
row_heightr  r  r  yrN   d_heightbits_ybits_strs                         r_   r  PrettyTable._stringify_row	  s   *-#c(OT..\\+
&E% KK%E#%IFN%)%5%5%9%9%%@@M#D#D)E199 'BT:U % D
   &  EIIe$EJ++
. 6#66
 "--g6
dz"AKKOx  8$9I9I(JJGNN4#5#56GNN3' # $'t'8'8#||#LE%\\%(FKK%E!CJ.HS=s8a<00 $(SA->">?@ 
 s]D8Oe3E!RD8O3E$U+48$h6G)GQ$JmmDU1CDEDj!
 8$0J(K(Kx(JNN:Qt'9'9:Qs+ ,! $MB x W-G%HHLLNHOOC  z"Ax  WX%6*:J:J%JQQw78 #
 8!2jnn!Da ''-a ''.267$BGGFO$7yy"" 8s   /Pc                *   / nUR                  SS5      US'   UR                  SU R                  5      n [        US   U-   U5      US'   UR                  U R                  " S0 UD65        US   U:X  a  OUS==   U-  ss'   MO  UR                  U5      $ )a  Return string representation of table split into pages.

Arguments:

page_length - number of rows per page (default: 58)
line_break - string used to separate pages (default: "" form feed)
**kwargs - additional keyword arguments passed to get_string() method,
    such as title, fields, header, border, etc.

The table is split into pages of the specified length, with each page
separated by the line_break character. All formatting options available
in get_string() can be used via kwargs.r   r   r   rW   )r   r)  r  r  r>  r  )r   page_length
line_breakr   pagestrue_ends         r_   paginatePrettyTable.paginate	  s      **Wa0w::eT]]3w+ =xHF5MLL2623e}(7O{*O  u%%r^   c                   SSK nSSKnU R                  U5      nUR                  5        VVs0 s H  u  pVXT;  d  M  XV_M     nnnUR	                  5       nUR
                  " U40 UD6n	UR                  S5      (       a\  US   (       a7  U	R                  U R                   V
s/ s H  oUS   ;   d  M  U
PM     sn
5        OU	R                  U R                  5        U R                  U R                  U5      5      nUS   (       aI  U VV
Vs/ s H8  n[        U R                  U5       V
Vs/ s H  u  pXS   ;   d  M  UPM     snn
PM:     nn
nnU H  nU	R                  U5        M     UR                  5       $ s  snnf s  sn
f s  snn
f s  snn
nf )a  Return 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.
r   Nr   r   )r  iore  rX  StringIOwriterr   writerowr  r  r  r  getvalue)r   r   r  r.  rd  r   r   csv_options
csv_buffer
csv_writerr  r  r8  r  s                 r_   r  PrettyTable.get_csv_string
  st    	##F+)/
)7:33;MJCJ 	 
 [[]
ZZ
:k:
;;x  x ## $ 1 1L 11'(:K5KQ 1L ##D$5$56  !898  C  #4#4#4c:U:tqa8CT>T:U   C$  ""$$/
 M Vs4   E7E7!E=1E=
F)F;FFFc                ~  ^ ^	 SSK nT R                  U5      m	SSSS.nUR                  UR                  5        VVs0 s H  u  pEUT	;  d  M  XE_M     snn5        / nT	R	                  S5      (       a\  T	S   (       a7  UR                  T R                   Vs/ s H  owT	S   ;   d  M  UPM     sn5        OUR                  T R                  5        T R                  T	5      nT	S   (       a  UR                  U	U 4S	 jU 5       5        OUR                  U 4S
 jU 5       5        UR                  " U40 UD6$ s  snnf s  snf )a~  Return 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.
r   N   ),rw  T)indent
separators	sort_keysr   r   c              3     >#    U  H;  n[        TR                  U5       VVs0 s H  u  p#UTS    ;   d  M  X#_M     snnv   M=     gs  snnf 7f)r   N)r  r  )r   r8  r  r  rd  r   s       r_   r   .PrettyTable.get_json_string.<locals>.<genexpr>^
  sN      C #&d&7&7"=X"=$!ghFWAW"=X Ys   AAAAc              3  b   >#    U  H$  n[        [        TR                  U5      5      v   M&     g 7fr   )r  r  r  )r   r8  r   s     r_   r   r>  c
  s&     M4D$5$5s ;<<s   ,/)r  re  updaterX  r   r  r  r  r  r  dumps)
r   r   r  json_optionsr   r   objectsr  r  rd  s
   `        @r_   r  PrettyTable.get_json_stringA
  s    	##F+%(

 	*0,,.O.JCCw<NZSZ.O	
 57;;x  x 4+<+<W+<aWXEV@V+<WXt//0~~g&8NN  
 NNMMMzz'2\22% P  Xs   D4
D4
D:%D:c                    U R                  U5      nUS   (       a  U R                  U5      nU$ U R                  U5      nU$ )a  Return 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)
escape_header - escapes the text within a header (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: HRuleStyle
vrules - controls printing of vertical rules between columns.
    Allowed values: VRuleStyle
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
row_filter - filter function applied on rows
attributes - dictionary of name/value pairs to include as HTML attributes in the
    <table> tag
format - Controls whether or not HTML tables are formatted to match
    styling options (True or False)
escape_data - escapes the text within a data field (True or False)
xhtml - print <br/> tags if True, <br> tags if False
break_on_hyphens - Whether long lines are broken on hyphens or not, default: True
r)   )re  _get_formatted_html_string_get_simple_html_stringr   r   rd  strings       r_   rG  PrettyTable.get_html_stringk
  sK    L ##F+844W=F  11':Fr^   c           
     >   SSK Jn  / nUS   (       a  SnOSnS/nUS   (       a@  US   R                  5        H)  u  pgUR                  SU" U5       S	U" U5       S
35        M+     UR                  S5        UR                  SR	                  U5      5        US   =(       d    U R
                  nU(       a-  U" U5      R                  SU5      n	UR                  SU	 S35        US   (       a  UR                  S5        UR                  S5        U R                   HY  n
US   (       a
  XS   ;  a  M  US   (       a  U" U
5      n
UR                  SR                  U
R                  SU5      5      5        M[     UR                  S5        UR                  S5        UR                  S5        U R                  U5      nU R                  U5      nU H  nUR                  S5        [        U R                  U5       H[  u  pUS   (       a
  XS   ;  a  M  US   (       a  U" U5      nUR                  SR                  UR                  SU5      5      5        M]     UR                  S5        M     UR                  S5        UR                  S5        SR	                  U5      $ )Nr   escaper@   <br/><br><tabler(   r  ="">r}  r   r       <caption>
</caption>r       <thead>        <tr>r   rT   z            <th>{}</th>        </tr>    </thead>    <tbody>rU   z            <td>{}</td>    </tbody></table>)r  rM  rX  r  r  r   replacer  r)   r  r  r  )r   rd  rM  r   	linebreakopen_tag	attr_name
attr_valuer   captionr  r  r  r8  datums                  r_   rG  #PrettyTable._get_simple_html_string
  sF   7II:< )0)>)D)D)F%	!F9$5#6b
9K8LA NO *GRWWX&'  /DKKUm++D)<GLL=	<= 8LL'LL(**8$h6G)G?+"5ME-44U]]45ST + LL)LL( 	]#~~g&**40!CLL( #D$5$5s ;8$h6G)G=)"5ME-44U]]45ST !< LL) " 	^$Z yyr^   c                j	   SSK Jn  / nU R                  U5      u  pEUS   (       a  SnOSnS/nUS   (       Gad  US   [        R                  :X  a*  US	   [
        R                  :X  a  UR                  S
5        GO#US   [        R                  :X  a)  US	   [
        R                  :X  a  UR                  S5        OUS   [        R                  :X  a)  US	   [
        R                  :X  a  UR                  S5        OUS   [        R                  :X  a  UR                  S5        OzUS   [        R                  :X  a  UR                  S5        OQUS	   [
        R                  :X  a  UR                  S5        O(US	   [
        R                  :X  a  UR                  S5        US   (       d  US   (       a  UR                  S5        US   (       a@  US   R                  5        H)  u  pUR                  SU" U5       SU" U	5       S35        M+     UR                  S5        UR                  SR                  U5      5        US   =(       d    U R                  n
U
(       a-  U" U
5      R                  SU5      nUR                  SU S35        US   (       a  UR                  S5        UR                  S5        U R                   HV  nUS    (       a
  XS    ;  a  M  US!   (       a  U" U5      nUR                  SU5      nUR                  S"U S#U S$U S%35        MX     UR                  S&5        UR                  S'5        UR                  S(5        U R                  U5      nU R                  U5      nU R                   Vs/ s H  nS)S*S+S,.U R                  U      PM     nnU R                   Vs/ s H  nS-S.S/S0.U R                   U      PM     nnU H  nUR                  S5        [#        U R                  UUU5       Ha  u  nnnnUS    (       a
  XS    ;  a  M  US1   (       a  U" U5      nUR                  SU5      nUR                  S2U S#U S3U S4U S5U S635        Mc     UR                  S&5        M     UR                  S75        UR                  S85        SR                  U5      $ s  snf s  snf )9Nr   rL  r@   rN  rO  rP  r   r+   r-   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"r    z rules="cols"r(   r  rQ  rR  rS  r}  r   r   rT  rU  r   rV  rW  r   rT   z%            <th style="padding-left: zem; padding-right: zem; text-align: center">z</th>rX  rY  rZ  leftrightr%  )r   r   r   topmiddlebottomr   rU   z%            <td style="padding-left: zem; text-align: z; vertical-align: z">z</td>r[  r\  )r  rM  r  r*   rf   r,   r  re   rX  r  r   r]  r  r  r  r   r   r  )r   rd  rM  r   r  r  r^  r_  r`  ra  r   rb  r  contentr  r  alignsvalignsr8  rc  rL   rN   s                         r_   rF  &PrettyTable._get_formatted_html_string
  sl   --g6
7II:8!Z^^3H%7 :;!Z%5%55H%)9)99/!Z%5%55H%7 ;<"j&6&66 12"jnn4 >?"j&6&66 12"jnn4 >?x W-G%HOOO,< )0)>)D)D)F%	!F9$5#6b
9K8LA NO *GRWWX&'  /DKKUm++D)<GLL=	<= 8LL'LL(**8$h6G)G?+"5ME--i8%%)F +&&*V ,++2)5: + LL)LL( 	]#~~g&**40 **
* wX6t{{57IJ* 	 
 **
* hX6t||E7JK* 	 
 "CLL(/2!!30+ueV 8$h6G)G=)"5ME--i8%%)F +&&*V ,##(' *''-hb		@0  LL)% "& 	^$Z yy=

s   > R+. R0c                    U R                  U5      nUS   (       a  U R                  U5      nU$ U R                  U5      nU$ )a  Return 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: HRuleStyle
vrules - controls printing of vertical rules between columns.
    Allowed values: VRuleStyle
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
row_filter - filter function applied on rows
format - Controls whether or not HTML tables are formatted to match
    styling options (True or False)
r)   )re  _get_formatted_latex_string_get_simple_latex_stringrH  s       r_   r  PrettyTable.get_latex_stringC  sJ    2 ##F+855g>F  227;Fr^   c                   / nUS   (       a'  U R                    Vs/ s H  o3US   ;   d  M  UPM     nnOU R                   nSR                  U Vs/ s H  o0R                  U   PM     sn5      nSU S3nUR                  U5        US   (       a#  UR                  SR                  U5      S-   5        U R	                  U5      nU R                  U5      nU HW  n	[        U R                   U	5       V
Vs/ s H  u  pX;   d  M  UPM     nn
nUR                  SR                  U5      S-   5        MY     UR                  S5        S	R                  U5      $ s  snf s  snf s  snn
f )
Nr   r}  \begin{tabular}{}r    &  \\\end{tabular}
)r  r  r   r  r  r  r  )r   rd  r   r  wanted_fields
alignments	begin_cmdr  r  r8  r  r  wanted_datas                r_   rq  $PrettyTable._get_simple_latex_stringd  sR   8#'#4#4#4%AR8R#4  M !--MWWmLmUkk%0mLM
*:,b9	Y 8LLM2V;< ~~g&**40!C!$"3"3S99daQ=O9   LLK069:	 " 	%&{{5!!5 Ms   EEE2EEc                   / nUS   (       a'  U R                    Vs/ s H  o3US   ;   d  M  UPM     nnOU R                   nU Vs/ s H  o0R                  U   PM     nnUS   (       a)  US   [        R                  :X  a  SR	                  U5      nO7US   (       d  US   (       a  SR	                  U5      nOSR	                  U5      nUS   (       a-  US   [        R                  [        R
                  4;   a  SU S3nSU S3nUR                  U5        US   (       a8  US	   [        R                  [        R
                  4;   a  UR                  S
5        US   (       a#  UR                  SR	                  U5      S-   5        US   (       d
  US   (       a8  US	   [        R                  [        R                  4;   a  UR                  S
5        U R                  U5      nU R                  U5      n	U	 H  n
[        U R                   U
5       VVs/ s H  u  pX;   d  M  UPM     nnnUR                  SR	                  U5      S-   5        US   (       d  Mc  US	   [        R                  :X  d  M|  UR                  S
5        M     US   (       a(  US	   [        R
                  :X  a  UR                  S
5        UR                  S5        SR	                  U5      $ s  snf s  snf s  snnf )Nr   r   r-   r	  r    r}  rt  ru  r+   z\hliner   rv  rw  rx  ry  )r  r   r,   rf   r  re   r  r*   rh   r  r  r  )r   rd  r   r  rz  wanted_alignmentsalignment_strr|  r  r  r8  r  r  r}  s                 r_   rp  'PrettyTable._get_formatted_latex_string  s   8#'#4#4#4%AR8R#4  M !--M=JK]E[[/]K8!2jnn!DHH%67M"w/I'JHH%67MGG$56M8!2NN7
 "
  a0M*=/<	Y8!2NN7
 "
 LL# 8LLM2V;<H)C!D'K
nnj//0K1 LL# ~~g&**40!C!$"3"3S99daQ=O9   LLK069:x  WX%6*..%HY' " 8!2j6F6F!FLL#%&{{5!!i LDs   KKKK$ K$c                N   U R                  U5      n/ nUR                  S5      nU(       aP  [        U[        5      (       a;  SR	                  S UR                  5        5       5      nUR                  SU 35        OUR                  S5        UR                  SU R                  5      nU(       a  UR                  SU 35        UR                  S5      nUR                  S	5      (       ap  UR                  S
5        Uc  U R                  nO#U R                   V	s/ s H  oU;   d  M
  U	PM     nn	U(       a%  SR	                  U5      n
UR                  SU
 35        U R                  U5      nU R                  U5      nU Hw  nUR                  S
5        Uc  UnO1[        U R                  U5       V	Vs/ s H  u  pX;   d  M  UPM     nn	nU(       d  MT  UR                  SSR	                  U5      -   5        My     UR                  S5        SR	                  U5      $ s  sn	f s  snn	f )a6  
Return string representation of the table in MediaWiki table markup.
The generated markup follows simple MediaWiki syntax. For example:
    {| class="wikitable"
    |+ Optional caption
    |-
    ! Header1 !! Header2 !! Header3
    |-
    | Data1 || Data2 || Data3
    |-
    | Data4 || Data5 || Data6
    |}
r(   r  c              3  6   #    U  H  u  pU S U S3v   M     g7f)rQ  rR  NrW   )r   r\  r  s      r_   r   3PrettyTable.get_mediawiki_string.<locals>.<genexpr>  s      S9R1#Rs!9Rs   z{| z{| class="wikitable"r   z|+ r   r   |-z !! z! z| z || |}r   )re  r   r2  r  r  rX  r  r   r  r  r  r  )r   r   rd  r   attributes_optionattr_strrb  fields_optionheadersr  header_liner  r  r8  cellscells                   r_   r   PrettyTable.get_mediawiki_string  s    ##F+#KK5,=t!D!DxxS9J9P9P9RSSHLL4z*+LL/0++gt{{3LL3wi)H-;;x  LL$++ (,'8'8'8e]<RE'8   $kk'2r+/0~~g&**40!CLL$ (+4+<+<c'B'B- 'B  
 uTFKK$667 " 	Tyy/s   	H'H2H!H!)Pr   r   r   r   r   r   r   r   r  r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   r   r  r   r  r   r   r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   rL   r   rD   rJ   rI   r   r  r   r<   r:   r=   rF   r6   r   r5   r    rE   r7   rC   rH   rG   rN   r9   r   )r  Sequence[str] | Nonereturnr  r  r  )r   r8   r   r   rL   r   r  r8   )r6  zint | slicer  r   )r  r8   )r  list[RowType])r  
list[bool])r  r   )r[  r   r  r  )r  zdict[str, str | None])r[  rR   )r  r  )r[  Sequence[Any]r  r  )r  rK   )r[  z'AlignType | dict[str, AlignType] | Noner  r  )r  rM   )r[  z)VAlignType | dict[str, VAlignType] | Noner  r  )r  r   )r[  rO   r  r  )r  r   )r[  r   r  r  )r  r   )r[  zSequence[str | None]r  r  )r  r   )r[  r8   r  r  )r  r   )r[  r   r  r  )r  r#   )r[  r#   r  r  )r  r%   )r[  r%   r  r  )r  r>   )r[  r>   r  r  )r  r*   )r[  r*   r  r  )r  r,   )r[  r,   r  r  )r  r'   )r[  r.   r  r  )r  r   )r[  r1   )r[  r'   r  r  )r   zMapping[str, Any]r  r   )rq  rl   r  r  )r  zSequence[RowType]r  r   r  r  )r8  r   r  r   r  r  )r  r   r  r  )r   r   )
r  r8   r  r  rL   r   rN   r   r  r  )Index)r  r8   r  r  )r  r   )r   )r  r8   r  r8   )r  r8   r   r   r  r8   )r  list[list[str]]rd  r   r  r  )rd  r   r  tuple[int, int])rd  r   r  r  )rd  r   r  r  )r8  r   r  r  )r  r  r  r  )r}  )rd  r   r  zLiteral['top_', 'bottom_', '']r  r8   )r   r8   rd  r   r  r8   )rd  r   r  r8   )r8  r  rd  r   r  r8   r  r8   ):   )r'  r   r(  r8   r  r8   )rX   rY   rZ   r[   r\   r   r  r&  r-  r:  r@  rD  rH  r  rL  rM  rU  ro  rs  rN  rT  rV  rW  rP  rQ  rR  rO  rS  rY  rZ  propertyr  r  r@   setterrS   r  r  rL   r  rN   r  rQ   r  rP   r3   r4   r   r   r   r   r!   r"   r$   r&   r   r   r?   r   r    r+   r-   r/   r0   r  r  r2   r5   r6   r7   r9   r:   r;   r<   r=   rC   rD   rE   rF   rG   rH   rI   rJ   r)   rA   r(   rB   rT   rU   rV   re  rr  rl  rk  ro  rh  ri  rj  rm  rn  rp  r  r4  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r>  r   r  r  r  r+  r  r  rG  rG  rF  r  rq  rp  r  r]   rW   r^   r_   r   r      sd   L  ""    ((K
::**M""M##!!88##$$&&''""%%$$##((''!++ **MMKr*h /'!!&(D3L"6!"""""""$""""""!   ! !   \\  ! ! & &( ! !  <(   \\2 2 )   ]]* *6   $ $6   $ $ % % $ $ % % $ $   ]]    \\    \\    	ZZ    ]]  ! !       __          ]]  & & % % " " ! !   ]]  . . $$- %-   ]]    ]]      
% 
% " " 
' 
'0.& # # !T! !: # # " " ( ( ' ' ) ) (  ( # # " "
 % % $ $
 A A !!* "*
 , , ""+ #+ # # " "
 = = & &
 @ @   ) !)
 ? ? (  (
 > > ' '
 C C ##, $,
 B B ""+ #+
 F F  &&/ '/
 E E %%. &.
   ]]  ! !           " " ! ! # # " " ! !     & & % %,".	**/,!%//E& DI 4 4  8= ' '&& &  #"#" #" 	#"
 #" 
#"J! !*#
 <4*M&^	> 
7{ | MO'"'+I'	'R 0L\W#r& &6$%R$3T-^: xg ZB"@8"|:  : r^   r   c                ,    SS K nUR                  U 5      $ r  )r"  r   )r[  r"  s     r_   r   r     s    ==r^   c                @   SS K n0 nS H  nXR;   d  M
  UR                  U5      XE'   M     U(       a  UR                  " U 40 UD6nOPUR                  5       R	                  U R                  S5      5      nU R                  S5        UR                  X5      n[        S0 UD6nU(       a  Xl        O.[        U5       V	s/ s H  oR                  5       PM     sn	Ul        U H2  n
UR                  U
 V	s/ s H  oR                  5       PM     sn	5        M4     U$ s  sn	f s  sn	f )Nr   )	delimiterdoublequote
escapecharlineterminator	quotecharquotingskipinitialspacestricti   rW   )r  r  readerSniffersniffreadseekr   r  nextstripr4  )fpr  r   r  	fmtparamsparamr  dialecttabler  r8  s              r_   from_csvr    s    I	 ?%zz%0I	 B,),++-%%bggdm4

B(!&!E'04V=1WWY=#.#Qwwy#./  L > /s   ;D0D
c                    U R                   (       aY  [        S0 UD6nU R                    Vs/ s H  o3S   PM	     snUl        U R                  5        H  nUR	                  U5        M     U$ g s  snf )Nr   rW   )descriptionr   r  fetchallr4  )cursorr   r  colr8  s        r_   from_db_cursorr  3  sd    %f%/5/A/AB/AV/AB??$CMM# %	 Cs   A,c                    SS K n[        S0 UD6nUR                  U 5      nUS   Ul        USS   H2  nUR                   Vs/ s H  oeU   PM	     nnUR	                  U5        M4     U$ s  snf )Nr   rb   rW   )r  r   loadsr  r4  )json_stringr   r  r  rC  objr   r8  s           r_   	from_jsonr  =  sr    !&!Ejj%G
Eqr{#(#4#45#4C3x#45c  L 6s   A(c                 0   ^ SSK Jm   " U4S jST5      n U $ )Nr   
HTMLParserc                  d   > \ rS rSrS
U 4S jjr      SS jrSS jrSS jrSS jrSS jr	Sr
g	)*_make_table_handler.<locals>._TableHandleriL  c                   > TR                  U 5        Xl        / U l        / U l        / U l        SU l        S U l        SU l        SU l        SU l	        g )Nr   r}  F)
r   r   tableslast_rowr  max_row_widthactivelast_contentis_last_row_headercolspan)r   r   r  s     r_   r   3_make_table_handler.<locals>._TableHandler.__init__M  sQ    % K-/DK')DM68DI!"D&*DK "D&+D#DLr^   c                p    Xl         US:X  a  SU l        U H  u  p4US:X  d  M  [        U5      U l        M     g )NthTr  )r  r  r   r  )r   tagattrsr   r   s        r_   handle_starttag:_make_table_handler.<locals>._TableHandler.handle_starttagY  s7     Kd{*.'#
)##&u:DL $r^   c                   US;   a  U R                   R                  5       nU R                  R                  U5        U R                  (       a?  [        SU R                  5       H  nU R                  R                  S5        M      SU l        US:X  am  U R                  R                  U R                  U R                  45        [        U R                  [        U R                  5      5      U l	        / U l        SU l        US:X  a=  U R                  U R                  5      nU R                  R                  U5        / U l        SU l         S U l        g )	N)r  tdrb   r}  r   trFr  r  )r  r  r  r  r  r  r  r  r   r  r   generate_tabler  r  )r   r  stripped_contentr0  r  s        r_   handle_endtag8_make_table_handler.<locals>._TableHandler.handle_endtagc  s    l"#'#4#4#:#:#< $$%56<<"1dll3,,R0 4#$DLd{		  $--1H1H!IJ%(););S=O%P" "*/'g~++DII6""5)	 #DDKr^   c                .    U =R                   U-  sl         g r   )r  )r   datas     r_   handle_data6_make_table_handler.<locals>._TableHandler.handle_datax  s    %r^   c                   [        S0 U R                  D6nU R                   H  n[        US   5      U R                  :  aB  U R                  [        US   5      -
  n[        SU5       H  nUS   R                  S5        M     US   (       a   U R                  US   5        US   Ul        M  UR                  US   5        M     U$ )z5
Generates from a list of rows a PrettyTable object.
r   rb   r
  rW   )
r   r   r  r   r  r  r  make_fields_uniquer  r4  )r   r  r  r8  appendsr  s         r_   r  9_make_table_handler.<locals>._TableHandler.generate_table{  s      .$++.Eyys1v;!3!33"003s1v;>G"1g.Ac* / q6++CF3(+AE%MM#a&) ! Lr^   c                    [        [        U5      5       H:  n[        US-   [        U5      5       H  nX   X   :X  d  M  X==   S-  ss'   M     M<     g)z2
iterates over the row and make each field unique
rb   'N)r  r   )r   r   r  js       r_   r  =_make_table_handler.<locals>._TableHandler.make_fields_unique  sH     3v;'q1uc&k2AyFI-	S(	 3 (r^   )	r  r  r  r   r  r  r  r  r  Nr  )r  r8   r  zlist[tuple[str, str | None]]r  r  )r  r8   r  r  )r  r8   r  r  )r  zlist[tuple[list[str], bool]]r  r   )r   r  r  r  )rX   rY   rZ   r[   r   r  r  r  r  r  r]   r  s   r_   _TableHandlerr  L  s9    
		.	.#?	.	.	*	&	$	)r^   r  )html.parserr  )r  r  s    @r_   _make_table_handlerr  I  s    &H)
 H)T r^   c                  "    \ rS rSrSrSS jrSrg)TableHandleri  z3Deprecated: use from_html or from_html_one instead.c                |    SS K nUR                  S[        SS9  [        5       nX0l        UR
                  " U 40 UD6  g )Nr   zoTableHandler is deprecated and will be removed in a future release. Use from_html() or from_html_one() instead.rc   
stacklevel)warningswarnDeprecationWarningr  r   r   )r   r   r  clss       r_   r   TableHandler.__init__  sA    :	 	 	
 "#T$V$r^   r   Nr  )rX   rY   rZ   r[   r   r   r]   rW   r^   r_   r  r    s
    =%r^   r  c                \    [        5       " S0 UD6nUR                  U 5        UR                  $ )zw
Generates a list of PrettyTables from a string of HTML code. Each <table> in
the HTML becomes one PrettyTable object.
rW   )r  feedr  )	html_coder   parsers      r_   	from_htmlr    s*    
 !",V,F
KK	==r^   c                    [        U 40 UD6n [        U5      S:X  d   e US   $ ! [         a    Sn[        U5      ef = f)zY
Generates a PrettyTable from a string of HTML code which contains only a
single <table>
rb   zCMore than one <table> in provided HTML code. Use from_html instead.r   )r  r   rb  rc  )r  r   r  r9  s       r_   from_html_oner    sV     y+F+F6{a !9  Sos   % =c                ~   U R                  5       R                  S5      n[        S0 UD6nSn/ nSnU GH(  nUR                  5       nUR                  S5      (       a  SnM.  UR                  S5      (       a    OU(       d  MO  UR                  S5      (       a  Mg  UR                  S5      (       a  M  UR                  S	5      (       a9  US
S R                  S5       Vs/ s H  oR                  5       PM     nnXCl        M  UR                  S5      (       d  M  US
S R                  S5       Vs/ s H  oR                  5       PM     n	nUR                  U	5        GM+     U(       aA  U H9  n
[        U
5      [        U5      :w  a  Sn[        U5      eUR                  U
5        M;     U$ Sn[        U5      es  snf s  snf )z
Returns a PrettyTable instance from simple MediaWiki table markup.
Note that the table should have a header row.
Arguments:
wiki_text -- Multiline string containing MediaWiki table markup
(Enter within '''   ''')
r   NFz{|Tr  r  z|+!rb   z!!r	  z||z,Row length mismatch between header and body.z-No valid header found in the MediaWiki table.rW   )	r  r   r   
startswithr  r  r   rc  r4  )	wiki_textr   r   r  r   r  inside_tabler   r  row_datar8  error_messager9  s                r_   from_mediawikir    s    OO##D)E!&!EFDLzz|??4  L??4  ??4  ??4  ??3/3ABx~~d/CD/Ctjjl/CFD &??315ab1EF1E

1EHFKK!) , C3x3v;& N //MM#	  L >o! E Gs   F5/F:c                    UR                  SU  35      =nc  S[         SU  S3n[        U5      eX!U '   U S;   a  SU  S3nOSU  S3nS	S KnUR	                  U[
        S
S9  U$ )N_DEPRECATED_zmodule 'z' has no attribute 'r  >   rf   rg   re   rh   zthe 'zM' constant is deprecated, use the 'HRuleStyle' and 'VRuleStyle' enums insteadz;' constant is deprecated, use the 'TableStyle' enum insteadr   rd   r  )r   rX   r+  r  r  r  )r,  module_globalsr[  r9  r  s        r_   _warn_deprecationr    s    !!L"788A
"6tfA>S!!411D6 B B 	
 dVVWMM#)aM8Jr^   c                    U S:X  a9  SS K nSSKJn  UR                  S[        SS9   " S SU5      nU[        5       U '   U$ [        U [        5       S9$ )	Nr   r   )r   zAOptionsType is deprecated and will be removed in a future releaserc   r  c                      \ rS rSrSrg) __getattr__.<locals>.OptionsTypei  rW   N)rX   rY   rZ   r[   r]   rW   r^   r_   r   r    s    r^   )r  )r  typingr   r  r  globalsr  )r,  r  r   r   s       r_   r-  r-    sX    }$O 	 	
	) 	 &	$T')<<r^   )r   r8   r  r  )r[  r8   r  r   r   )r  r  r  r   )r  r   r  zPrettyTable | None)r  zstr | bytesr  r   )r  r8   r  zlist[PrettyTable])r  r8   r  r   )r  r8   r  r   )r,  r8   r  zdict[str, Any]r  r   )r,  r8   r  r   )E
__future__r   enumr   	functoolsr   r	  r   r   r   TYPE_CHECKINGcollections.abcr	   r
   r   r   r   r   	_typeshedr   typing_extensionsr   r   r*   r,   rl   r   r\   r   r   r   rw   r   rx   r   ry   r   rz   r   r{   r   r|   r   r}   r   r   r   r   r  r   r   r   r>   r  r8   r   r   r   r   r  r  r  r  r  r  r  r  r  r-  rW   r^   r_   <module>r     s  @ #   % %;;220&3i 3l  	 	  5   %  E '// U /%/%?%? U ?#-#;#; 5 ;(11 e 1'// U /#-#;#; 5 ;#-#;#; 5 ;&-- E - - % ,#Y }-	9 -.
I .$%EFM M (T#s(^  (F  },  }, JZ   F	M`% %",^&=r^   