HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/tabulate/__pycache__/__init__.cpython-311.pyc
�

�;f:t��l�dZddlmZddlmZmZddlmZddl	m
Z
mZddl
mZmZddlZddlZddlZddlZddlZ	ddlZn
#e$rdZYnwxYwd�Zgd	�Z	d
dlmZn#e$rYnwxYwdZd
ZdZdZdZdZ eduZ!dZ"edgd���Z#edgd���Z$edgd���Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�d�Z-d�d �Z.d!�Z/d"d#d$d%d&d'd(d)d*d+d,d-d.�Z0e0fd/�Z1d0�Z2id1e%e#dd2d3d��e#dd2d3d��de#dd2d3d��e$dd3d��e$dd3d��dd4d5g����d6e%dddde$dd3d��e$dd3d��dd����d7e%e#d8d2d8d8��e#d8d9d8d8��e#d8d2d8d8��e#d8d2d8d8��e$d:d:d:��e$d:d:d:��d
d����d;e%e#d<d=d>d?��e#d@d=dAdB��e#d@d=dAdB��e#dCd=dDdE��e$dFdFdF��e$dFdFdF��d
d����dGe%e#dHd=d>dI��e#d@d=dAdB��e#d@d=dAdB��e#dJd=dDdK��e$dFdFdF��e$dFdFdF��d
d����dLe%e#dMdNdOdP��e#dQdNdRdS��e#dQdNdRdS��e#dTdNdUdV��e$dWdWdW��e$dWdWdW��d
d����dXe%e#dYdNdZd[��e#d\dNd]d^��e#d@d=dAdB��e#d_dNd`da��e$dFdFdF��e$dFdFdF��d
d����dbe%e#dcdddedf��e#dgdddhdi��e#dgdddhdi��e#djdddkdl��e$dmdmdm��e$dmdmdm��d
d����dne%e#dodddpdq��e#drdddsdt��e#d@d=dAdB��e#dudddvdw��e$dFdFdF��e$dFdFdF��d
d����dxe%e#d8d2d8d8��e#d8d9d8d8��de#d8d2d8d8��e$d:d:d:��e$d:d:d:��d
d����dye%e#d<d=d>d?��e#d@d=dAdB��de#dCd=dDdE��e$dFdFdF��e$dFdFdF��d
d����dze%e#dHd=d>dI��e#d@d=dAdB��de#dJd=dDdK��e$dFdFdF��e$dFdFdF��d
d����d{e%e#dMdNdOdP��e#dQdNdRdS��de#dTdNdUdV��e$dWdWdW��e$dWdWdW��d
d����d|e%e#dYdNdZd[��e#d\dNd]d^��de#d_dNd`da��e$dFdFdF��e$dFdFdF��d
d����d}e%e#dcdddedf��e#dgdddhdi��de#djdddkdl��e$dmdmdm��e$dmdmdm��d
d����d~e%e#dodddpdq��e#drdddsdt��de#dudddvdw��e$dFdFdF��e$dFdFdF��d
d����de%e#d:d2d:d:��e#d:d2d:d:��dde$d:d:d:��e$d:d:d:��d
d4g����id�e%e(e(dde$d:d:d:��e$d:d:d:��d
d4g����d�e%de#d:d2d8d:��dde$d:d:d:��e$d:d:d:��d
d����d�e%dddde$d�d�d���e$d:d:d:��d
d����d�e%de#dd2d8d��dde$dd:d��e$dd:d��d
d����d�e%e#d8d2d8d8��e#d8d2d8d8��de#d8d2d8d8��e$d:d:d:��e$d:d:d:��d
d����d�e%e#d8d2d8d8��e#d:d2d8d:��de#d8d2d8d8��e$d:d:d:��e$d:d:d:��d
d����d�e%e#dd9d3d��e#dd9d3d��de#dd9d3d��e$dd3d��e$dd3d��dd����d�e%e#d�ddd���e#d�ddd��e#d�ddd��e#d�ddd��ee)d���ee)d:��dd����d�e%ddddee-d�d�����ee-d���d
d����d�e%dddde$d�d�d���e$d�d�d���d
d����d�e%e+dde#d�ddd��ee,d�d
��ee,d�d
��dd4g����d�e%e+dde#d�ddd��ee,d�d���ee,d�d���dd4g����d�e%e.e#d�ddd��de#d�ddd��e1e1d
d����d�e%e.e#d�ddd��de#d�ddd��ee1i����ee1i����d
d����d�e%ee.d�����e#d�ddd��de#d�ddd��e1e1d
d����d�e%ee.d�����e#d�ddd��de#d�ddd��e1e1d
d����d�e%dddde$dd�d��e$dd�d��dd�����e%dddde$d�d�d:��e*d
d���e%ee/d
��dde#d�ddd��ee/d���ee/d
��d
d4g���d���Z3e4e5e3�6������Z7id6d6�d1d1�d7d7�d;d;�dGdG�dLdL�dXdX�dbdb�dndn�d�d��d�d��d�d��d�d��d�d��d�d��d�d��Z8ej9d���Z:ej9d���Z;d�Z<e<�d��Z=e<�d��Z>e<�d��Z?d�e=�d�e>�d�e<�d�e?�d�e<�d�e>�d�e?�d��Z@ej9e@ejA��ZBej9e@�Cd���ejA��ZDd�ZEej9d���ZFd��ZGd„ZHdÄZIdĄZJeKfdńZLdƄZMd�dDŽZNdȄZOdɄZPdʄZQd˄ZRd̄ZSd̈́ZTd΄ZUdτZVeWfdЄZXdфZYd҄ZZdӄZ[eWfdԄZ\dՄZ]				d�dքZ^dׄZ_d�d؄Z`d�dلZa	d�dڄZbdۄZcd܄Zdd݄ZedބZfd�d߄Zgd�d�Zhd�d�Zid�d1eee e edd
ddddf
d�Zjd�Zkd�Zld�Zmd�Znd�Zo�dd�Zpd�Zq	�dd�Zrd�Zsd�ZtGd�d�eu��Zvd�ZwGd�d�ejx��Zyd�Zzd��Z{e|d�krez��dSdS(zPretty-print tabular data.�)�
namedtuple)�Iterable�Sized)�escape)�chain�zip_longest)�reduce�partialNc�6�t|tj��S�N)�
isinstance�io�IOBase)�fs �D/opt/alt/python311/lib/python3.11/site-packages/tabulate/__init__.py�_is_filers���a���#�#�#�)�tabulate�tabulate_formats�simple_separated_format�)�version�F�g��default��Line)�begin�hline�sep�end�DataRow)rr!r"�TableFormat)�	lineabove�linebelowheader�linebetweenrows�	linebelow�	headerrow�datarow�padding�with_header_hidec���t|��}|tks|tkoGt|��dkr|dtkp#t|��dko|dtk}|S)Nrrr)�type�list�str�len�SEPARATING_LINE)�row�row_type�is_sls   r�_is_separating_liner6hsj���C�y�y�H�
��
�
0��S��
�	�S���Q��	4�3�q�6�_�4�	9���H�H��M�7�c�!�f��7�
��Lrc�x�|}|dvrd|dz
zdzS|dkrdd|dz
zzdzS|dkrdd|dz
zzSd|zS)z~Return a segment of a horizontal line with optional colons which
    indicate column's alignment (as in `pipe` output format).)�right�decimal�-r�:�centerr�left�)�align�colwidth�ws   r�_pipe_segment_with_colonsrBqsp��	�A��$�$�$��q�1�u�
��$�$�	�(�	�	��c�Q��U�m�$�s�*�*�	�&����c�Q��U�m�$�$��Q�w�rc��|sdgt|��z}d�t||��D��}dd�|��zdzS)znReturn a horizontal line with optional colons to indicate column's
    alignment (as in `pipe` output format).rc�4�g|]\}}t||����Sr>)rB)�.0�arAs   r�
<listcomp>z*_pipe_line_with_colons.<locals>.<listcomp>�s'��V�V�V�D�A�q�)�!�Q�/�/�V�V�Vr�|)r1�zip�join)�	colwidths�	colaligns�segmentss   r�_pipe_line_with_colonsrNsW���*��D�3�y�>�>�)�	�V�V�C�	�9�<U�<U�V�V�V�H�����(�#�#�#�c�)�)rc���ddddd���fd�t||��D��}|dz}||�|��z���S)Nrzalign="right"| zalign="center"| �r=r8r<r9c�T��g|]$\}}d��|d��z|zdz��%S)� r��get)rE�crF�	alignments   �rrGz-_mediawiki_row_with_attrs.<locals>.<listcomp>�sG������15��A��i�m�m�A�r�"�"�"�Q�&��,���rr)rIrJ�rstrip)�	separator�cell_valuesrKrL�values_with_attrs�colseprVs      @r�_mediawiki_row_with_attrsr\�s}����"�$�$�	��I�����9<�[�)�9T�9T�������]�F�����$5�6�6�6�>�>�@�@�@rc���|dxxdz
cc<ddddd���fd�t||��D��}dd�|��zdzS)	NrrRz<.z>.z=.rPc3�P�K�|] \}}��|d��|zV��!dS)rNrS)rErF�vrVs   �r�	<genexpr>z*_textile_row_with_attrs.<locals>.<genexpr>�s:�����
O�
O�4�1�a�i�m�m�A�r�"�"�Q�&�
O�
O�
O�
O�
O�
OrrH�rIrJ)rYrKrL�valuesrVs    @r�_textile_row_with_attrsrc�si�����N�N�N�c��N�N�N�����N�N�I�
O�
O�
O�
O�3�y�+�3N�3N�
O�
O�
O�F�����&�!�!�!�C�'�'rc��dS)Nz<table>
<tbody>r>)�colwidths_ignore�colaligns_ignores  r� _html_begin_table_without_headerrg�s���rc����ddddd��|r��fd�t||��D��}n��fd�t||��D��}d�d�|�������}�dkrd	|�d
�}|S)Nrz style="text-align: right;"z style="text-align: center;"rPc	�l��g|]0\}}d����|d��|����1S�z<{0}{1}>{2}</{0}>r��formatrT�rErUrFrV�celltags   ��rrGz(_html_row_with_attrs.<locals>.<listcomp>�sM���
�
�
���1�
 �&�&�w�	�
�
�a��0D�0D�a�H�H�
�
�
rc	���g|]=\}}d����|d��t|������>Srj)rlrT�
htmlescaperms   ��rrGz(_html_row_with_attrs.<locals>.<listcomp>�sT���
�
�
���1�
 �&�&�w�	�
�
�a��0D�0D�j�QR�m�m�T�T�
�
�
rz<tr>{}</tr>�thz<table>
<thead>
z
</thead>
<tbody>)rIrlrJrW)rn�unsaferYrKrLrZ�rowhtmlrVs`      @r�_html_row_with_attrsrt�s������.�0�0�	��I��	
�
�
�
�
�
��K��3�3�
�
�
���

�
�
�
�
��K��3�3�
�
�
���"�"�2�7�7�+<�#=�#=�#D�#D�#F�#F�G�G�G��$���C�w�C�C�C���Nrc�����ddddd�����fd�t||��D��}d�|��dzS)Nrz<style="text-align: right;">z<style="text-align: center;">rPc	�x��g|]6\}}d����|d���|z�z����7S)z{}{} {} rrk)rErUrFrVrn�headers   ���rrGz(_moin_row_with_attrs.<locals>.<listcomp>�sV�������A�q�	���'�9�=�=��B�#7�#7��!��f�9L�M�M���r�||ra)rnrYrKrLrwrZrVs`   ` @r�_moin_row_with_attrsry�st������/�1�1�	��I���������Y�/�/������7�7�$�%�%��,�,rc���ddddd��d��fd�|D����}d�|sdnd	|zd
z|rdndg��S)
N�l�rrUrPrc�<��g|]}��|d����S)r{rS)rErFrVs  �rrGz-_latex_line_begin_tabular.<locals>.<listcomp>�s'���"L�"L�"L�Q�9�=�=��C�#8�#8�"L�"L�"Lr�
z\begin{tabular}{z\begin{longtable}{�}z\toprule�\hline)rJ)rKrL�booktabs�	longtable�tabular_columns_fmtrVs     @r�_latex_line_begin_tabularr��s�����s�c�c�J�J�I��'�'�"L�"L�"L�"L�)�"L�"L�"L�M�M���9�9�(1�
L�
 �
 �7L�!�
"��
�$�2�K�K��		
���rc���d�}t|��dkr	|dg|�R�St|��dkr5|\}}}dd�|��z}|r|d||��dz|zS|Std���)	z/handle header and data rows for asciidoc formatc�^��ddddd��t|�fd�|D����}d�|D��}dd�|��zd	zg}g}|r|�d
��|r|dd�|��zd	zgz
}d�d�|����S)
N�<�>�^rPc� ��g|]
}�|��Sr>r>)rE�colalignrVs  �rrGz;_asciidoc_row.<locals>.make_header_line.<locals>.<listcomp>�s���F�F�F��	�(�+�F�F�Frc�@�g|]\}}d�||����S)z{:d}{}�rl)rE�widthr?s   rrGz;_asciidoc_row.<locals>.make_header_line.<locals>.<listcomp>�s7��&
�&
�&
�.:�e�U�H�O�O�E�5�)�)�&
�&
�&
rzcols="�,�"rwz	options="z
[{}]
|====)rIrJ�appendrl)�	is_headerrKrL�asciidoc_alignments�asciidoc_column_specifiers�header_list�options_listrVs       @r�make_header_linez'_asciidoc_row.<locals>.make_header_line�s����!�3�#�#�N�N�	�!��F�F�F�F�I�F�F�F�
�
��&
�&
�>Q�&
�&
�&
�"� �3�8�8�,F�#G�#G�H�3�N�O�����	*�����)�)�)��	H��K�#�(�(�<�*@�*@�@�3�F�G�G�K��#�#�C�H�H�[�$9�$9�:�:�:rrF�rHTr~zm _asciidoc_row() requires two (colwidths, colaligns) or three (cell_values, colwidths, colaligns) arguments) )r1rJ�
ValueError)r��argsr�rYrKrL�	data_lines       r�
_asciidoc_rowr��s���;�;�;�4�4�y�y�A�~�~� ���-��-�-�-�-�	�T���a���-1�)��Y�	��#�(�(�;�/�/�/�	��	�#�#�D�)�Y�?�?�$�F��R�R����
I�
�
�	
rz\&z\%z\$z\#z\_z\^{}z\{z\}z\textasciitilde{}z\textbackslash{}z\ensuremath{<}z\ensuremath{>})�&�%�$�#�_r��{r�~�\r�r�c�n����fd���fd�|D��}tddd��}t||��S)Nc�0����||��SrrS)rU�escruless �r�escape_charz_latex_row.<locals>.escape_chars����|�|�A�q�!�!�!rc�V��g|]%}d�t�|������&S�r)rJ�map)rE�cellr�s  �rrGz_latex_row.<locals>.<listcomp>s/���N�N�N�$�b�g�g�c�+�t�4�4�5�5�N�N�Nrrr��\\)r#�_build_simple_row)rYrKrLr��escaped_values�rowfmtr�s   `  @r�
_latex_rowr�sZ����"�"�"�"�"�O�N�N�N�+�N�N�N�N�
�R��f�
%�
%�F��^�V�4�4�4rc���d�}t|��}g}|r||d��|d<|D]<}t|��}|r||d��|d<|�|���=||fS)Nc�j�t|ttf��r|���sdS|S)Nz..)r
r0�bytes�strip��vals r�escape_emptyz._rst_escape_first_column.<locals>.escape_empty%s1���c�C��<�(�(�	������	��4��Jrr)r/r�)�rows�headersr��new_headers�new_rowsr3�new_rows       r�_rst_escape_first_columnr�$s�������w�-�-�K��H��2�%��g�a�j�1�1��A���!�!���s�)�)���	.�%��c�!�f�-�-�G�A�J����� � � � ��[� � r�simpler:z  r%r(�plain�grid�+�=rH�simple_gridu┌u─u┬u┐u├u┼u┤u└u┴u┘u│�rounded_gridu╭u╮u╰u╯�
heavy_gridu┏u━u┳u┓u┣u╋u┫u┗u┻u┛u┃�
mixed_gridu┍u┯u┑u┝u┿u┥u┕u┷u┙�double_gridu╔u═u╦u╗u╠u╬u╣u╚u╩u╝u║�
fancy_gridu╒u╤u╕u╞u╪u╡u╘u╧u╛�outline�simple_outline�rounded_outline�
heavy_outline�
mixed_outline�double_outline�
fancy_outline�github�pipe�orgtbl�jirarx�presto�pretty�psql�rst�	mediawikiz.{| class="wikitable" style="text-align: left;"z
|+ <!-- caption -->
|-z|-z|}�!�moinmoinz''')rw�youtrackz|| z || z| z | z |�htmlz</tbody>
</table>rq�td�
unsafehtmlT�latexr�z\hline
\end{tabular}�	latex_raw)r��latex_booktabs)r�z\midrulez\bottomrule
\end{tabular}�latex_longtable)r�z\hline
\endheadz\hline
\end{longtable}�tsv�	z|_. z|_.z|====)�textile�asciidocz
\r|\n|\r\ns
|
|
z\x1bz\[z\]r�z.
    (
        # terminal colors, etc
        z�        # CSI
        [\x30-\x3f]*  # parameter bytes
        [\x20-\x2f]*  # intermediate bytes
        [\x40-\x7e]   # final byte
    |
        # terminal hyperlinks
        z�8;        # OSC opening
        (\w+=\w+:?)*    # key=value params list (submatch 2)
        ;               # delimiter
        ([^z5]+)    # URI - anything but ESC (submatch 3)
        z           # ST
        ([^z;]+)    # link text - anything but ESC (submatch 4)
        z8;;z!  # "closing" OSC sequence
    )
�utf8zz>^(([+-]?[0-9]{1,3})(?:,([0-9]{3}))*)?(?(1)\.[0-9]*|\.[0-9]+)?$c�l�tddddtd|d��td|d��dd���S)z�Construct a simple TableFormat with columns separated by a separator.

    >>> tsv = simple_separated_format("\t") ;         tabulate([["foo", 1], ["spam", 23]], tablefmt=tsv) == 'foo \t 1\nspam\t23'
    True

    Nrr)r)r*r+r,)r$r#)rXs rrrsK��������"�i��,�,���I�r�*�*���	�	�	�	rc��	|���}n#ttf$rYnwxYwtt	jt|����S)a�
    >>> _isnumber_with_thousands_separator(".")
    False
    >>> _isnumber_with_thousands_separator("1")
    True
    >>> _isnumber_with_thousands_separator("1.")
    True
    >>> _isnumber_with_thousands_separator(".1")
    True
    >>> _isnumber_with_thousands_separator("1000")
    False
    >>> _isnumber_with_thousands_separator("1,000")
    True
    >>> _isnumber_with_thousands_separator("1,0000")
    False
    >>> _isnumber_with_thousands_separator("1,000.1234")
    True
    >>> _isnumber_with_thousands_separator(b"1,000.1234")
    True
    >>> _isnumber_with_thousands_separator("+1,000.1234")
    True
    >>> _isnumber_with_thousands_separator("-1,000.1234")
    True
    )�decode�UnicodeDecodeError�AttributeError�bool�re�match� _float_with_thousands_separators��strings r�"_isnumber_with_thousands_separatorr�sX��2
�����������/�
�
�
���
�������9�6�B�B�C�C�Cs��+�+c�N�	||��dS#ttf$rYdSwxYw)NTF)r��	TypeError)�convr�s  r�_isconvertibler�9s@�����V�����t���	�"�����u�u����s��$�$c��tt|��sdSt|ttf��rXtjt|����s!tjt|����r|���dvSdS)z�
    >>> _isnumber("123.45")
    True
    >>> _isnumber("123")
    True
    >>> _isnumber("spam")
    False
    >>> _isnumber("123e45678")
    False
    >>> _isnumber("inf")
    True
    F)�infz-inf�nanT)	r��floatr
r0r��math�isinf�isnan�lowerr�s r�	_isnumberrAs|���%��(�(�8��u�	�F�S�%�L�	)�	)�8��
�5��=�=�!�!�8�%)�Z��f�
�
�%>�%>�8��|�|�~�~�!7�7�7��4rc�|�t|��|up+t|ttf��ot	||��S)zG
    >>> _isint("123")
    True
    >>> _isint("123.45")
    False
    )r.r
r�r0r�)r��inttypes  r�_isintrWs?��	
�V�����	,��f�u�c�l�+�+�,��7�F�+�+�rc�n�t|��tupt|ttf��o|dvS)zc
    >>> _isbool(True)
    True
    >>> _isbool("False")
    True
    >>> _isbool(1)
    False
    )�True�False)r.r�r
r�r0r�s r�_isboolres8����<�<�4����6�E�3�<�(�(�H�V�7H�-H�rc�~�|r+t|ttf��rt|��}|�t	d��St|d��rtSt
|��rtSt|��r	|rtSt|��r	|rtSt|t��rtStS)a%The least generic type (type(None), int, float, str, unicode).

    >>> _type(None) is type(None)
    True
    >>> _type("foo") is type("")
    True
    >>> _type("1") is type(1)
    True
    >>> _type('42') is type(42)
    True
    >>> _type('42') is type(42)
    True

    N�	isoformat)r
r0r��_strip_ansir.�hasattrrr�r�intrr�)r��
has_invisible�numparses   r�_typerss��� �%��F�S�%�L�9�9�%��V�$�$��
�~��D�z�z��	���	%�	%���
�	����	���	�����H���
�	�6�	�	��x����	�F�E�	"�	"�����
rc�&�t|��st|��rrt|��rdS|�d��}|dkr'|����d��n|}|dkrt|��|z
dz
SdSdS)aSymbols after a decimal point, -1 if the string lacks the decimal point.

    >>> _afterpoint("123.45")
    2
    >>> _afterpoint("1001")
    -1
    >>> _afterpoint("eggs")
    -1
    >>> _afterpoint("123e45")
    2
    >>> _afterpoint("123,456.78")
    2

    ����.r�er)rr�r�rfindrr1)r��poss  r�_afterpointr�s��������>�v�F�F���&�>�>�	��2��,�,�s�#�#�C�/2�Q�w�w�&�,�,�.�.�&�&�s�+�+�+�C�C��a�x�x��6�{�{�S�(�1�,�,��r��rrc�6�d|z}|�|��S)uLFlush right.

    >>> _padleft(6, 'яйца') == '  яйца'
    True

    z{0:>%ds}r��r��s�fmts   r�_padleftr�����u�
�C��:�:�a�=�=�rc�6�d|z}|�|��S)uLFlush left.

    >>> _padright(6, 'яйца') == 'яйца  '
    True

    z{0:<%ds}r�rs   r�	_padrightr�rrc�6�d|z}|�|��S)uNCenter string.

    >>> _padboth(6, 'яйца') == ' яйца '
    True

    z{0:^%ds}r�rs   r�_padbothr!�rrc��|Srr>)�ignore_widthrs  r�_padnoner$�s���Hrc��t|t��rt�d|��St�d|��S)a�Remove ANSI escape sequences, both CSI (color codes, etc) and OSC hyperlinks.

    CSI sequences are simply removed from the output, while OSC hyperlinks are replaced
    with the link text. Note: it may be desirable to show the URI instead but this is not
    supported.

    >>> repr(_strip_ansi('\x1B]8;;https://example.com\x1B\\This is a link\x1B]8;;\x1B\\'))
    "'This is a link'"

    >>> repr(_strip_ansi('\x1b[31mred\x1b[0m text'))
    "'red text'"

    z\4)r
r0�_ansi_codes�sub�_ansi_codes_bytes�rs rrr�s@���!�S���/����u�a�(�(�(� �$�$�U�A�.�.�.rc���t�tr
tj}nt}t	|t
tf��r|t|����S|t|����S)z�Visible width of a printed string. ANSI color codes are removed.

    >>> _visible_width('hello'), _visible_width("world")
    (5, 5)

    )�wcwidth�WIDE_CHARS_MODE�wcswidthr1r
r0r�r)r�len_fns  r�_visible_widthr/�s^�������!������!�c�5�\�"�"���v�k�!�n�n�%�%�%��v�c�!�f�f�~�~�rc���t|t��r'ttjt
|����Sttjt|����Sr)r
r0r�r��search�_multiline_codes�_multiline_codes_bytesr)s r�
_is_multiliner4�sJ���!�S���:��B�I�.��2�2�3�3�3��B�I�4�a�8�8�9�9�9rc	�b�tt|tjd|������S�z1Visible width of a potentially multiline content.�[
])�maxr�r��split��multiline_s�
line_width_fns  r�_multiline_widthr=s&���s�=�"�(�8�[�"A�"A�B�B�C�C�Crc�\��|rt�n|r
tj�nt�|r�fd�}n�}|S)z2Return a function to calculate visible cell width.c�$��t|���Sr)r=�rr<s �r�<lambda>z"_choose_width_fn.<locals>.<lambda>s���-�a��?�?�r�r/r+r-r1�r�enable_widechars�is_multiline�width_fnr<s    @r�_choose_width_fnrG
sK�����&�
�
�	���(�
�
��
��!�?�?�?�?��� ���Orc���|dkrtsd�|D��}t}n�|dkrtsd�|D��}t}nx|dkrN|r
d�|D��}nd�|D��}t|����fd�t	||��D��}t}n$|st
}ntsd	�|D��}t}||fS)
Nr8c�6�g|]}|�����Sr>�r��rErs  rrGz._align_column_choose_padfn.<locals>.<listcomp>� ��2�2�2�Q�q�w�w�y�y�2�2�2rr<c�6�g|]}|�����Sr>rJrKs  rrGz._align_column_choose_padfn.<locals>.<listcomp> rLrr9c�F�g|]}tt|������Sr>)rrrKs  rrGz._align_column_choose_padfn.<locals>.<listcomp>$s&��E�E�E���K��N�N�3�3�E�E�Erc�,�g|]}t|����Sr>)rrKs  rrGz._align_column_choose_padfn.<locals>.<listcomp>&s��8�8�8�1��A���8�8�8rc�,��g|]\}}|�|z
dzz��S)rRr>)rEr�decs�maxdecimalss   �rrGz._align_column_choose_padfn.<locals>.<listcomp>(s,���X�X�X�g�a��1��d�*�c�1�1�X�X�Xrc�6�g|]}|�����Sr>rJrKs  rrGz._align_column_choose_padfn.<locals>.<listcomp>.rLr)�PRESERVE_WHITESPACErr!r8rIr$r)�stringsrVr�padfn�decimalsrRs     @r�_align_column_choose_padfnrXs����G���"�	3�2�2�'�2�2�2�G����	�h�	�	�"�	3�2�2�'�2�2�2�G����	�i�	�	��	9�E�E�W�E�E�E�H�H�8�8��8�8�8�H��(�m�m��X�X�X�X��W�h�AW�AW�X�X�X�����
�����"�	3�2�2�'�2�2�2�G����E�>�rc�\��|rt�n|r
tj�nt�|r�fd�}n�}|S)Nc�$��t|���Sr)�_align_column_multiline_widthr@s �rrAz/_align_column_choose_width_fn.<locals>.<lambda>;s���:�1�m�L�L�rrBrCs    @r�_align_column_choose_width_fnr\3sK�����&�
�
�	���(�
�
��
��!�L�L�L�L��� ���Orc	�b�tt|tjd|������Sr6)r/r�r�r9r:s  rr[r[As&����M�2�8�H�k�#B�#B�C�C�D�D�Drc��g}|D]G}t|t��r|D]}|�|����2|�|���H|Sr)r
r/r�)�nested_list�ret�item�subitems    r�
_flat_listrcFsm��
�C������d�D�!�!�	��
$�
$���
�
�7�#�#�#�#�
$�
�J�J�t������Jrc�t���t|||��\}�t|||��}tt||����}t	t	t|����|���|rY|s|s��fd�|D��}n�d�|D��}	�fd�t
||	��D��}
�fd�t
||
��D��}nn|s|s��fd�|D��}nZttt|����}	�fd�t
||	��D��}
�fd�t
||
��D��}|S)ztring] -> [padded_string]c�x��g|]6}d���fd�|���D������7S)r~c�(��g|]}��|����Sr>r>�rEr�maxwidthrVs  ��rrGz,_align_column.<locals>.<listcomp>.<listcomp>es%���G�G�G�!�5�5��1�-�-�G�G�Gr)rJ�
splitlines)rE�msrhrVs  ��rrGz!_align_column.<locals>.<listcomp>dsU��������	�	�G�G�G�G�G�r�}�}���G�G�G�H�H���rc�L�g|]!}d�tjd|��D����"S)c�,�g|]}t|����Sr>�r1rKs  rrGz,_align_column.<locals>.<listcomp>.<listcomp>js��>�>�>�!�s�1�v�v�>�>�>rr7)r�r9)rErjs  rrGz!_align_column.<locals>.<listcomp>js3��Q�Q�Q�2�>�>�r�x��"�'=�'=�>�>�>�Q�Q�Qrc�N��g|]!\}}�fd�t||��D����"S)c�&��g|]
\}}�||z
z
��Sr>r>�rErAr{rhs   �rrGz,_align_column.<locals>.<listcomp>.<listcomp>ls&���<�<�<���1��Q��U�#�<�<�<r)rI)rE�mw�mlrhs   �rrGz!_align_column.<locals>.<listcomp>ksI�������B��=�<�<�<��B����<�<�<���rc	���g|]H\}}d��fd�t|���p||��D������IS)r~c�.��g|]\}}�||����Sr>r>�rErrArVs   �rrGz,_align_column.<locals>.<listcomp>.<listcomp>rs'���T�T�T�4�1�a�5�5��A�;�;�T�T�Tr)rJrIri)rErjrqrVs   �rrGz!_align_column.<locals>.<listcomp>qsf�������B���	�	�T�T�T�T�3��
�
���8M�2�PR�3S�3S�T�T�T�U�U���rc�(��g|]}��|����Sr>r>rgs  ��rrGz!_align_column.<locals>.<listcomp>ws%���B�B�B�Q�e�e�H�a�0�0�B�B�Brc�&��g|]
\}}�||z
z
��Sr>r>rps   �rrGz!_align_column.<locals>.<listcomp>{s&���S�S�S�T�Q��h�!�a�%�0�S�S�Src�.��g|]\}}�||����Sr>r>rus   �rrGz!_align_column.<locals>.<listcomp>~s'���S�S�S�d�a��e�e�A�q�k�k�S�S�Sr)rXr\r/r�r8rcrIr1)
rUrV�minwidthrrDrErF�s_widths�padded_strings�s_lens�visible_widthsrhrVs
           @@r�
_align_columnr~Qs�����0���M�R�R�N�G�U�,��'����H��C��'�*�*�+�+�H��3�z�(�+�+�,�,�h�7�7�H��T��	�
�	������!����N�N�R�Q��Q�Q�Q�F�����!�(�F�3�3����N�����!�'�>�:�:����N�N�
 �	T�
�	T�B�B�B�B�B�'�B�B�B�N�N��#�c�7�+�+�,�,�F�S�S�S�S�S��6�=R�=R�S�S�S�N�T�S�S�S�c�'�>�6R�6R�S�S�S�N��rc�H�td��dtdtdtdtdt
di}t
tttttd��d�}t
|�|d��|�|d����}||S)Nrrrr���)r�r�r�rrr)r.r�r
r�r�r0r8rT)�type1�type2�types�invtypes�moregenerics     r�
_more_genericr��s����T�
�
�A��a��Q�
�q�
�q��Q�

�E��������:�:�
��H��e�i�i��q�)�)�5�9�9�U�A�+>�+>�?�?�K��K� � rc�Z�����fd�|D��}tt|t��S)u)The least generic type all column values are convertible to.

    >>> _column_type([True, False]) is bool
    True
    >>> _column_type(["1", "2"]) is int
    True
    >>> _column_type(["1", "2.3"]) is float
    True
    >>> _column_type(["1", "2.3", "four"]) is str
    True
    >>> _column_type(["four", 'пять']) is str
    True
    >>> _column_type([None, "brux"]) is str
    True
    >>> _column_type([1, 2, None]) is int
    True
    >>> import datetime as dt
    >>> _column_type([dt.datetime(1991,2,19), dt.time(17,35)]) is str
    True

    c�2��g|]}t|������Sr>)r)rErrrs  ��rrGz _column_type.<locals>.<listcomp>�s%���@�@�@�1�U�1�m�X�
.�
.�@�@�@r)r	r�r�)rUrrr�s `` r�_column_typer��s5����,
A�@�@�@�@��@�@�@�E��-���-�-�-rc���|�|S|tur|�S|turt||��S|tur7	t|d��S#tt
f$rt|��cYSwxYw|tur|ot|ttf��}|rBt|��}tt
|��|��}|�	||��Stt
|��|��S|�S)u�Format a value according to its type.

    Unicode is supported:

    >>> hrow = ['буква', 'цифра'] ;         tbl = [['аз', 2], ['буки', 4]] ;         good_result = '\u0431\u0443\u043a\u0432\u0430      \u0446\u0438\u0444\u0440\u0430\n-------  -------\n\u0430\u0437             2\n\u0431\u0443\u043a\u0438           4' ;         tabulate(tbl, headers=hrow) == good_result
    True

    N�ascii)
r0r
rlr�r�r�r�r
r�replace)	r��valtype�floatfmt�intfmt�
missingvalr�is_a_colored_number�raw_val�
formatted_vals	         r�_formatr��s���{����#�~�~��x��	�C����c�6�"�"�"�	�E�	�	�	��s�G�$�$�$���-�.�	�	�	��s�8�8�O�O�O�	����	�E�	�	�+�M�
�3��e��0M�0M���	0�!�#�&�&�G�"�5��>�>�8�<�<�M��;�;�w�
�6�6�6��%��*�*�h�/�/�/��x�s�A� A'�&A'c�:����|r?tjt|��}���fd�|D��}d�|��St	|��|z
}�|z
��dkrt�|��S�dkrt
�|��S�s|�St�|��S)zIPad string header to width chars given known visible_width of the header.c
�F��g|]}t|���|������Sr>��
_align_header)rE�hrVr�rFs  ���rrGz!_align_header.<locals>.<listcomp>�s<���
�
�
�@A�M�!�Y��x�x��{�{�;�;�
�
�
rr~r=r<)r�r9r2rJr1rr!r)	rwrVr��
visible_widthrErF�header_lines�padded_lines�
ninvisibles	 ``  `   rr�r��s�������'��x� 0�&�9�9��
�
�
�
�
�
�EQ�
�
�
���y�y��&�&�&��V���}�,�J�	�Z��E��F������'�'�'�	�h�	�	���v�&�&�&�
�'��{����v�&�&�&rc���t|��tkrWg}g}t|��D]?\}}t|��r|�|���*|�|���@||fS|dfSr)r.r/�	enumerater6r�)r��separating_lines�	sans_rows�indexr3s     r�_remove_separating_linesr��s����D�z�z�T������	�#�D�/�/�	&�	&�J�E�3�"�3�'�'�
&� �'�'��.�.�.�.�� � ��%�%�%�%��*�*�*��T�z�rc�N�|r |D]}|�|t���dSdSr)�insertr2)r�r�r�s   r�_reinsert_separating_linesr��sD���0�%�	0�	0�E��K�K���/�/�/�/�0�0�	0�	0rc	���|�|dur|St|t��r`t|��t|��kr@tdd�t|��t|����z���t|��\}}g}t
|��}|D]7}t|��}|�|gt|��z���8|}t||��|S)zAdd a left-most index column.NFz2index must be as long as the number of data rows: zlen(index)={} len(rows)={})r
rr1r�rlr��iter�nextr�r/r�)r�r�r�r�r��
index_iterr3�index_vs        r�_prepend_row_indexr�s����}��������%����
�C��J�J�#�d�)�)�$;�$;��@�*�1�1�#�e�*�*�c�$�i�i�H�H�
I�
�
�	
�#;�4�"@�"@��I���H��e���J��/�/���z�"�"������	�D��I�I�-�.�.�.�.��D��t�%5�6�6�6��Krc�D�	t|��S#t$rYdSwxYw)zDA wrapper around standard bool() which doesn't throw on NumPy arraysF)r�r�r�s r�_boolr�s5����C�y�y��������u�u����s��
�c�d��
���	t���d}n!#t$rd}t����YnwxYwd}t|d���r6t|d���r%t|jd��r=|����tt
|������}n�t|d��r�t|���|dvrO|jj�Ct|jjt��r|jj�dd	�<n|jjg�dd	�<|j}t|j��}d
�|D��}ntd����dkr"ttt�������n�t|��}�dkr|sg��n��dkr3t|d��r#t|j
d
��r|j
j��nM�dkrst|��d	kr`t|d	t ��rEt|d	d��r/ttt|d	j������n�t|��d	k�r�t|d	d���r�t|d	d���r�t%��}g��dkrct|��d	kr|d	ni���������|����|dd�}|D]G}|���D]0}	|	|vr*��|	��|�|	���1�H�dkr��n�t�t.��r1�fd��D���ttt������n^�dkrGt|��d	kr1�fd��D���ttt������ng�n�rtd����fd�|D��}�n�dkrBt|d��r2t|d��r"t|d��rd�|jD���n�t2�ht|��d	krUt3j|d	��r;d�t3j|d	��D���
�dkr�
��
fd�|D��}n[�dkrUt|��d	krBtttt9t|d	����������dkrtt|��d	kra|�*|d	gt|d	��z�|dd�}n|d	�ttt������|dd�}n�dkrg�ttt������ttd�|����}t;|��tt<fv}
|dkr|�t?||��}n�t|t@��r |
st?|t|����}n�t|tB��r|
st?||��}nk|dkstE|��r>|
s<|�)tt9t|������}t?||��}n|dkstE|��s|
s	�rIt|��d	kr6t���}t|d	��}||krdg||z
z�z�|�fS) aTransform a supported data type to a list of lists, and a list of headers.

    Supported tabular data types:

    * list-of-lists or another iterable of iterables

    * list of named tuples (usually used with headers="keys")

    * list of dicts (usually used with headers="keys")

    * list of OrderedDicts (usually used with headers="keys")

    * list of dataclasses (Python 3.7+ only, usually used with headers="keys")

    * 2D NumPy arrays

    * NumPy record arrays (usually used with headers="keys")

    * dict of iterables (usually used with headers="keys")

    * pandas.DataFrame (usually used with headers="keys")

    The first row can be used as headers if headers="firstrow",
    column indices can be used as headers if headers="keys".

    If showindex="default", show row indices of the pandas.DataFrame.
    If showindex="always", show row indices for all types of data.
    If showindex="never", don't show row indices for all types of data.
    If showindex is an iterable, show its values as row indices.

    FTN�keysrb�__call__r�)r�alwaysTrc�,�g|]}t|����Sr>)r/�rEr3s  rrGz+_normalize_tabular_data.<locals>.<listcomp>[s��.�.�.�#�D��I�I�.�.�.rz7tabular data doesn't appear to be a dict or a DataFrame�dtype�names�_fields�firstrowrc�<��g|]}��||����Sr>rS)rE�kr�s  �rrGz+_normalize_tabular_data.<locals>.<listcomp>�s'���;�;�;��7�;�;�q�!�,�,�;�;�;rc�<��g|]}��||����Sr>rS)rEr��	firstdicts  �rrGz+_normalize_tabular_data.<locals>.<listcomp>�s'���A�A�A�q�y�}�}�Q��2�2�A�A�Arz6headers for a list of dicts is not a dict or a keywordc�.���g|]��fd��D����S)c�:��g|]}��|����Sr>rS)rEr�r3s  �rrGz6_normalize_tabular_data.<locals>.<listcomp>.<listcomp>�s#���.�.�.�A�S�W�W�Q�Z�Z�.�.�.rr>)rEr3r�s @�rrGz+_normalize_tabular_data.<locals>.<listcomp>�s/����?�?�?�3�.�.�.�.��.�.�.�?�?�?r�description�fetchone�rowcountc��g|]
}|d��S)rr>)rE�columns  rrGz+_normalize_tabular_data.<locals>.<listcomp>�s��H�H�H�V�v�a�y�H�H�Hrc��g|]	}|j��
Sr>)�name)rE�fields  rrGz+_normalize_tabular_data.<locals>.<listcomp>�s��O�O�O�%�5�:�O�O�Orc�.���g|]��fd��D����S)c�0��g|]}t�|����Sr>)�getattr)rErr3s  �rrGz6_normalize_tabular_data.<locals>.<listcomp>.<listcomp>�s!���:�:�:��W�S�!�_�_�:�:�:rr>)rEr3�field_namess @�rrGz+_normalize_tabular_data.<locals>.<listcomp>�s/����K�K�K�s�:�:�:�:�k�:�:�:�K�K�Krc�B�t|��r|nt|��Sr)r6r/)r|s rrAz)_normalize_tabular_data.<locals>.<lambda>�s��#6�q�#9�#9�F�a�a�t�A�w�w�rrr��neverr)#r�r�r/rrbr��izip_longestr�r�r
r�r0r�r�r�r1�tupler��set�extend�updater��add�dictr��dataclasses�is_dataclass�fields�ranger.r�r�rrr�)�tabular_datar��	showindex�is_headers2bool_brokenr�r��vals�	uniq_keysr3r��showindex_is_a_str�nhs�ncolsr�r�r�s `           @@@r�_normalize_tabular_datar�s�������B ��W�
�
�
�!&����� � � �!%���w�-�-���� ����
�E��|�V�$�$�j:���x�)H�)H�j:��<�&�
�3�3�	X��$�$�&�&�D���l�1�1�3�3�4���D�D��\�7�
+�
+�	X���%�%�D��8�8�8� �&�+�7��l�0�5�t�<�<�9�+�1�6�D��!��H�H� ,� 2� 7�8�D��!��H��&�D���+�,�,�E�.�.��.�.�.�D�D��V�W�W�W��f����3�s�D�>�>�*�*�G���L�!�!���f���T���G�G��v�����g�.�.�
���*�G�4�4�
�
#�(�.�G�G��v����D�	�	�A�
�
��4��7�E�*�*����Q���+�+��
�3�s�D��G�O�4�4�5�5�G�G�
��Y�Y��]�]�w�t�A�w��7�7�]�G�D��G�X�<V�<V�]����I��D��*�$�$�'*�4�y�y�1�}�}�D��G�G�"�	����I�N�N�,�,�-�-�-�� � ��&�&�&��A�B�B�x���
)�
)�������)�)�A��	�)�)����A����!�
�
�a�(�(�(��	)�
�&� � �����G�T�*�*�

�;�;�;�;�d�;�;�;���s�3��0�0�1�1����J�&�&��t�9�9�q�=�=�A�A�A�A�D�A�A�A�G�"�3�s�G�#4�#4�5�5�G�G� �G�G��
� �L����@�?�?�?�$�?�?�?�D�D�
�v�����m�4�4�
���j�1�1�
���j�1�1�
�I�H�|�/G�H�H�H�G�G�
�#��D�	�	�A�
�
��(��a��1�1��P�O�;�3E�d�1�g�3N�3N�O�O�O�K��&� � �%��K�K�K�K�d�K�K�K�D�D�
��
�
�3�t�9�9�q�=�=��3�s�E�#�d�1�g�,�,�$7�$7�8�8�9�9�G��*����T���Q������Q�x�j�4��Q��=�=�0�G��!�"�"�I�E�E��1�g�G��s�3��(�(�)�)���A�B�B�x���	�J�	�	����3�s�G�$�$�%�%�G���F�F��M�M�N�N�D��i���S�%�L�8���I���%�"3�!�$��.�.���	�I�u�	%�	%�	
�.@�	
�!�$��Y���8�8���	�I�x�	(�	(�
�1C�
�!�$�	�2�2���	�h�	�	�5��#3�#3�	�<N�	��=���s�4�y�y�)�)�*�*�E�!�$��.�.���	�g�	�	�e�I�&6�&6�	�?Q�	���5�3�t�9�9�q�=�=��'�l�l���D��G������;�;��d�e�c�k�*�W�4�G���=�s��6�6c�@�t|t|d��d��}g}|D]�}g}t|||��D]�\}}}t|��r|r|�|���-|��t|���}	t|��rt
|��nt||��|��}
|	�|
��}|�d�	|������|�|����|�|����|S)NrT)r�r~)
�_expand_iterabler1rIrr��_CustomTextWrapr0r�wraprJ)�
list_of_listsrK�	numparses�resultr3r�r�r�r�wrapper�casted_cell�wrappeds            r�_wrap_text_to_colwidthsr��s2�� ��C�
�a�0@�,A�,A�4�H�H�I�
�F�������%(��i��%C�%C�	%�	%�!�D�%������
�8�
����t�$�$�$��� �)��6�6�6��
"+�4���Q�C��I�I�I�6K�e�D�(�6K�6K�D�6Q�6Q��"�,�,�{�3�3�����t�y�y��1�1�2�2�2�2����t�$�$�$�$��
�
�g������Mr�ignorec�x�t|t��r|�||���St|��S)a)
    A type safe wrapper for converting a bytestring to str. This is essentially just
    a wrapper around .decode() intended for use with things like map(), but with some
    specific behavior:

    1. if the given parameter is not a bytestring, it is returned unmodified
    2. decode() is called for the given parameter and assumes utf8 encoding, but the
       default error behavior is changed from 'strict' to 'ignore'

    >>> repr(_to_str(b'foo'))
    "'foo'"

    >>> repr(_to_str('foo'))
    "'foo'"

    >>> repr(_to_str(42))
    "'42'"

    )�encoding�errors)r
r�r�r0)rr�r�s   r�_to_strr��s7��(�!�U���:��x�x��&�x�9�9�9��q�6�6�Mrr>c	����!�"�#�$�%�|�g}t|||���\}}t|��\}}|�ot|d��}t|t��rt|||��}nt||d��}t
|	|��}t|||���}|
�vt|d��}t|
t��rt|
||
��}
nt|
|d��}
t
|	|��}t|g|
|���d}|dkrt||��\}}t�$|dkr#d�$d}	�tkrdn���tkrdn��n�tkrd	n���tkrd
n��d�ttt|��tjd�|D��������}t �|��du�"t$duot&�!t|t(��s6|t*vr-t-|��rt*�||��}d�#nd
�#t1�"�!�#���%t3t5|���}t
|	t|����}d�t7||��D��}t|t8��rt|��|gz}njt3|��}t|��t|��kr;|�t|��t|��z
t<gz��t|t8��rt|��|gz}njt3|��}t|��t|��kr;|�t|��t|��z
t>gz��t|t8��rt|��|gz}njt3|��}t|��t|��kr;|�t|��t|��z
t@gz���"fd�t7|||||��D��}��fd�|D��}|
�1t|
tB��sJ�tE|
��D]
\}}|||<�|r�$�%fd�|D��ndgt|��z}�!�"�#fd�t7|||��D��}|r||pdggt|��z}|p�gt|��z}�%fd�t7||��D��}�#�%fd�t7|||��D��}t3t7|���}n$�%fd�|D��}t3t7|���}t|t(��s&tF�|tFd��}t|t8��r|nd}t|t|��|��} tI||��tK|||||�#| ���S)u�JFormat a fixed width table for pretty printing.

    >>> print(tabulate([[1, 2.34], [-56, "8.999"], ["2", "10001"]]))
    ---  ---------
      1      2.34
    -56      8.999
      2  10001
    ---  ---------

    The first required argument (`tabular_data`) can be a
    list-of-lists (or another iterable of iterables), a list of named
    tuples, a dictionary of iterables, an iterable of dictionaries,
    an iterable of dataclasses (Python 3.7+), a two-dimensional NumPy array,
    NumPy record array, or a Pandas' dataframe.


    Table headers
    -------------

    To print nice column headers, supply the second argument (`headers`):

      - `headers` can be an explicit list of column headers
      - if `headers="firstrow"`, then the first row of data is used
      - if `headers="keys"`, then dictionary keys or column indices are used

    Otherwise a headerless table is produced.

    If the number of headers is less than the number of columns, they
    are supposed to be names of the last columns. This is consistent
    with the plain-text format of R and Pandas' dataframes.

    >>> print(tabulate([["sex","age"],["Alice","F",24],["Bob","M",19]],
    ...       headers="firstrow"))
           sex      age
    -----  -----  -----
    Alice  F         24
    Bob    M         19

    By default, pandas.DataFrame data have an additional column called
    row index. To add a similar column to all other types of data,
    use `showindex="always"` or `showindex=True`. To suppress row indices
    for all types of data, pass `showindex="never" or `showindex=False`.
    To add a custom row index column, pass `showindex=some_iterable`.

    >>> print(tabulate([["F",24],["M",19]], showindex="always"))
    -  -  --
    0  F  24
    1  M  19
    -  -  --


    Column alignment
    ----------------

    `tabulate` tries to detect column types automatically, and aligns
    the values properly. By default it aligns decimal points of the
    numbers (or flushes integer numbers to the right), and flushes
    everything else to the left. Possible column alignments
    (`numalign`, `stralign`) are: "right", "center", "left", "decimal"
    (only for `numalign`), and None (to disable alignment).


    Table formats
    -------------

    `intfmt` is a format specification used for columns which
    contain numeric data without a decimal point. This can also be
    a list or tuple of format strings, one per column.

    `floatfmt` is a format specification used for columns which
    contain numeric data with a decimal point. This can also be
    a list or tuple of format strings, one per column.

    `None` values are replaced with a `missingval` string (like
    `floatfmt`, this can also be a list of values for different
    columns):

    >>> print(tabulate([["spam", 1, None],
    ...                 ["eggs", 42, 3.14],
    ...                 ["other", None, 2.7]], missingval="?"))
    -----  --  ----
    spam    1  ?
    eggs   42  3.14
    other   ?  2.7
    -----  --  ----

    Various plain-text table formats (`tablefmt`) are supported:
    'plain', 'simple', 'grid', 'pipe', 'orgtbl', 'rst', 'mediawiki',
    'latex', 'latex_raw', 'latex_booktabs', 'latex_longtable' and tsv.
    Variable `tabulate_formats`contains the list of currently supported formats.

    "plain" format doesn't use any pseudographics to draw tables,
    it separates columns with a double space:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                 ["strings", "numbers"], "plain"))
    strings      numbers
    spam         41.9999
    eggs        451

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="plain"))
    spam   41.9999
    eggs  451

    "simple" format is like Pandoc simple_tables:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                 ["strings", "numbers"], "simple"))
    strings      numbers
    ---------  ---------
    spam         41.9999
    eggs        451

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="simple"))
    ----  --------
    spam   41.9999
    eggs  451
    ----  --------

    "grid" is similar to tables produced by Emacs table.el package or
    Pandoc grid_tables:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "grid"))
    +-----------+-----------+
    | strings   |   numbers |
    +===========+===========+
    | spam      |   41.9999 |
    +-----------+-----------+
    | eggs      |  451      |
    +-----------+-----------+

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="grid"))
    +------+----------+
    | spam |  41.9999 |
    +------+----------+
    | eggs | 451      |
    +------+----------+

    "simple_grid" draws a grid using single-line box-drawing
    characters:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "simple_grid"))
    ┌───────────┬───────────┐
    │ strings   │   numbers │
    ├───────────┼───────────┤
    │ spam      │   41.9999 │
    ├───────────┼───────────┤
    │ eggs      │  451      │
    └───────────┴───────────┘

    "rounded_grid" draws a grid using single-line box-drawing
    characters with rounded corners:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "rounded_grid"))
    ╭───────────┬───────────╮
    │ strings   │   numbers │
    ├───────────┼───────────┤
    │ spam      │   41.9999 │
    ├───────────┼───────────┤
    │ eggs      │  451      │
    ╰───────────┴───────────╯

    "heavy_grid" draws a grid using bold (thick) single-line box-drawing
    characters:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "heavy_grid"))
    ┏━━━━━━━━━━━┳━━━━━━━━━━━┓
    ┃ strings   ┃   numbers ┃
    ┣━━━━━━━━━━━╋━━━━━━━━━━━┫
    ┃ spam      ┃   41.9999 ┃
    ┣━━━━━━━━━━━╋━━━━━━━━━━━┫
    ┃ eggs      ┃  451      ┃
    ┗━━━━━━━━━━━┻━━━━━━━━━━━┛

    "mixed_grid" draws a grid using a mix of light (thin) and heavy (thick) lines
    box-drawing characters:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "mixed_grid"))
    ┍━━━━━━━━━━━┯━━━━━━━━━━━┑
    │ strings   │   numbers │
    ┝━━━━━━━━━━━┿━━━━━━━━━━━┥
    │ spam      │   41.9999 │
    ├───────────┼───────────┤
    │ eggs      │  451      │
    ┕━━━━━━━━━━━┷━━━━━━━━━━━┙

    "double_grid" draws a grid using double-line box-drawing
    characters:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "double_grid"))
    ╔═══════════╦═══════════╗
    ║ strings   ║   numbers ║
    ╠═══════════╬═══════════╣
    ║ spam      ║   41.9999 ║
    ╠═══════════╬═══════════╣
    ║ eggs      ║  451      ║
    ╚═══════════╩═══════════╝

    "fancy_grid" draws a grid using a mix of single and
    double-line box-drawing characters:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "fancy_grid"))
    ╒═══════════╤═══════════╕
    │ strings   │   numbers │
    ╞═══════════╪═══════════╡
    │ spam      │   41.9999 │
    ├───────────┼───────────┤
    │ eggs      │  451      │
    ╘═══════════╧═══════════╛

    "outline" is the same as the "grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "outline"))
    +-----------+-----------+
    | strings   |   numbers |
    +===========+===========+
    | spam      |   41.9999 |
    | eggs      |  451      |
    +-----------+-----------+

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="outline"))
    +------+----------+
    | spam |  41.9999 |
    | eggs | 451      |
    +------+----------+

    "simple_outline" is the same as the "simple_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "simple_outline"))
    ┌───────────┬───────────┐
    │ strings   │   numbers │
    ├───────────┼───────────┤
    │ spam      │   41.9999 │
    │ eggs      │  451      │
    └───────────┴───────────┘

    "rounded_outline" is the same as the "rounded_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "rounded_outline"))
    ╭───────────┬───────────╮
    │ strings   │   numbers │
    ├───────────┼───────────┤
    │ spam      │   41.9999 │
    │ eggs      │  451      │
    ╰───────────┴───────────╯

    "heavy_outline" is the same as the "heavy_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "heavy_outline"))
    ┏━━━━━━━━━━━┳━━━━━━━━━━━┓
    ┃ strings   ┃   numbers ┃
    ┣━━━━━━━━━━━╋━━━━━━━━━━━┫
    ┃ spam      ┃   41.9999 ┃
    ┃ eggs      ┃  451      ┃
    ┗━━━━━━━━━━━┻━━━━━━━━━━━┛

    "mixed_outline" is the same as the "mixed_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "mixed_outline"))
    ┍━━━━━━━━━━━┯━━━━━━━━━━━┑
    │ strings   │   numbers │
    ┝━━━━━━━━━━━┿━━━━━━━━━━━┥
    │ spam      │   41.9999 │
    │ eggs      │  451      │
    ┕━━━━━━━━━━━┷━━━━━━━━━━━┙

    "double_outline" is the same as the "double_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "double_outline"))
    ╔═══════════╦═══════════╗
    ║ strings   ║   numbers ║
    ╠═══════════╬═══════════╣
    ║ spam      ║   41.9999 ║
    ║ eggs      ║  451      ║
    ╚═══════════╩═══════════╝

    "fancy_outline" is the same as the "fancy_grid" format but doesn't draw lines between rows:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "fancy_outline"))
    ╒═══════════╤═══════════╕
    │ strings   │   numbers │
    ╞═══════════╪═══════════╡
    │ spam      │   41.9999 │
    │ eggs      │  451      │
    ╘═══════════╧═══════════╛

    "pipe" is like tables in PHP Markdown Extra extension or Pandoc
    pipe_tables:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "pipe"))
    | strings   |   numbers |
    |:----------|----------:|
    | spam      |   41.9999 |
    | eggs      |  451      |

    "presto" is like tables produce by the Presto CLI:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "presto"))
     strings   |   numbers
    -----------+-----------
     spam      |   41.9999
     eggs      |  451

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="pipe"))
    |:-----|---------:|
    | spam |  41.9999 |
    | eggs | 451      |

    "orgtbl" is like tables in Emacs org-mode and orgtbl-mode. They
    are slightly different from "pipe" format by not using colons to
    define column alignment, and using a "+" sign to indicate line
    intersections:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "orgtbl"))
    | strings   |   numbers |
    |-----------+-----------|
    | spam      |   41.9999 |
    | eggs      |  451      |


    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="orgtbl"))
    | spam |  41.9999 |
    | eggs | 451      |

    "rst" is like a simple table format from reStructuredText; please
    note that reStructuredText accepts also "grid" tables:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
    ...                ["strings", "numbers"], "rst"))
    =========  =========
    strings      numbers
    =========  =========
    spam         41.9999
    eggs        451
    =========  =========

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="rst"))
    ====  ========
    spam   41.9999
    eggs  451
    ====  ========

    "mediawiki" produces a table markup used in Wikipedia and on other
    MediaWiki-based sites:

    >>> print(tabulate([["strings", "numbers"], ["spam", 41.9999], ["eggs", "451.0"]],
    ...                headers="firstrow", tablefmt="mediawiki"))
    {| class="wikitable" style="text-align: left;"
    |+ <!-- caption -->
    |-
    ! strings   !! align="right"|   numbers
    |-
    | spam      || align="right"|   41.9999
    |-
    | eggs      || align="right"|  451
    |}

    "html" produces HTML markup as an html.escape'd str
    with a ._repr_html_ method so that Jupyter Lab and Notebook display the HTML
    and a .str property so that the raw HTML remains accessible
    the unsafehtml table format can be used if an unescaped HTML format is required:

    >>> print(tabulate([["strings", "numbers"], ["spam", 41.9999], ["eggs", "451.0"]],
    ...                headers="firstrow", tablefmt="html"))
    <table>
    <thead>
    <tr><th>strings  </th><th style="text-align: right;">  numbers</th></tr>
    </thead>
    <tbody>
    <tr><td>spam     </td><td style="text-align: right;">  41.9999</td></tr>
    <tr><td>eggs     </td><td style="text-align: right;"> 451     </td></tr>
    </tbody>
    </table>

    "latex" produces a tabular environment of LaTeX document markup:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="latex"))
    \begin{tabular}{lr}
    \hline
     spam &  41.9999 \\
     eggs & 451      \\
    \hline
    \end{tabular}

    "latex_raw" is similar to "latex", but doesn't escape special characters,
    such as backslash and underscore, so LaTeX commands may embedded into
    cells' values:

    >>> print(tabulate([["spam$_9$", 41.9999], ["\\emph{eggs}", "451.0"]], tablefmt="latex_raw"))
    \begin{tabular}{lr}
    \hline
     spam$_9$    &  41.9999 \\
     \emph{eggs} & 451      \\
    \hline
    \end{tabular}

    "latex_booktabs" produces a tabular environment of LaTeX document markup
    using the booktabs.sty package:

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="latex_booktabs"))
    \begin{tabular}{lr}
    \toprule
     spam &  41.9999 \\
     eggs & 451      \\
    \bottomrule
    \end{tabular}

    "latex_longtable" produces a tabular environment that can stretch along
    multiple pages, using the longtable package for LaTeX.

    >>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="latex_longtable"))
    \begin{longtable}{lr}
    \hline
     spam &  41.9999 \\
     eggs & 451      \\
    \hline
    \end{longtable}


    Number parsing
    --------------
    By default, anything which can be parsed as a number is a number.
    This ensures numbers represented as strings are aligned properly.
    This can lead to weird results for particular strings such as
    specific git SHAs e.g. "42992e1" will be parsed into the number
    429920 and aligned as such.

    To completely disable number parsing (and alignment), use
    `disable_numparse=True`. For more fine grained control, a list column
    indices is used to disable number parsing only on those columns
    e.g. `disable_numparse=[0, 2]` would disable number parsing only on the
    first and third columns.

    Column Widths and Auto Line Wrapping
    ------------------------------------
    Tabulate will, by default, set the width of each column to the length of the
    longest element in that column. However, in situations where fields are expected
    to reasonably be too long to look good as a single line, tabulate can help automate
    word wrapping long fields for you. Use the parameter `maxcolwidth` to provide a
    list of maximal column widths

    >>> print(tabulate(           [('1', 'John Smith',             'This is a rather long description that might look better if it is wrapped a bit')],           headers=("Issue Id", "Author", "Description"),           maxcolwidths=[None, None, 30],           tablefmt="grid"          ))
    +------------+------------+-------------------------------+
    |   Issue Id | Author     | Description                   |
    +============+============+===============================+
    |          1 | John Smith | This is a rather long         |
    |            |            | description that might look   |
    |            |            | better if it is wrapped a bit |
    +------------+------------+-------------------------------+

    Header column width can be specified in a similar way using `maxheadercolwidth`

    N)r�r)r�r�r�Tr<r9r=r�c3�@K�|]}tt|��V��dSr)r�r�r�s  rr`ztabulate.<locals>.<genexpr>=s,����K�K�c��G�S� 1� 1�K�K�K�K�K�KrFc�6�g|]\}}t||�����S))r)r�)rE�col�nps   rrGztabulate.<locals>.<listcomp>Rs)��S�S�S�7�3���S�2�.�.�.�S�S�Src�H������g|]\}���������fd�|D����S)c
�8��g|]}t|���������Sr>)r�)rEr_�ct�fl_fmtr�int_fmt�miss_vs  �����rrGz'tabulate.<locals>.<listcomp>.<listcomp>js+���K�K�K�A���B�����	?�	?�K�K�Krr>)rErUr�r�r�r�rs  @@@@�rrGztabulate.<locals>.<listcomp>isX����������*�A�r�6�7�F�	L�K�K�K�K�K�K�K��K�K�K���rc�8��g|]}|ttfvr�n���Sr>)r
r�)rEr��numalign�straligns  ��rrGztabulate.<locals>.<listcomp>qs+���
N�
N�
N�r�"��e��,�,�h�h�(�
N�
N�
Nrc�,��g|]}�|���z��Sr>r>)rEr��min_paddingrFs  ��rrGztabulate.<locals>.<listcomp>ws&���4�4�4�q���!���{�	"�4�4�4rc
�@��g|]\}}}t|||�������Sr>)r~)rErUrF�minwrDrrEs    ���rrGztabulate.<locals>.<listcomp>ysB�������A�q�$�	�a��D�-�1A�<�P�P���rrc	�h��g|].\}}t|t�fd�|D��������/S)c3�.�K�|]}�|��V��dSrr>�rE�clrFs  �rr`z&tabulate.<locals>.<listcomp>.<genexpr>�s+�����3�3�2�(�(�2�,�,�3�3�3�3�3�3r�r8)rErrUrFs   �rrGztabulate.<locals>.<listcomp>�sT���
�
�
���a�
��c�3�3�3�3��3�3�3�3�3�4�4�
�
�
rc
�R��g|]#\}}}t|||�|��������$Sr>r�)rEr�rFrrErFs    ��rrGztabulate.<locals>.<listcomp>�sI���
�
�
���1�d�
�!�Q��h�h�q�k�k�<��J�J�
�
�
rc�F��g|]}t�fd�|D������S)c3�.�K�|]}�|��V��dSrr>rs  �rr`z&tabulate.<locals>.<listcomp>.<genexpr>�s+�����2�2�"���"���2�2�2�2�2�2rr)rErUrFs  �rrGztabulate.<locals>.<listcomp>�s6���A�A�A�q�S�2�2�2�2��2�2�2�2�2�A�A�Arr�)�	rowaligns)&r�r�r1r
r
r��_expand_numparser�r��MIN_PADDING�_DEFAULT_ALIGNrJrr�r��
from_iterabler&r1r+r,r$�multiline_formatsr4rTrGr/r�rIr0r��_DEFAULT_FLOATFMT�_DEFAULT_INTFMT�_DEFAULT_MISSINGVALrr��_table_formatsr��
_format_table)&r�r��tablefmtr�r�r�r�r�r��disable_numparser��maxcolwidths�rowalign�maxheadercolwidthsr�r��num_colsr��
plain_text�cols�coltypes�
float_formats�int_formats�missing_vals�aligns�idxr?�	minwidths�t_cols�t_alignsr��
ra_defaultrrDrrErrFs&     ``                          @@@@@rrrs���������Z����4��g������M�7�'?�}�&M�&M�#�M�#����}�Q�'�(�(���l�C�(�(�	J�+�L�(�L�Q�Q�L�L�+�L�(�D�I�I�L�$�%5�x�@�@�	�/��<�9�
�
�
�
��%��}�Q�'�(�(���(�#�.�.�	V�!1�"�H�.@�"�"���"2�2D�h�PT�!U�!U��$�%5�x�@�@�	�)�
�I�)�Y�
�
�
�
�
���5���!9�-��!Q�!Q��
�w��K��8�������'�>�9�9�8�8�x��'�>�9�9�8�8�x��� (�N� :� :�9�9���%��7�7�6�6�X�����
����!�!�
��K�K�]�K�K�K�K�K�	
�	
���J� �&�&�z�2�2�$�>�M��d�*�>����x��-�-���)�)�)��*�%�%�
*�%�(�(��8�<�<��������
�/?��N�N�H���m�,�-�-�D� �!1�3�t�9�9�=�=�I�S�S�c�$�	�>R�>R�S�S�S�H��(�C� � �Y��D�	�	��%
�
�
�
��X���
��}����D�	�	�)�)�� � �#�d�)�)�c�-�.@�.@�"@�EV�DW�!W�X�X�X��&�#���S��$�i�i��#
�
����6�l�l���{���c�$�i�i�'�'�����D�	�	�C��,<�,<� <��@Q�Q�R�R�R��*�c�"�"�Y��4�y�y�J�<�/����J�'�'���|���s�4�y�y�(�(�����T���S��->�->�!>�CV�BW� W�X�X�X�����.1��(�M�;��/
�/
����D�O�
N�
N�
N�
N�X�
N�
N�
N�F����(�H�-�-�-�-�-�#�H�-�-�	 �	 �J�C���F�3�K�K�8?�T�4�4�4�4�4�G�4�4�4�4�a�S�3�t�9�9�_���������d�F�I�6�6����D�
� ��.�2�$��#�g�,�,�.���6�h�Z�#�g�,�,�6��
�
�
�
��y�&�1�1�
�
�
�	�
�
�
�
�
�!�'�8�Y�?�?�
�
�
���C��J�����A�A�A�A�D�A�A�A�	��C��J�����h��,�,�J�!�%�%�h��x�0H�I�I��'��#�6�6�@���D�J� ��3�t�9�9�j�A�A�I��t�%5�6�6�6���'�4��F�L�I����rc�^�t|t��rdg|z}|D]}d||<�|S|g|zS)aB
    Return a list of bools of length `column_count` which indicates whether
    number parsing should be used on each column.
    If `disable_numparse` is a list of indices, each of those indices are False,
    and everything else is True.
    If `disable_numparse` is a bool, then the returned list is all the same.
    TF)r
r)r�column_countr�r�s    rr
r
�sV���"�H�-�-�5��F�\�)�	�%�	%�	%�E�$�I�e�����$�$�%��4�4rc��t|t��r.t|t��s||g|t|��z
zzS|g|zS)aY
    Expands the `original` argument to return a return a list of
    length `num_desired`. If `original` is shorter than `num_desired`, it will
    be padded with the value in `default`.
    If `original` is not a list to begin with (i.e. scalar value) a list of
    length `num_desired` completely populated with `default will be returned
    )r
rr0r1)�original�num_desiredrs   rr�r��sQ���(�H�%�%�'�j��3�.G�.G�'��7�)�{�S��]�]�'B�C�C�C��y�;�&�&rc�6��|rd|z��fd�|D��}|S|S)NrRc� ��g|]
}�|z�z��Sr>r>)rEr��pads  �rrGz_pad_row.<locals>.<listcomp>�s"���;�;�;�T��d�
�S�(�;�;�;rr>)�cellsr+�padded_cellsr0s   @r�_pad_rowr3�s8������G�m��;�;�;�;�U�;�;�;�����rc�h�|\}}}||�|��z|z���S)z7Format row according to DataRow format without padding.)rJrW)r2r�rr!r"s     rr�r��s5���O�E�3���C�H�H�\�*�*�*�S�0�8�8�:�:�:rc�d�|sdSt|d��r
||||��St||��S)z5Return a string which represents a row of data cells.Nr��rr�)r2rKrLr�s    r�
_build_rowr7�sE�����t��v�z�"�"�7��v�l�I�y�9�9�9� ��v�6�6�6rc�P�|�t||||����|Sr)r�r7)�linesr2rKrLr�rs      r�_append_basic_rowr:�s'��	�L�L��L�)�Y��G�G�H�H�H��Lrc��|t|��z
}d|zg}|dkr||z|zS|dkr|dz}||z
}||z|z||zzS|||zzS)NrR�bottomr<rrm)�
text_lines�	num_lines�column_width�
row_alignment�delta_lines�blank�	top_delta�bottom_deltas        r�_align_cell_veriticallyrE�s����c�*�o�o�-�K�
�<�
� �E��� � ��{�"�Z�/�/�	�(�	"�	"��1�$�	�"�Y�.���5� �:�-��u�0D�D�D��E�K�/�/�/rc�F������fd�|D��}d�|D���ttt��������fd�t�|��D����fd�t	���D��}|D]%}	t|	���}
t
||
|||���&|S)Nc� ��g|]
}|d�zz
��S�rr>�rErAr0s  �rrGz)_append_multiline_row.<locals>.<listcomp>�s!���4�4�4���Q��W��4�4�4rc�6�g|]}|�����Sr>)ri)rErUs  rrGz)_append_multiline_row.<locals>.<listcomp>�s ��B�B�B�a�1�<�<�>�>�B�B�Brc�:��g|]\}}t|�|�����Sr>)rE)rErrA�nlinesrs   ��rrGz)_append_multiline_row.<locals>.<listcomp>�s;�������B��	 ��F�A�x�8�8���rc�.���g|]��fd��D����S)c� ��g|]
}|���Sr>r>)rEr�is  �rrGz4_append_multiline_row.<locals>.<listcomp>.<listcomp>�s���0�0�0�b�B�q�E�0�0�0rr>)rErO�cells_liness @�rrGz)_append_multiline_row.<locals>.<listcomp>�s/����H�H�H�Q�0�0�0�0�K�0�0�0�H�H�Hr)r8r�r1rIr�r3r:)
r9�padded_multiline_cells�
padded_widthsrLr�r0rrK�lines_cells�ln�	padded_lnrPrLs
     ``    @@r�_append_multiline_rowrV�s�������5�4�4�4�m�4�4�4�I�B�B�+A�B�B�B�K�
��S�+�&�&�
'�
'�F��������i�0�0����K�I�H�H�H�%��-�-�H�H�H�K��J�J���R��%�%�	��%��I�y�&�I�I�I�I��Lrc���|sdSt|d��r|||��S|\}�}}�fd�|D��}t||||f��S)z3Return a string which represents a horizontal line.Nr�c���g|]}�|z��Sr>r>)rErA�fills  �rrGz_build_line.<locals>.<listcomp>	s���-�-�-�a����-�-�-rr6)rKrL�linefmtrr!r"r1rYs       @r�_build_liner[�sr������t��w�
�#�#�;��w�y�)�,�,�,� '���t�S�#�-�-�-�-�9�-�-�-�� ����S�(9�:�:�:rc�N�|�t|||����|Sr)r�r[)r9rKrLrZs    r�_append_liner]	s%��	�L�L��Y�	�7�;�;�<�<�<��Lrc�.�eZdZdZd�Zed���ZdS)�JupyterHTMLStrzUWrap the string with a _repr_html_ method so that Jupyter
    displays the HTML tablec��|Srr>��selfs r�_repr_html_zJupyterHTMLStr._repr_html_	s���rc��|S)z>add a .str property so that the raw string is still accessibler>ras rr0zJupyterHTMLStr.str	s	���rN)�__name__�
__module__�__qualname__�__doc__rc�propertyr0r>rrr_r_
	sH���������������X���rr_c	����g}|r|jr|jng}|j�|j}	�fd�|D��}
|rd��tt����}nt
�t}�|���}��fd�|D��}
|jrd|vrt||
||j��|r1||||
||	��|j	rd|vrt||
||j	��|
ry|j
rrd|vrnt|
dd	�|��D]2\}}||||
||j|�
��t||
||j
���3|||
d	|
||j|d	�
��ni|j
p&|j	p|j
p|jptdddd��}|
D]8}t|��rt||
||���$||||
||j���9|j
rd|vrt||
||j
��|s|r6d
�|��}|jt"krt%|��S|SdS)z1Produce a plain-text representation of the table.c� ��g|]
}|d�zz��SrHr>rIs  �rrGz!_format_table.<locals>.<listcomp>!	s!���6�6�6�q�a�!�c�'�k�6�6�6rc��|Srr>)r3r�s  rrAz_format_table.<locals>.<lambda>#	s���r)r0c�(��g|]}�|�����Sr>r>)rEr3r0�pad_rows  ��rrGz!_format_table.<locals>.<listcomp>*	s%���5�5�5��7�7�3��$�$�5�5�5rr%r&r'Nr)rrr(r~)r,r+r)r
rVr3r:r%r]r&r'rIr*r(rr6rJrgr_)rr�r�rKrLrErr9�hiddenr)rR�
append_row�padded_headers�padded_rowsr3�ralign�separating_line�outputr0rns                  @@rrr	s������E�&-�
O�#�2F�
O�S�
!�
!�R�F�

�+�C��
�I�6�6�6�6�I�6�6�6�M��'�$�$���2��<�<�<�
�
���&�
��W�W�c�*�*�N�5�5�5�5�5��5�5�5�K�
�}�E��F�2�2��U�M�9�c�m�D�D�D��O��
�5�.�-��I�N�N�N���	O�#4�F�#B�#B���
�y�#�:M�N�N�N��N�s�*�N�/@��/N�/N��{�3�B�3�/��;�;�	O�	O�K�C���J��s�M�9�c�k�F�
�
�
�
�
��
�y�#�:M�N�N�N�N��
����O����K��r�]�
	
�	
�	
�	
�	
�
��
$��"�
$��}�
$��}�
$��B��B��#�#�	��	N�	N�C�#�3�'�'�
N��U�M�9�o�N�N�N�N��
�5�#�}�i���M�M�M�M�
�}�E��F�2�2��U�M�9�c�m�D�D�D���$�����5�!�!���=�<�<�<�!�&�)�)�)��M��rrc�@�eZdZdZd�Zed���Zd�Zd�Zd�Z	dS)r�a[A custom implementation of CPython's textwrap.TextWrapper. This supports
    both wide characters (Korea, Japanese, Chinese)  - including mixed string.
    For the most part, the `_handle_long_word` and `_wrap_chunks` functions were
    copy pasted out of the CPython baseline, and updated with our custom length
    and line appending logic.
    c�V�g|_d|_tjj|g|�Ri|��dSr)�
_active_codes�	max_lines�textwrap�TextWrapper�__init__)rbr��kwargss   rr|z_CustomTextWrap.__init__i	s;����������%�d�<�T�<�<�<�V�<�<�<�<�<rc�t�t|��}trtj|��St|��S)zqCustom len that gets console column width for wide
        and non-wide characters as well as ignores color codes)rr+r-r1)ra�strippeds  r�_lenz_CustomTextWrap._lenn	s6���t�$�$���	!��#�H�-�-�-��x�=�=� rc�r�d�t�|��D��}d�|D��}d�|j��|z}|D]/}|tkr|j�|���(g|_�0t
|j��dkr
|tz}|�|��dS)aAdds a new line to the list of lines the text is being wrapped into
        This function will also track any ANSI color codes in this string as well
        as add any colors from previous lines order to preserve the same formatting
        as a single unwrapped string.
        c��g|]}|��Sr>r>)rE�xs  rrGz1_CustomTextWrap._update_lines.<locals>.<listcomp>~	s��B�B�B�a��B�B�Brc��g|]A}|j|���d|���d���BS)rr)r��span)rE�codes  rrGz1_CustomTextWrap._update_lines.<locals>.<listcomp>	sI��
�
�
�=A�D�K��	�	���A�������Q��7�8�
�
�
rrrN)r&�finditerrJrx�_ansi_color_reset_coder�r1)rbr9�new_line�code_matches�color_codesr�s      r�
_update_linesz_CustomTextWrap._update_linesx	s���C�B�;�#7�#7��#A�#A�B�B�B��
�
�EQ�
�
�
��
�7�7�4�-�.�.��9���	(�	(�D��-�-�-��"�)�)�$�/�/�/�/�%'��"�"��t�!�"�"�Q�&�&��"8�8�H�
���X�����rc��|dkrd}n||z
}|jr�|d}d}|�|d|���|kr&|dz}|�|d|���|k�&|�|d|dz
���||dz
d�|d<dS|s)|�|�����dSdS)a	_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)
        Handle a chunk of text (most likely a word, not whitespace) that
        is too long to fit in any line.
        rrN)�break_long_wordsr�r��pop)rb�reversed_chunks�cur_line�cur_lenr��
space_left�chunkrOs        r�_handle_long_wordz!_CustomTextWrap._handle_long_word�	s����1�9�9��J�J����J�� �	3�$�B�'�E��A��)�)�E�"�1�"�I�&�&�*�4�4���E���)�)�E�"�1�"�I�&�&�*�4�4��O�O�E�'�A��E�'�N�+�+�+�"'��A����.�O�B����
�	3��O�O�O�/�/�1�1�2�2�2�2�2�	3�	3rc��g}|jdkrtd|jz���|j�t|jdkr|j}n|j}|�|��|�|j�����z|jkrtd���|���|�r"g}d}|r|j}n|j}|j|�|��z
}|j	r#|d�
��dkr|r|d=|rT|�|d��}||z|kr-|�|�����||z
}nn|�T|rY|�|d��|kr:|�
||||��tt|j|����}|j	rA|r?|d�
��dkr!||�|d��z}|d=|�r�|j�Wt!|��dz|jks<|r4|j	rat!|��dkrN|d�
��s4||kr.|�||d�|��z���n;|r�|d�
��rh||�|j��z|krG|�|j��|�||d�|��z��n�||�|d��z}|d=|��|ra|d���}|�|��|�|j��z|jkr||jz|d<n4|�|||j���z��n|��"|S)a�_wrap_chunks(chunks : [string]) -> [string]
        Wrap a sequence of text chunks and return a list of lines of
        length 'self.width' or less.  (If 'break_long_words' is false,
        some lines may be longer than this.)  Chunks correspond roughly
        to words and the whitespace between them: each chunk is
        indivisible (modulo 'break_long_words'), but a line break can
        come between any two chunks.  Chunks should not have internal
        whitespace; ie. a chunk is either all whitespace or a "word".
        Whitespace chunks will be removed from the beginning and end of
        lines, but apart from that whitespace is preserved.
        rzinvalid width %r (must be > 0)Nrz#placeholder too large for max widthrr)r�r�ry�subsequent_indent�initial_indentr��placeholder�lstrip�reverse�drop_whitespacer�r�r�r��sumr�r1r�rJrW)	rb�chunksr9�indentr�r�r��	chunk_len�	prev_lines	         r�_wrap_chunksz_CustomTextWrap._wrap_chunks�	s$�����:��?�?��=��
�J�K�K�K��>�%��~��!�!��/����,���y�y�� � �4�9�9�T�-=�-D�-D�-F�-F�#G�#G�G�$�*�T�T� �!F�G�G�G�	�������P	��H��G��
-��/����,���J����6�!2�!2�2�E��#�
��r�
�(8�(8�(:�(:�b�(@�(@�U�(@��2�J��

� �I�I�f�R�j�1�1�	��Y�&�%�/�/��O�O�F�J�J�L�L�1�1�1��y�(�G�G���

��
8�$�)�)�F�2�J�/�/�%�7�7��&�&�v�x��%�H�H�H��c�$�)�X�6�6�7�7���#�
!��
!�X�b�\�5G�5G�5I�5I�R�5O�5O��4�9�9�X�b�\�2�2�2���R�L��$
��N�*��5�z�z�A�~���6�6�"�7� �/�7� ��K�K�1�,�,� &�q�	��� 1� 1�-� �5�(�(��&�&�u�f�r�w�w�x�7H�7H�.H�I�I�I�I�"�V�$�R�L�.�.�0�0�"� '�$�)�)�D�4D�*E�*E� E�� N� N�$�O�O�D�,<�=�=�=� �.�.�u�f�r�w�w�x�?P�?P�6P�Q�Q�Q�!��4�9�9�X�b�\�#:�#:�:��$�R�L�#�V�!�&�(-�b�	�(8�(8�(:�(:�I� $�	�	�)� 4� 4�t�y�y��AQ�7R�7R� R�#'�:�!.�!.�-6��8H�,H��b�	� %��*�*�5�&�4�;K�;R�;R�;T�;T�2T�U�U�U��a�P	�d�rN)
rerfrgrhr|�staticmethodr�r�r�r�r>rrr�r�a	s{��������=�=�=�
�!�!��\�!����63�3�3�Lm�m�m�m�mrr�c
�D�ddl}ddl}ddl}|jtj��}	|�|jdd�dgd���\}}nJ#|j$r=}t|��t|��|�	d��Yd}~nd}~wwxYwg}t}t}	d}
d}d}d	}
|D]�\}}|d
vrd}�|dvr|}
�|d
vr|}�|dvr|}	�!|dvr|���}
�:|dvrB|tvr6td|z��t|��|�	d��|}��|dvr|}��|dvr$t|��|�	d����|s|jgn|}|
d	kr|jnt!|
d��5}|D]t}|d	kr|j}t#|��rt%||||||	||
����6t!|��5}t%||||||	||
���ddd��n#1swxYwY�u	ddd��dS#1swxYwYdS)a    Usage: tabulate [options] [FILE ...]

    Pretty-print tabular data.
    See also https://github.com/astanin/python-tabulate

    FILE                      a filename of the file with tabular data;
                              if "-" or missing, read data from stdin.

    Options:

    -h, --help                show this message
    -1, --header              use the first row of data as a table header
    -o FILE, --output FILE    print table to FILE (default: stdout)
    -s REGEXP, --sep REGEXP   use a custom column separator (default: whitespace)
    -F FPFMT, --float FPFMT   floating point number format (default: g)
    -I INTFMT, --int INTFMT   integer point number format (default: "")
    -f FMT, --format FMT      set output table format; supported formats:
                              plain, simple, grid, fancy_grid, pipe, orgtbl,
                              rst, mediawiki, html, latex, latex_raw,
                              latex_booktabs, latex_longtable, tsv
                              (default: simple)
    rNrzh1o:s:F:A:f:)�helprwruzsep=zfloat=zint=zalign=zformat=rr�z\s+r:)z-1z--headerr�)z-oz--output)z-Fz--float)z-Iz--int)z-Cz
--colalign)z-fz--formatz"%s is not a supported table formatr�)z-sz--sep)z-hz--helprA)r�rr!r�r��filer�)�getopt�sysrz�dedent�_mainrh�argv�GetoptError�print�exitrrr9r�stdin�stdout�openr�_pprint_file)r�r�rz�usage�optsr�rr�r�r�r�rr!�outfile�opt�value�files�outr�fobjs                    rr�r�)
sg��0�M�M�M��J�J�J��O�O�O��H�O�E�M�*�*�E�	��]�]��H�Q�R�R�L��W�W�W�
�
�
��d�d��
�����
�a����
�e�������������������������G� �H�
�F��H��H�
�C��G����
��U��$�$�$� �G�G�
�&�
&�
&��G�G�
�%�
%�
%��H�H�
�O�
#�
#��F�F�
�(�
(�
(��{�{�}�}�H�H�
�&�
&�
&��,�,�,��:�U�B�C�C�C��e������������H�H�
�O�
#�
#��C�C�
�$�
$�
$��%�L�L�L��H�H�Q�K�K�K��#�-�S�Y�K�K��E��3���#�*�*�D��#�,>�,>��3��	�	�A��C�x�x��I����{�{�
���#�%��%�!��%�	�	�	�	�	��!�W�W�
�� �� '�!)��!)�%� �!)�	�	�	�	�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��	���������������������sN�)A�
B�3B�B�AH�G;�/H�;G?�?H�G?�H�H�Hc
���|���}�fd�|D��}	tt|	|||||���|���dS)Nc���g|]=}|����tj�|�������>Sr>)r�r�r9rW)rEr|r!s  �rrGz _pprint_file.<locals>.<listcomp>�
s:���B�B�B�1����	�	�B�R�X�c�1�8�8�:�:�
&�
&�B�B�Br)r�r�r�)r�)�	readlinesr�r)
�fobjectr�rr!r�r�r�r�r��tables
   `      rr�r��
sw��������D�B�B�B�B��B�B�B�E�	��������
	
�	
�	
��
�
�
�
�
�
r�__main__r�)FF)TT)rTFF)rT)FN)r)T)r�r�r)}rh�collectionsr�collections.abcrrr�rrp�	itertoolsrrr��	functoolsr	r
rr�r�rzr�r+�ImportErrorr�__all__r�__version__rrTrrrrr,r2rr#r$r6rBrNr\rcrgrtryr�r��LATEX_ESCAPE_RULESr�r�rr/�sortedr�rr�compiler2r3�_esc�_csi�_osc�_st�_ansi_escape_pat�VERBOSEr&�encoder(r�r�rr�r�rr
rrrrrrr!r$rr/r4r1r=rGrXr\r[rcr~r�r�r�r�r�r�r�r�r�r�r�rr
r�r3r�r7r:rErVr[r]r0r_rr{r�r�r�rer>rr�<module>r�s��� � �"�"�"�"�"�"�+�+�+�+�+�+�+�+�%�%�%�%�%�%�8�8�8�8�8�8�8�8�%�%�%�%�%�%�%�%�	�	�	�	�	�	�	�	���������������N�N�N�N�������G�G�G�����$�$�$�F�
E�
E��	�/�/�/�/�/�/�/���	�	�	��D�	����
��������������%�����z�&�:�:�:�;�;���*�Y� 7� 7� 7�
8�
8��D�j��	�	�	����������*�*�*�
A�
A�
A� (�(�(����
���.-�-�-�-�
�
�
�
�2
�2
�2
�l�
�
�
�
�
�
�
�
�
�
�
�
�
�� <N�5�5�5�5�!�!�!�&n��k�k��$�r�3��b�)�)���R��d�B�/�/���$�r�3��b�)�)��'�"�d�B�'�'����D�"�%�%��%�{�3�	�	�	�n��[�[������'�"�d�B�'�'����D�"�%�%���	�	�	�n�*�K�K��$�s�C��c�*�*���S�#�s�C�0�0���S�#�s�C�0�0��$�s�C��c�*�*��'�#�s�C�(�(����S�#�&�&���	
�	
�	
�+n�>�;�;��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�?n�R�K�K��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�Sn�f�+�+��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�gn�z�+�+��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�{n�N�;�;��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�On�b�+�+��$�u�e�U�E�2�2���U�E�5�%�8�8���U�E�5�%�8�8��$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�cn�v�{�{��$�s�C��c�*�*���S�#�s�C�0�0���$�s�C��c�*�*��'�#�s�C�(�(����S�#�&�&���	�	�	�wn�J�k�k��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�Kn�^�{�{��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�_n�r�[�[��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�sn�F�[�[��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�Gn�Z�k�k��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�[n�n�[�[��$�u�e�U�E�2�2���U�E�5�%�8�8���$�u�e�U�E�2�2��'�%���.�.����u�e�,�,���	�	�	�on�B
�k�k��$�s�C��c�*�*���S�#�s�C�0�0����'�#�s�C�(�(����S�#�&�&��%��	�	�	�Cn�n�V�K�K�(�.����'�#�s�C�(�(����S�#�&�&��%��	
�	
�	
�Wn�j
�k�k����S�#�s�C�0�0����'�#�s�C�(�(����S�#�&�&���	�	�	�kn�~�K�K������'�$��d�+�+����S�#�&�&���	
�	
�	
�n�R
�k�k����R��c�2�.�.����'�"�c�2�&�&����C��$�$���	�	�	�Sn�f
�k�k��$�s�C��c�*�*���S�#�s�C�0�0���$�s�C��c�*�*��'�#�s�C�(�(����S�#�&�&���	�	�	�gn�z�K�K��$�s�C��c�*�*���S�#�s�C�0�0���$�s�C��c�*�*��'�#�s�C�(�(����S�#�&�&���	
�	
�	
�{n�N
�;�;��$�r�3��b�)�)���R��d�B�/�/���$�r�3��b�)�)��'�"�d�B�'�'����D�"�%�%���	�	�	�On�b����$�<���'�	
�
���T�2�r�2�.�.���T�2�r�2�.�.��$�t�R��R�(�(��'�3�S�9�9���1�3�7�7������cn�@��������'�.��U�C�C�C���,�d�3�3���	�	�	�An�T��������'�%���0�0����e�T�*�*���	�	�	�Un�h�K�K�2����$�+�R��R�8�8��'�.��e�<�<���,�d�E�:�:��%��	
�	
�	
�in�|�+�+�2����$�+�R��R�8�8��'�.��d�;�;���,�d�D�9�9��%��	�	�	�}n�P	�[�[�+���Y��B��3�3���$�0�"�b�"�=�=�����	�	�	�Q	n�d	���+���Y��B��3�3���$�0�"�b�"�=�=��'�*�r�2�2�2���
�R�0�0�0���	�	�	�e	n�x	�k�k��'�3�d�C�C�C���[�"�b�"�5�5���$�5�r�2�r�B�B�����	�	�	�y	n�L
�{�{��'�3�t�D�D�D���1�2�r�2�>�>���$�2�B��B�?�?�����	�	�	�M
n�`

�;�;������'�"�d�B�'�'����D�"�%�%���	�	�	�a
n�n�t
�{������'�&�%��-�-�'���	�	�	����'�-��/�/����$�w��B��+�+��'�-��.�.���
�u�-�-��%��	�	�	�In�n�n��b�4���~�2�2�4�4�5�5�6�6��
��W���h���F���=�	�
�N���,�
��,���=���,���F��
�h���F��
�h��
�h���F�� 
�5�!��:�2�:�m�,�,��#���M�2�2��2���|�|�|���|�|�|��
�l�l�l���
���
���
���

���
���
��������$�b�j�)�2�:�6�6���B�J�/�6�6�v�>�>��
�K�K��"��#-�2�:�E�$�$� �
���(D�D�D�B������,�������� � � � �F���:���������
�
�
�/�/�/�(���$:�:�:�14�D�D�D�D�
������4���>A�E�E�E�E�
�������
.�.�.�.�b!�!�!�*.�.�.�.�4!�!�!�!�JKO�'�'�'�'�.���0�0�0����(���{�{�{�{�|����:����6
�
�
��
�
�"���
��
��H
�H
�H
�H
�V5�5�5�"'�'�'����;�;�;�7�7�7�����
0�
0�
0�TX�����,	;�	;�	;����

�
�
�
�
�S�
�
�
�D�D�D�NE�E�E�E�E�h�*�E�E�E�P_�_�_�D
�
�
� �z���	�E�G�G�G�G�G��s#�A�A�
A�A�A%�$A%