
    %h:t                    6   S r SSKJr  SSKJrJr  SSKJr  SSK	J
r
Jr  SSKJrJr  SSKrSSKrSSKrSSKrSSKr SSKrS r/ S	Qr S
SKJr  SrSrSrSrSrSr \SLr!Sr"\" S/ SQ5      r#\" S/ SQ5      r$\" S/ SQ5      r%S r&S r'S r(S r)S r*S r+S r,SS jr-SS  jr.S! r/S"S#S$S%S&S'S(S)S*S+S,S-S..r0\04S/ jr1S0 r20 S1\%" \#" SS2S3S5      \#" SS2S3S5      S\#" SS2S3S5      \$" SS3S5      \$" SS3S5      SS4S5/S9_S6\%" SSSS\$" SS3S5      \$" SS3S5      SSS9_S7\%" \#" S8S2S8S85      \#" S8S9S8S85      \#" S8S2S8S85      \#" S8S2S8S85      \$" S:S:S:5      \$" S:S:S:5      S
SS9_S;\%" \#" S<S=S>S?5      \#" S@S=SASB5      \#" S@S=SASB5      \#" SCS=SDSE5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_SG\%" \#" SHS=S>SI5      \#" S@S=SASB5      \#" S@S=SASB5      \#" SJS=SDSK5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_SL\%" \#" SMSNSOSP5      \#" SQSNSRSS5      \#" SQSNSRSS5      \#" STSNSUSV5      \$" SWSWSW5      \$" SWSWSW5      S
SS9_SX\%" \#" SYSNSZS[5      \#" S\SNS]S^5      \#" S@S=SASB5      \#" S_SNS`Sa5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_Sb\%" \#" ScSdSeSf5      \#" SgSdShSi5      \#" SgSdShSi5      \#" SjSdSkSl5      \$" SmSmSm5      \$" SmSmSm5      S
SS9_Sn\%" \#" SoSdSpSq5      \#" SrSdSsSt5      \#" S@S=SASB5      \#" SuSdSvSw5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_Sx\%" \#" S8S2S8S85      \#" S8S9S8S85      S\#" S8S2S8S85      \$" S:S:S:5      \$" S:S:S:5      S
SS9_Sy\%" \#" S<S=S>S?5      \#" S@S=SASB5      S\#" SCS=SDSE5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_Sz\%" \#" SHS=S>SI5      \#" S@S=SASB5      S\#" SJS=SDSK5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_S{\%" \#" SMSNSOSP5      \#" SQSNSRSS5      S\#" STSNSUSV5      \$" SWSWSW5      \$" SWSWSW5      S
SS9_S|\%" \#" SYSNSZS[5      \#" S\SNS]S^5      S\#" S_SNS`Sa5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_S}\%" \#" ScSdSeSf5      \#" SgSdShSi5      S\#" SjSdSkSl5      \$" SmSmSm5      \$" SmSmSm5      S
SS9_S~\%" \#" SoSdSpSq5      \#" SrSdSsSt5      S\#" SuSdSvSw5      \$" SFSFSF5      \$" SFSFSF5      S
SS9_S\%" \#" S:S2S:S:5      \#" S:S2S:S:5      SS\$" S:S:S:5      \$" S:S:S:5      S
S4/S9_0 S\%" \(\(SS\$" S:S:S:5      \$" S:S:S:5      S
S4/S9_S\%" S\#" S:S2S8S:5      SS\$" S:S:S:5      \$" S:S:S:5      S
SS9_S\%" SSSS\$" SSS5      \$" S:S:S:5      S
SS9_S\%" S\#" SS2S8S5      SS\$" SS:S5      \$" SS:S5      S
SS9_S\%" \#" S8S2S8S85      \#" S8S2S8S85      S\#" S8S2S8S85      \$" S:S:S:5      \$" S:S:S:5      S
SS9_S\%" \#" S8S2S8S85      \#" S:S2S8S:5      S\#" S8S2S8S85      \$" S:S:S:5      \$" S:S:S:5      S
SS9_S\%" \#" SS9S3S5      \#" SS9S3S5      S\#" SS9S3S5      \$" SS3S5      \$" SS3S5      SSS9_S\%" \#" SSSS5      \#" SSSS5      \#" SSSS5      \#" SSSS5      \" \)S5      \" \)S:5      SSS9_S\%" SSSS\" \-SSS9\" \-S5      S
SS9_S\%" SSSS\$" SSS5      \$" SSS5      S
SS9_S\%" \+SS\#" SSSS5      \" \,SS5      \" \,SS5      SS4/S9_S\%" \+SS\#" SSSS5      \" \,SS5      \" \,SS5      SS4/S9_S\%" \.\#" SSSS5      S\#" SSSS5      \1\1S
SS9_S\%" \.\#" SSSS5      S\#" SSSS5      \" \10 S9\" \10 S9S
SS9_S\%" \" \.SS9\#" SSSS5      S\#" SSSS5      \1\1S
SS9_S\%" \" \.SS9\#" SSSS5      S\#" SSSS5      \1\1S
SS9_S\%" SSSS\$" SSS5      \$" SSS5      SSS9_E\%" SSSS\$" SSS:5      \*S
SS9\%" \" \/S5      SS\#" SSSS5      \" \/S5      \" \/S5      S
S4/S9S.Er3\4" \5" \3Rm                  5       5      5      r70 S6S6_S1S1_S7S7_S;S;_SGSG_SLSL_SXSX_SbSb_SnSn_SS_SS_SS_SS_SS_SS_SS_r8\Rr                  " S5      r:\Rr                  " S5      r;Sr<\< S3r=\< S3r>\< S3r?S\= S\> S\< S\? S\< S\> S\? S3r@\Rr                  " \@\R                  5      rB\Rr                  " \@R                  S5      \R                  5      rDSrE\Rr                  " S5      rFS rGS rHS rIS rJ\K4S jrLS rMSS jrNS rOS rPS rQS rRS rSS rTS rUS rV\W4S jrXS rYS rZS r[\W4S jr\S r]    SS jr^S r_SS jr`SS jra SS jrbS rcS rdS reS rfSS jrgSS jrhSS jriSS1\\\ \ \SSSSSS4S jrjS rkS rlS rmS rnS roSS jrpS rq SS jrrS rsS rt " S S\u5      rvS rw " S S\R                  5      ryS rzS r{\|S:X  a  \z" 5         gg! \ a    Sr G	NJf = f! \ a     G	NIf = f(   zPretty-print tabular data.    )
namedtuple)IterableSized)escape)chainzip_longest)reducepartialNc                 6    [        U [        R                  5      $ N)
isinstanceioIOBase)fs    I/var/www/auris/envauris/lib/python3.13/site-packages/tabulate/__init__.py_is_filer      s    a##    )tabulatetabulate_formatssimple_separated_format   )version   Fg defaultLine)beginhlinesependDataRow)r   r!   r"   TableFormat)	lineabovelinebelowheaderlinebetweenrows	linebelow	headerrowdatarowpaddingwith_header_hidec                     [        U 5      nU[        :H  =(       d	    U[        :H  =(       aI    [        U 5      S:  =(       a    U S   [        :H  =(       d!    [        U 5      S:  =(       a    U S   [        :H  nU$ )Nr   r   r   )typeliststrlenSEPARATING_LINE)rowrow_typeis_sls      r   _is_separating_liner6   h   sd    CyH0S 	SQ	43q6_4 	9HM7c!f7 
 Lr   c                 |    UnU S;   a  SUS-
  -  S-   $ U S:X  a  SSUS-
  -  -   S-   $ U S:X  a  SSUS-
  -  -   $ SU-  $ )zzReturn 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_colonsrB   q   sh     	A$$q1u$$	(	cQUm$s**	&cQUm$$Qwr   c                     U(       d  S/[        U 5      -  n[        X5       VVs/ s H  u  p#[        X#5      PM     nnnSSR                  U5      -   S-   $ s  snnf )zjReturn a horizontal line with optional colons to indicate column's
alignment (as in `pipe` output format).r   |)r1   ziprB   join)	colwidths	colalignsarA   segmentss        r   _pipe_line_with_colonsrK      sY     D3y>)	<?	<UV<UDA)!/<UHV(##c)) Ws   Ac           	          SSSSS.n[        X5       VVs/ s H   u  pVSUR                  US5      -   U-   S-   PM"     nnnU S-  nXR                  U5      -   R                  5       $ s  snnf )Nr   zalign="right"| zalign="center"| r=   r8   r<   r9    r   )rE   getrF   rstrip)		separatorcell_valuesrG   rH   	alignmentcrI   values_with_attrscolseps	            r   _mediawiki_row_with_attrsrW      s    "$$	I :=[9T9TimmAr""Q&,9T   ]F$566>>@@	s   'A&c                    ^ U S==   S-  ss'   SSSSS.mU4S j[        X 5       5       nSSR                  U5      -   S-   $ )	Nr   rN   z<.z>.z=.rM   c              3   R   >#    U  H  u  pTR                  US 5      U-   v   M     g7f)r   NrO   ).0rI   vrS   s      r   	<genexpr>*_textile_row_with_attrs.<locals>.<genexpr>   s%     O3N41immAr"Q&3Ns   $'rD   )rE   rF   )rR   rG   rH   valuesrS   s       @r   _textile_row_with_attrsr`      sG    NcNNIO3y3NOF&!!C''r   c                     g)Nz<table>
<tbody>r>   )colwidths_ignorecolaligns_ignores     r    _html_begin_table_without_headerrd      s    r   c                    SSSSS.nU(       a@  [        X$5       VVs/ s H'  u  pgSR                  XR                  US5      U5      PM)     nnnOH[        X$5       VVs/ s H0  u  pgSR                  XR                  US5      [        U5      5      PM2     nnnSR                  SR	                  U5      R                  5       5      n	U S:X  a  SU	 S	3n	U	$ s  snnf s  snnf )
Nr   z style="text-align: right;"z style="text-align: center;"rM   z<{0}{1}>{2}</{0}>z<tr>{}</tr>thz<table>
<thead>
z
</thead>
<tbody>)rE   formatrO   
htmlescaperF   rP   )
celltagunsaferR   rG   rH   rS   rT   rI   rU   rowhtmls
             r   _html_row_with_attrsrl      s    .00	I  K3
3  &&wa0DaH3 	 
 K3
3  &&wa0DjQRmT3 	 
 ""277+<#=#D#D#FGG$&wi/BCN


s   .C7Cc                     SSSSS.n[        X5       VVs/ s H,  u  pgSR                  XR                  US5      XF-   U-   5      PM.     nnnSR                  U5      S-   $ s  snnf )Nr   z<style="text-align: right;">z<style="text-align: center;">rM   z{}{} {} ||)rE   rg   rO   rF   )	ri   rR   rG   rH   headerrS   rT   rI   rU   s	            r   _moin_row_with_attrsrp      sy    /11	I //DA 	'==B#7f9LM/   77$%,,	s   3A c           	          SSSSS.nSR                  U Vs/ s H  oTR                  US5      PM     sn5      nSR                  U(       d  SOSU-   S	-   U(       a  S
/5      $ S/5      $ s  snf )NlrrT   rM   r   
z\begin{tabular}{z\begin{longtable}{}z\toprule\hline)rF   rO   )rG   rH   booktabs	longtablerS   rI   tabular_columns_fmts          r   _latex_line_begin_tabularrz      s    sccJI'')"L)Q==C#8)"LM99(1 7L!" $K		
 
 *3		
  #Ms   A)c                     S n[        U5      S:X  a	  U" S/UQ76 $ [        U5      S:X  a1  Uu  p4nSSR                  U5      -   nU (       a  U" SXE5      S-   U-   $ U$ [        S5      e)	z/handle header and data rows for asciidoc formatc                    SSSSS.n[        X Vs/ s H  oCU   PM	     sn5      nU VVs/ s H  u  pgSR                  Xg5      PM     nnnSSR                  U5      -   S-   /n	/ n
U (       a  U
R                  S	5        U
(       a  U	S
SR                  U
5      -   S-   /-  n	SR                  SR                  U	5      5      $ s  snf s  snnf )N<>^rM   z{:d}{}zcols=","ro   z	options="z
[{}]
|====)rE   rg   rF   append)	is_headerrG   rH   rS   colalignasciidoc_alignmentswidthr?   asciidoc_column_specifiersheader_listoptions_lists              r   make_header_line'_asciidoc_row.<locals>.make_header_line   s     !3##N	!IFI(+IF
 ?R&
>QleHOOE)>Q 	# &
  388,F#GH3NO )K#((<*@@3FGGK ##CHH[$9::% G&
s
   B?
Cr   F   rD   Trt   zm _asciidoc_row() requires two (colwidths, colaligns) or three (cell_values, colwidths, colaligns) arguments) )r1   rF   
ValueError)r   argsr   rR   rG   rH   	data_lines          r   _asciidoc_rowr      s    ;4 4yA~  ---	Ta -1)	#((;//	#D)?$FRR I
 	
r   z\&z\%z\$z\#z\_z\^{}z\{z\}z\textasciitilde{}z\textbackslash{}z\ensuremath{<}z\ensuremath{>})&%$#_r   {ru   ~\r}   r~   c           	         ^ U4S jnU  Vs/ s H  nSR                  [        XE5      5      PM     nn[        SSS5      n[        Xg5      $ s  snf )Nc                 &   > TR                  X 5      $ r   rZ   )rT   escruless    r   escape_char_latex_row.<locals>.escape_char  s    ||A!!r   r   r   \\)rF   mapr#   _build_simple_row)rR   rG   rH   r   r   cellescaped_valuesrowfmts      `    r   
_latex_rowr     sM    " CNN+$bggc+45+NNRf%F^44 Os   $A
c                     S n[        U5      n/ nU(       a  U" US   5      US'   U  H4  n[        U5      nU(       a  U" US   5      US'   UR                  U5        M6     XC4$ )Nc                 h    [        U [        [        45      (       a  U R                  5       (       d  gU $ )Nz..)r   r0   bytesstripvals    r   escape_empty._rst_escape_first_column.<locals>.escape_empty%  s%    cC<((Jr   r   )r/   r   )rowsheadersr   new_headersnew_rowsr3   new_rows          r   _rst_escape_first_columnr   $  sk     w-KH%gaj1As)%c!f-GAJ 	 
   r   simpler:   z  r%   r(   plaingrid+=rD   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jirarn   prestoprettypsqlrst	mediawikiz.{| class="wikitable" style="text-align: left;"z
|+ <!-- caption -->
|-z|-z|}!moinmoinz''')ro   youtrackz|| z || z| z | z |htmlz</tbody>
</table>rf   td
unsafehtmlTlatexrv   z\hline
\end{tabular}	latex_raw)r   latex_booktabs)rw   z\midrulez\bottomrule
\end{tabular}latex_longtable)rx   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
        z8;        # 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)
        z8;;z!  # "closing" OSC sequence
    )
utf8z[0mz>^(([+-]?[0-9]{1,3})(?:,([0-9]{3}))*)?(?(1)\.[0-9]*|\.[0-9]+)?$c                 N    [        SSSS[        SU S5      [        SU S5      SSS9$ )zConstruct 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

Nr   r   )r)   r*   r+   r,   )r$   r#   )rQ   s    r   r   r     s;     "i,Ir*	 	r   c                      U R                  5       n [        [        R
                  " [        U 5      5      $ ! [        [        4 a     N6f = f)aT  
>>> _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     sD    2 96BCC / s   6 A	A	c                 B     U " U5        g! [         [        4 a     gf = f)NTF)r   	TypeError)convr   s     r   _isconvertibler   9  s(    V	" s    c                    [        [        U 5      (       d  g[        U [        [        45      (       a[  [
        R                  " [        U 5      5      (       d$  [
        R                  " [        U 5      5      (       a  U R                  5       S;   $ g)z
>>> _isnumber("123.45")
True
>>> _isnumber("123")
True
>>> _isnumber("spam")
False
>>> _isnumber("123e45678")
False
>>> _isnumber("inf")
True
F)infz-infnanT)	r   floatr   r0   r   mathisinfisnanlowerr   s    r   	_isnumberr   A  s_     %((	FS%L	)	)

5=!!TZZf%>%>||~!777r   c                 z    [        U 5      UL =(       d(    [        U [        [        45      =(       a    [	        X5      $ )z3
>>> _isint("123")
True
>>> _isint("123.45")
False
)r.   r   r   r0   r   )r   inttypes     r   _isintr   W  s5     	V 	,fucl+ ,7+r   c                 v    [        U 5      [        L =(       d"    [        U [        [        45      =(       a    U S;   $ )zG
>>> _isbool(True)
True
>>> _isbool("False")
True
>>> _isbool(1)
False
)TrueFalse)r.   r   r   r   r0   r   s    r   _isboolr   e  s3     <4 6E3<(HV7H-Hr   c                    U(       a&  [        U [        [        45      (       a  [        U 5      n U c  [	        S5      $ [        U S5      (       a  [        $ [        U 5      (       a  [        $ [        U 5      (       a  U(       a  [        $ [        U 5      (       a  U(       a  [        $ [        U [        5      (       a  [        $ [        $ )zThe 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('[31m42[0m') is type(42)
True
>>> _type('[31m42[0m') is type(42)
True

N	isoformat)r   r0   r   _strip_ansir.   hasattrr   r   r   intr   r   )r   has_invisiblenumparses      r   _typer  s  s      FS%L99V$~Dz		%	%
		H
	6		x	FE	"	"
r   c                    [        U 5      (       d  [        U 5      (       aa  [        U 5      (       a  gU R                  S5      nUS:  a  U R	                  5       R                  S5      OUnUS:  a  [        U 5      U-
  S-
  $ gg)zSymbols 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   )r   r   r   rfindr   r1   )r   poss     r   _afterpointr    ss     >vFF&>>,,s#C/2Qw&,,.&&s+CCax6{S(1,,r   c                 .    SU -  nUR                  U5      $ )u@   Flush right.

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

z{0:>%ds}rg   r   sfmts      r   _padleftr         u
C::a=r   c                 .    SU -  nUR                  U5      $ )u@   Flush left.

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

z{0:<%ds}r  r  s      r   	_padrightr    r  r   c                 .    SU -  nUR                  U5      $ )uB   Center string.

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

z{0:^%ds}r  r  s      r   _padbothr    r  r   c                     U$ r   r>   )ignore_widthr  s     r   _padnoner    s    Hr   c                     [        U [        5      (       a  [        R                  SU 5      $ [        R                  SU 5      $ )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r  s    r   r   r     s5     !Sua(( $$UA..r   c                     [         b  [        (       a  [         R                  nO[        n[	        U [
        [        45      (       a  U" [        U 5      5      $ U" [        U 5      5      $ )zVisible width of a printed string. ANSI color codes are removed.

>>> _visible_width('[31mhello[0m'), _visible_width("world")
(5, 5)

)wcwidthWIDE_CHARS_MODEwcswidthr1   r   r0   r   r   )r  len_fns     r   _visible_widthr$    sL     !!!c5\""k!n%%c!f~r   c                     [        U [        5      (       a$  [        [        R                  " [
        U 5      5      $ [        [        R                  " [        U 5      5      $ r   )r   r0   r   r   search_multiline_codes_multiline_codes_bytesr  s    r   _is_multiliner)    s=    !SBII.233BII4a899r   c           	      V    [        [        U[        R                  " SU 5      5      5      $ z1Visible width of a potentially multiline content.[
])maxr   r   splitmultiline_sline_width_fns     r   _multiline_widthr2    s    s="((8["ABCCr   c                    ^ U (       a  [         mOU(       a  [        R                  mO[        mU(       a  U4S jnU$ TnU$ )z2Return a function to calculate visible cell width.c                    > [        U T5      $ r   )r2  r  r1  s    r   <lambda>"_choose_width_fn.<locals>.<lambda>  s    -a?r   r$  r   r"  r1   r  enable_widecharsis_multilinewidth_fnr1  s       @r   _choose_width_fnr=  
  s9    &	((? O !Or   c                    US:X  a3  [         (       d  U  Vs/ s H  o3R                  5       PM     n n[        nX4$ US:X  a3  [         (       d  U  Vs/ s H  o3R                  5       PM     n n[        nX4$ US:X  a  U(       a%  U  Vs/ s H  n[	        [        U5      5      PM     nnOU  Vs/ s H  n[	        U5      PM     nn[        U5      n[        X5       VVs/ s H  u  p7X6U-
  S-  -   PM     n nn[        nX4$ U(       d	  [        nX4$ [         (       d  U  Vs/ s H  o3R                  5       PM     n n[        nX4$ s  snf s  snf s  snf s  snf s  snnf s  snf )Nr8   r<   r9   rN   )
PRESERVE_WHITESPACEr   r  r  r  r   r-  rE   r  r  )stringsrS   r  r  padfndecimalsmaxdecimalsdecss           r   _align_column_choose_padfnrE    sP   G""*12'Qwwy'G2& >% 
h	""*12'Qwwy'G2 > 
i	=DEWKN3WHEH0781AH8(mADWAWXAWga1d*c11AWX > 
 > #"*12'Qwwy'G2>) 3 3 F8X 3s#   D>EE)EEEc                    ^ U (       a  [         mOU(       a  [        R                  mO[        mU(       a  U4S jnU$ TnU$ )Nc                    > [        U T5      $ r   )_align_column_multiline_widthr5  s    r   r6  /_align_column_choose_width_fn.<locals>.<lambda>;  s    :1mLr   r8  r9  s       @r   _align_column_choose_width_fnrJ  3  s9    &	((L O !Or   c           	      V    [        [        U[        R                  " SU 5      5      5      $ r+  )r/   r   r   r.  r/  s     r   rH  rH  A  s    M288Hk#BCDDr   c                     / nU  HE  n[        U[        5      (       a  U H  nUR                  U5        M     M4  UR                  U5        MG     U$ r   )r   r/   r   )nested_listretitemsubitems       r   
_flat_listrQ  F  sI    
CdD!!

7#   JJt  Jr   c                    [        XU5      u  p[        X4U5      n[        [        Xp5      5      n[	        [	        [        U5      5      U5      n	U(       GaV  U(       dP  U(       dI  U  V
Vs/ s H8  n
SR                  U
R                  5        Vs/ s H
  o" X5      PM     sn5      PM:     nn
nU$ U  V
Vs/ s H4  n
[        R                  " SU
5       Vs/ s H  n[        U5      PM     snPM6     nn
n[        X5       VVVVs/ s H,  u  p[        X5       VVs/ s H  u  nnU	UU-
  -
  PM     snnPM.     nnnnn[        U U5       V
VVVs/ s HT  u  pSR                  [        U
R                  5       =(       d    U
U5       VVs/ s H  u  nnU" UU5      PM     snn5      PMV     nnnn
n U$ U(       d   U(       d  U  Vs/ s H
  o" X5      PM     nnU$ [        [        [        U 5      5      n[        X5       VVs/ s H  u  nnU	UU-
  -
  PM     nnn[        U U5       VVs/ s H  u  nnU" UU5      PM     nnnU$ s  snf s  snn
f s  snf s  snn
f s  snnf s  snnnnf s  snnf s  snnnn
f s  snf s  snnf s  snnf )z[string] -> [padded_string]rt   r,  )rE  rJ  r/   r   r-  rQ  rF   
splitlinesr   r.  r1   rE   )r@  rS   minwidthr  r:  r;  rA  r<  s_widthsmaxwidthmsr  padded_stringss_lensmwmlrA   rr   visible_widthss                      r   _align_columnr]  Q  sT    0MRNG,H C*+H3z(+,h7H "!B 		r}}G!5-GH!  6 + JQQ2rxx"'=>'=!s1v'=>FQ "(33FB 14B<1QU#<3   "'>::FB 		38M2PR3ST3S41a5A;3STU:  N   :AB'QeH0'NB  #c7+,F=@=RS=RTQh!a%0=RNS 7:'>6RS6RdaeAqk6RNS5 H ?Q< U C T Tsr   (#I H;I 1II%I?I
I*I
9I%
II%
=I-9I2 I8;I II
I%
c                    [        S 5      S[        S[        S[        S[        S[
        S0n[
        [        [        [        [        [        S 5      S.n[        UR                  U S5      UR                  US5      5      nX4   $ )Nr   r   r   r         )r`  r_  r   r   r   r   )r.   r   r  r   r   r0   r-  rO   )type1type2typesinvtypesmoregenerics        r   _more_genericrf    sw    T
AaQqqQE :H eiiq)599UA+>?K  r   c                 n    U  Vs/ s H  n[        X1U5      PM     nn[        [        U[        5      $ s  snf )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

)r  r	   rf  r   )r@  r  r  r  rc  s        r   _column_typerh    s5    , 9@@1U1X.E@--- As   2c                    U c  U$ U[         L a  U  $ U[        L a  [        X5      $ U[        L a   [        U S5      $ U[        L al  U=(       a    [        U [         [        45      nU(       a1  [        U 5      n[        [        U5      U5      nU R                  Xx5      $ [        [        U 5      U5      $ U  $ ! [        [
        4 a    [        U 5      s $ f = f)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

ascii)
r0   r  rg   r   r   r   r   r   r   replace)	r   valtypefloatfmtintfmt
missingvalr  is_a_colored_numberraw_valformatted_vals	            r   _formatrs    s     {#~	Cc""	E		sG$$ 
E	+M
3e0M!#&G"5>8<M;;w66%*h// -. 	s8O	s   B4 4CCc                 H   U(       aN  [         R                  " [        U 5      nU Vs/ s H  n[        XqX%" U5      5      PM     nnSR	                  U5      $ [        U 5      U-
  n	X)-  nUS:X  a  [        X 5      $ US:X  a  [        X 5      $ U(       d  U  $ [        X 5      $ s  snf )zIPad string header to width chars given known visible_width of the header.rt   r=   r<   )	r   r.  r'  _align_headerrF   r1   r  r  r  )
ro   rS   r   visible_widthr;  r<  header_lineshpadded_lines
ninvisibles
             r   ru  ru    s     xx 0&9EQ
EQM!x{;\ 	 
 yy&&V},J	EF''	h	&&&&
s   Bc                     [        U 5      [        :X  aO  / n/ n[        U 5       H9  u  p4[        U5      (       a  UR	                  U5        M(  UR	                  U5        M;     X!4$ U S 4$ r   )r.   r/   	enumerater6   r   )r   separating_lines	sans_rowsindexr3   s        r   _remove_separating_linesr    se    DzT	#D/JE"3'' ''.  %	 *
 **Tzr   c                 R    U(       a   U H  nU R                  U[        5        M     g g r   )insertr2   )r   r}  r  s      r   _reinsert_separating_linesr    s"    %EKK/ & r   c           	         Ub  USL a  U $ [        U[        5      (       aH  [        U5      [        U 5      :w  a0  [        SSR	                  [        U5      [        U 5      5      -   5      e[        U 5      u  p#/ n[        U5      nU H,  n[        U5      nUR                  U/[        U5      -   5        M.     Un [        X5        U $ )zAdd a left-most index column.Fz2index must be as long as the number of data rows: zlen(index)={} len(rows)={})r   r   r1   r   rg   r  iternextr   r/   r  )r   r  r~  r}  r   
index_iterr3   index_vs           r   _prepend_row_indexr     s    }%CJ#d)$;@*11#e*c$iHI
 	
 #;4"@IHeJz"	DI-.  Dt6Kr   c                 :     [        U 5      $ ! [         a     gf = f)zDA wrapper around standard bool() which doesn't throw on NumPy arraysF)r   r   r   s    r   _boolr    s#    Cy s   
 
c                     [        U5        SnSn[        U S5      (       Ga\  [        U S5      (       GaJ  [        U R                  S5      (       a0  U R                  5       n[        [        U R	                  5       6 5      nO[        U S5      (       a  [        U 5      nUS;   at  U R                  R                  b]  [        U R                  R                  [        5      (       a  U R                  R                  USS	& OU R                  R                  /USS	& U R                  n[        U R                  5      nU Vs/ s H  n[        U5      PM     nnO[        S
5      eUS:X  a  [        [        [        U5      5      nGO[        U 5      nUS:X  a  U(       d  / nGOUS:X  aD  [        U S5      (       a3  [        U R                  S5      (       a  U R                  R                  nGOqUS:X  ac  [        U5      S	:  aT  [        US	   [         5      (       a<  [        US	   S5      (       a(  [        [        [        US	   R"                  5      5      nGO[        U5      S	:  Ga  [        US	   S5      (       Ga  [        US	   S5      (       Ga  [%        5       n	/ nUS:X  aK  [        U5      S	:  a  US	   O0 n
UR'                  U
R                  5       5        U	R)                  U5        USS nU HC  nUR                  5        H,  nX;  d  M
  UR+                  U5        U	R-                  U5        M.     ME     US:X  a  UnO[        U[.        5      (       a:  U Vs/ s H  oR1                  X5      PM     nn[        [        [        U5      5      nOeUS:X  aM  [        U5      S	:  a;  U Vs/ s H  nW
R1                  X5      PM     nn[        [        [        U5      5      nO/ nOU(       a  [        S5      eU VVs/ s H#  o Vs/ s H  oR1                  U5      PM     snPM%     nnnGO7US:X  aR  [        U S5      (       aA  [        U S5      (       a0  [        U S5      (       a  U R2                   Vs/ s H  oS	   PM	     nnO[4        b  [        U5      S	:  a  [4        R6                  " US	   5      (       ah  [4        R8                  " US	   5       Vs/ s H  oR                  PM     nnUS:X  a  UnU VVs/ s H  o Vs/ s H  n[        X5      PM     snPM      nnnOCUS:X  a=  [        U5      S	:  a.  [        [        [        [;        [        US	   5      5      5      5      nUS:X  aQ  [        U5      S	:  aB  Ub  US	   /[        US	   5      -   nUSS nOUS	   n[        [        [        U5      5      nUSS nOUS:X  a  / n[        [        [        U5      5      n[        [        S U5      5      n[=        U5      [        [>        4;   nUS:X  a  Ub  [A        Xd5      nO[        U[B        5      (       a  U(       d  [A        U[        U5      5      nO[        U[D        5      (       a  U(       d  [A        Xb5      nOgUS:X  d  [G        U5      (       a3  U(       d,  Uc  [        [;        [        U5      5      5      n[A        Xd5      nOUS:X  d  [G        U5      (       d  U(       d   U(       a:  [        U5      S	:  a+  [        U5      n[        US	   5      nUU:  a  S/UU-
  -  U-   nXa4$ ! [         a    Sn[        U5      n GN!f = fs  snf s  snf s  snf s  snf s  snnf s  snf s  snf s  snf s  snnf )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keysr_   __call__r  )r   alwaysTr   z7tabular data doesn't appear to be a dict or a DataFramedtypenames_fieldsfirstrowr   z6headers for a list of dicts is not a dict or a keyworddescriptionfetchonerowcountc                 <    [        U 5      (       a  U $ [        U 5      $ r   )r6   r/   )rs   s    r   r6  )_normalize_tabular_data.<locals>.<lambda>  s    #6q#9#9aFtAwFr   r   r  neverr   )$r   r   r/   r   r_   r  izip_longestr  namer   r   r0   getattrr  r  r1   tupler  setextendupdater   adddictrO   r  dataclassesis_dataclassfieldsranger.   r   r  r   r   r  )tabular_datar   	showindexis_headers2bool_brokenr  r  r   valsr3   	uniq_keys	firstdictkcolumnfieldfield_namesr   showindex_is_a_strnhsncolss                      r   _normalize_tabular_datar    s[   B W!&
 E|V$$x)H)H<&&
33$$&Dl1134D \7++%D88 &&++7l0055t<<+1166D!H , 2 2 7 78D!H&&D++,E)-.#DID.DVWWf3sD>*G L!fTGvg..**G44 #((..GvD	A47E**Q++ 3sDGOO45GY]wtAw77GDGX<V<VID*$'*4y1}DG"	INN,-  &ABxA)A!a(	 $  & GT**6:;d;;q,d;s301J&t9q=<@ADqy}}Q2DGA"3sG#45G G L  ;??$3.AWWQZ.$D?D vm44j11j11 0</G/GH/GVay/GGHG #D	A((a11 4?3E3Ed1g3NO3N%::3NKO& %FJKdsk:kWS_k:dDKD3t9q=3sE#d1g,$789G *TQQxj4Q=0G!"IE1gGs3()ABx	J	3sG$%GFMND iS%L8I%"3!$.	Iu	%	%.@!$Y8	Ix	(	(1C!$2	h	5#3#3<N=s4y)*E!$.	g	eI&6&6?Q 3t9q='lDG;deck*W4G=o   !%w- 6 /^ < B /? I P ;Ks_   \ ;\4\9\>0	]9]]&]]*	]3]]\10\1]]c                    [        U[        U S   5      S5      n/ nU  H  n/ n[        XAU5       H  u  pgn[        U5      (       a  U(       a  UR	                  U5        M0  Ubh  [        US9n	[        U5      (       a  [        U5      O[        Xh5      " U5      n
U	R                  U
5      nUR	                  SR                  U5      5        M  UR	                  U5        M     UR	                  U5        M     U$ )Nr   T)r   rt   )
_expand_iterabler1   rE   r   r   _CustomTextWrapr0   r  wraprF   )list_of_listsrG   	numparsesresultr3   r   r   r   r  wrappercasted_cellwrappeds               r   _wrap_text_to_colwidthsr    s     Ca0@,A4HIF%(%C!D8t$ )6
 "+4CIeD6KD6Q  ",,{3tyy12t$! &D" 	g' * Mr   c                 `    [        U [        5      (       a  U R                  XS9$ [        U 5      $ )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   )r  r  r  s      r   _to_strr    s+    ( !Uxxx99q6Mr   r>   c                   ^0 U c  / n [        XUS9u  p[        U5      u  pUbT  [        US   5      n[        U[        5      (       a  [        UUU5      nO[        UUS5      n[        U	U5      n[        XUS9nUbY  [        US   5      n[        U[        5      (       a  [        UUU5      nO[        UUS5      n[        U	U5      n[        U/UUS9S   nUS:X  a  [        X5      u  p[        nUS:X  a!  SnSn	U[        :X  a  SOUnU[        :X  a  SOUnOU[        :X  a  S	OUnU[        :X  a  S
OUnSR                  [        [        [        U5      [        R                  " S U 5       5      5      5      n[         R#                  U5      SLn[$        SL=(       a    [&        n[        U[(        5      (       d2  U[*        ;   a(  [-        U5      (       a  [*        R/                  X"5      nSnOSn[1        UUU5      m0[3        [5        U6 5      n[        U	[        U5      5      n[7        UU5       VVs/ s H  u  nn[9        UUS9PM     nnn[        U[:        5      (       a  [        U5      U/-  nOQ[3        U5      n[        U5      [        U5      :  a.  UR=                  [        U5      [        U5      -
  [>        /-  5        [        U[:        5      (       a  [        U5      U/-  nOQ[3        U5      n[        U5      [        U5      :  a.  UR=                  [        U5      [        U5      -
  [@        /-  5        [        U[:        5      (       a  [        U5      U/-  nOQ[3        U5      n[        U5      [        U5      :  a.  UR=                  [        U5      [        U5      -
  [B        /-  5        [7        UUUUU5       VVV V!V"V#s/ s H*  u  nnn n!n"U V#s/ s H  n#[E        U#UU U!U"U5      PM     sn#PM,     nn"n!n nnn#U Vs/ s H  nU[        [F        4;   a  UOUPM     n$nU
b1  [        U
[H        5      (       d   e[K        U
5       H  u  n%n&U&U$U%'   M     U(       a  U V's/ s H  n'T0" U'5      U-   PM     sn'OS/[        U5      -  n([7        UU$U(5       VV)V*s/ s H  u  nn)n*[M        UU)U*UUU5      PM     nn)nn*U(       a  U=(       d    S//[        U5      -  n+U$=(       d    U/[        U5      -  n,[7        U(U+5       V*Vs/ s H%  u  n*n[O        U*[O        U04S jU 5       5      5      PM'     n(n*n[7        UU,U(5       V'V)V*s/ s H  u  n'n)n*[Q        U'U)U*T0" U'5      UT05      PM     nn)n'n*[3        [7        U6 5      n-O6U Vs/ s H  n[O        U04S jU 5       5      PM     n(n[3        [7        U6 5      n-[        U[(        5      (       d  [R        R/                  U[R        S   5      n[        U[:        5      (       a  UOSn.[        U[        U-5      U.5      n/[U        U-U5        [W        X!U-U(U$UU/S9$ s  snnf s  sn#f s  sn#n"n!n nnf s  snf s  sn'f s  sn*n)nf s  snn*f s  sn*n)n'f s  snf )uD  Format 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<   r9   r=   r   c              3   B   #    U  H  n[        [        U5      v   M     g 7fr   )r   r  )r[   r3   s     r   r]   tabulate.<locals>.<genexpr>=  s     K]cGS 1 1]s   F)r  r   c              3   4   >#    U  H  nT" U5      v   M     g 7fr   r>   r[   clr<  s     r   r]   r    s     32(2,,   c              3   4   >#    U  H  nT" U5      v   M     g 7fr   r>   r  s     r   r]   r    s     2""r  r   )	rowaligns),r  r  r1   r   r  r  _expand_numparser  r   MIN_PADDING_DEFAULT_ALIGNrF   r   r   r  from_iterabler  r&  r   r!  r$   multiline_formatsr)  rO   r=  r/   r  rE   rh  r0   r  _DEFAULT_FLOATFMT_DEFAULT_INTFMT_DEFAULT_MISSINGVALrs  r   r   r|  r]  r-  ru  _table_formatsr  _format_table)1r  r   tablefmtrm  rn  numalignstralignro  r  disable_numparser   maxcolwidthsrowalignmaxheadercolwidthsr  r}  num_colsr  min_padding
plain_textr  r:  r;  colscolnpcoltypesfloat_formatsint_formatsmissing_valsrT   ctfl_fmtint_fmtmiss_vr\   alignsidxr?   rx  	minwidthsrI   minwt_colst_alignsr   
ra_defaultr  r<  s1                                                   @r   r   r     sF   Z 4M '?}&M#M}Q'(lC((+L(LQL+L(DIL$%5x@	/9
 %}Q'((#..!1"H.@" "22DhPT!U$%5x@	)I)Y

 5!9-!Q K8'>98x'>98x (N :9%76X ! K]KK	
J  &&z2$>Md*>x--))*%%$((</?NH m,-D !13t9=I>A$	>RS>R73S2.>RHS(C  D	%
 
 X}D	)  #d)c-.@"@EVDW!WX&#$i#
 
 6l{c$i'D	C,< <@QQR*c""4yJ</J'|s4y(TS->!>CVBW WX /2(M;/
 /
*Ar67F JKKAB	?K/
 	  FNNXr"e,h(:XFN(H----#H-JCF3K . 9@G4Gq!{	"G4aS3t9_ 
 dFI66JAq$ 	aD-1A<P6 	 
 .2$#g,.6hZ#g,6 y&1
1a c33341 	 
 "'8Y?
?
1d !Qhqk<J? 	 
 CJ<@ADqS222D	ACJh,,!%%hx0HI'#66DJ 3t9jAIt%564FLI I T0 	L O 	5

 BsB   *X#<X.X)&X.8X8X=Y8,Y	8$Y6Y)X.c                 l    [        U [        5      (       a  S/U-  nU  H  nSX#'   M	     U$ U (       + /U-  $ )a*  
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       r   r  r    sG     "H--F\)	%E$I &$$%44r   c                     [        U [        5      (       a)  [        U [        5      (       d  X/U[        U 5      -
  -  -   $ U/U-  $ )aA  
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   r   r0   r1   )originalnum_desiredr   s      r   r  r    sC     (H%%j3.G.G){S]'BCCCy;&&r   c                 Z    U (       a  SU-  nU  Vs/ s H
  o2U-   U-   PM     nnU$ U $ s  snf )NrN   r>   )cellsr+   padr   padded_cellss        r   _pad_rowr    s9    Gm5:;UTd
S(U; <s   (c                 T    Uu  p#nX#R                  U 5      -   U-   R                  5       $ )z7Format row according to DataRow format without padding.)rF   rP   )r  r   r   r!   r"   s        r   r   r     s+    OEHH\**S088::r   c                 \    U(       d  g[        US5      (       a	  U" XU5      $ [        X5      $ )z5Return a string which represents a row of data cells.Nr  r   r   )r  rG   rH   r   s       r   
_build_rowr     s-    vz""ly99 66r   c                 <    U R                  [        XX45      5        U $ r   )r   r   )linesr  rG   rH   r   r  s         r   _append_basic_rowr    s    	LLLYGHLr   c                     U[        U 5      -
  nSU-  /nUS:X  a  XT-  U -   $ US:X  a  US-  nXF-
  nXe-  U -   Xu-  -   $ XU-  -   $ )NrN   bottomr<   r   )r1   )
text_lines	num_linescolumn_widthrow_alignmentdelta_linesblank	top_deltabottom_deltas           r   _align_cell_veriticallyr    sq    c*o-K< E "Z//	(	"1$	". :-0DDDK///r   c           
         U Vs/ s H
  owSU-  -
  PM     nnU V	s/ s H  oR                  5       PM     n
n	[        [        [        U
5      5      n[	        X5       VVs/ s H  u  p[        XXv5      PM     n
nn[        U5       VVs/ s H  o Vs/ s H  oU   PM	     snPM     nnnU H  n[        X5      n[        U UXU5        M     U $ s  snf s  sn	f s  snnf s  snf s  snnf )Nr   )	rS  r-  r   r1   rE   r  r  r  r  )r  padded_multiline_cellspadded_widthsrH   r   r  r  rA   rG   rT   cells_linesnlinesr  ilines_cellsln	padded_lns                    r   _append_multiline_rowr    s     '44mQWmI4+AB+Aa<<>+AKBS+&'F 00EB 	 A80   ;@-H-QK0KbqEK0-KHR%	%I&I  L! 5B 1Hs(   CCC	C!CC!C!c                     U(       d  g[        US5      (       a  U" X5      $ Uu  p4pVU  Vs/ s H  otU-  PM	     nn[        XXV45      $ s  snf )z3Return a string which represents a horizontal line.Nr  r  )	rG   rH   linefmtr   fillr!   r"   rA   r  s	            r   _build_liner    sU    w
##y,, 'S#,-9a9- (9:: .s   Ac                 <    U R                  [        XU5      5        U $ r   )r   r  )r  rG   rH   r  s       r   _append_liner  	  s    	LLY7;<Lr   c                   .    \ rS rSrSrS r\S 5       rSrg)JupyterHTMLStri	  zQWrap the string with a _repr_html_ method so that Jupyter
displays the HTML tablec                     U $ r   r>   selfs    r   _repr_html_JupyterHTMLStr._repr_html_	  s    r   c                     U $ )z>add a .str property so that the raw string is still accessibler>   r"  s    r   r0   JupyterHTMLStr.str	  s	     r   r>   N)	__name__
__module____qualname____firstlineno____doc__r$  propertyr0   __static_attributes__r>   r   r   r   r   	  s       r   r   c           
      *   / nU(       a  U R                   (       a  U R                   O/ nU R                  n	U R                  n
U Vs/ s H
  oSU	-  -   PM     nnU(       a  S n[        [        U	S9nO[
        n[        nU" X5      nU Vs/ s H  nU" UU	5      PM     nnU R                  (       a  SU;  a  [        X|X@R                  5        U(       a7  U" XXU
5        U R                  (       a  SU;  a  [        X|X@R                  5        U(       av  U R                  (       ae  SU;  a_  [        USS U5       H0  u  nnU" UUXU R                  US	9  [        X|X@R                  5        M2     U" UUS   UUU R                  US   S	9  OU R                  =(       dG    U R                  =(       d4    U R                  =(       d!    U R                  =(       d    [        S
S
S
S
5      nU H7  n[        U5      (       a  [        X|UU5        M"  U" UUXU R                  5        M9     U R                  (       a  SU;  a  [        X|X@R                  5        U(       d  U(       a2  SR!                  U5      nU R                  ["        :X  a  [%        U5      $ U$ g
s  snf s  snf )z1Produce a plain-text representation of the table.r   c                     U $ r   r>   )r3   r   s     r   r6  _format_table.<locals>.<lambda>#	  s    r   )r  r%   r&   r'   Nr  )r  r   r(   rt   )r,   r+   r)   r
   r  r  r  r%   r  r&   r'   rE   r*   r(   r   r6   rF   rd   r   )r  r   r   rG   rH   r;  r  r  hiddenr  r)   rA   r  pad_row
append_rowpadded_headersr3   padded_rowsralignseparating_lineoutputs                        r   r  r  	  s:   E&-#2F2FS!!RF
++CI,56Iq!c'kIM6$2<
&
W*N04573$K5
}}F2U9mmD5-IN#4F#By:M:MNs**/@/N{3B/;KCsMckkF y:M:MN	 < 	OKKr]	
  $""$}}$ }}$ BB# 	 C #3''U9oN5#}M  }}F2U9mmD$5!==<<!&))M{ 7 6s   J	Jc                   @    \ rS rSrSrS r\S 5       rS rS r	S r
Srg	)
r  ia	  aG  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                 h    / U l         S U l        [        R                  R                  " U /UQ70 UD6  g r   )_active_codes	max_linestextwrapTextWrapper__init__)r#  r   kwargss      r   r@  _CustomTextWrap.__init__i	  s/    %%d<T<V<r   c                 p    [        U 5      n[        (       a  [        R                  " U5      $ [        U5      $ )ziCustom len that gets console column width for wide
and non-wide characters as well as ignores color codes)r   r   r"  r1   )rO  strippeds     r   _len_CustomTextWrap._lenn	  s.     t$7##H--x= r   c                    [         R                  U5       Vs/ s H  o3PM     nnU Vs/ s H3  oUR                  UR                  5       S   UR                  5       S    PM5     nnSR	                  U R
                  5      U-   nU H1  nU[        :w  a  U R
                  R                  U5        M*  / U l        M3     [        U R
                  5      S:  a	  U[        -   nUR                  U5        gs  snf s  snf )zAdds 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.
r   r   r   N)	r  finditerr   spanrF   r<  _ansi_color_reset_coder   r1   )r#  r  new_linexcode_matchescodecolor_codess          r   _update_lines_CustomTextWrap._update_linesx	  s     $/#7#7#AB#Aa#ABEQ
EQTKK		AQ8\ 	 

 774--.9D--""))$/%'"	   t!!"Q&"88HX' C
s
   C.:C3c                 N   US:  a  SnOXC-
  nU R                   (       a`  US   nSnU R                  USU 5      U::  a  US-   nU R                  USU 5      U::  a  M  UR                  USUS-
   5        XgS-
  S US'   gU(       d   UR                  UR                  5       5        gg)z_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.
r   r  N)break_long_wordsrE  r   pop)r#  reversed_chunkscur_linecur_lenr   
space_leftchunkr  s           r   _handle_long_word!_CustomTextWrap._handle_long_word	  s     19JJ    $B'EA))E"1I&*4E ))E"1I&*4OOE'AEN+"'A.OB
 OOO//12 r   c                    / nU R                   S::  a  [        SU R                   -  5      eU R                  b}  U R                  S:  a  U R                  nOU R                  nU R                  U5      U R                  U R                  R                  5       5      -   U R                   :  a  [        S5      eUR                  5         U(       Ga=  / nSnU(       a  U R                  nOU R                  nU R                   U R                  U5      -
  nU R                  (       a!  US   R                  5       S:X  a
  U(       a  US	 U(       aJ  U R                  US   5      nXW-   U::  a$  UR                  UR                  5       5        XW-  nOO	U(       a  MJ  U(       aI  U R                  US   5      U:  a1  U R                  XXV5        [        [        U R
                  U5      5      nU R                  (       a7  U(       a0  US   R                  5       S:X  a  XPR                  US   5      -  nUS	 U(       Ga  U R                  b`  [!        U5      S-   U R                  :  dD  U(       a8  U R                  (       aQ  [!        U5      S:X  aB  US   R                  5       (       d*  XV::  a%  U R#                  X#SR%                  U5      -   5        GO<U(       a  US   R                  5       (       ac  XPR                  U R                  5      -   U::  aB  UR                  U R                  5        U R#                  X#SR%                  U5      -   5          U$ XPR                  US   5      -  nUS	 U(       a  M  U(       ab  US   R'                  5       nU R                  U5      U R                  U R                  5      -   U R                   ::  a  XR                  -   US'    U$ U R#                  X#U R                  R                  5       -   5         U$ U(       a  GM=  U$ )aN  _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.
r   zinvalid width %r (must be > 0)r   z#placeholder too large for max widthr  r   )r   r   r=  subsequent_indentinitial_indentrE  placeholderlstripreversedrop_whitespacer   r   rT  rZ  sumr   r1   rP  rF   rP   )	r#  chunksr  indentrV  rW  r   	chunk_len	prev_lines	            r   _wrap_chunks_CustomTextWrap._wrap_chunks	  sh    ::?=

JKK>>%~~!//,,yy 499T-=-=-D-D-F#GG$**T !FGG 	 HG //,, JJ6!22E ##r
(8(8(:b(@U2J IIfRj1	 &%/OOFJJL1(G  & $))F2J/%7&&vHc$))X67 ##Xb\5G5G5IR5O99Xb\22RLNN*5zA~6"//K1, &q	 1 1( &&urwwx7H.HI"$RL..00 '))D4D4D*E E N$OOD,<,<= ..urwwx?P6PQ!   99Xb\#::$RL #( !(-b	(8(8(:I $		) 4tyyAQAQ7R R#'::!. -68H8H,Hb	 %  **54;K;K;R;R;T2TUe fd r   )r<  r=  N)r(  r)  r*  r+  r,  r@  staticmethodrE  rP  rZ  rh  r.  r>   r   r   r  r  a	  s1    =
 ! !63Lmr   r  c                  L   SSK n SSKnSSKnUR                  " [        R
                  5      n U R                  UR                  SS S/ SQ5      u  pE/ n[        n[        n	Sn
SnSnS	nW H  u  pUS
;   a  SnM  US;   a  UnM  US;   a  UnM#  US;   a  Un	M-  US;   a  UR                  5       n
ME  US;   a8  U[        ;  a*  [        SU-  5        [        U5        UR                  S5        UnM  US;   a  UnM  US;   d  M  [        U5        UR                  S5        M     W(       d  UR                  /OUnUS	:X  a  UR                  O[!        US5       nU H[  nUS	:X  a  UR                  n[#        U5      (       a  [%        UUUUUU	UU
S9  M7  [!        U5       n[%        UUUUUU	UU
S9  SSS5        M]     SSS5        g! U R                   a2  n[        U5        [        U5        UR                  S5         SnAGNSnAff = f! , (       d  f       M  = f! , (       d  f       g= f)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)
r   Nr   zh1o:s:F:A:f:)helpro   r9  zsep=zfloat=zint=zalign=zformat=r   r   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   r  r!   rm  rn  filer   )getoptsysr>  dedent_mainr,  argvGetoptErrorprintexitr  r  r.  r   stdinstdoutopenr   _pprint_file)rn  ro  r>  usageoptsr   r  r   rm  rn  r   r  r!   outfileoptvaluefilesoutr   fobjs                       r   rq  rq  )
  s   0 OOEMM*E	]]HHQRLW

 G HFHH
CG
$$ G&&G%%HO#F(({{}H&&,,:UBCeHO#C$$%LHHQK+ ,  $SYYKE3#**D#,>
>3ACxII{{#%%!%	 !W  '!)!)% !)	 W  ?
>E  aed W! ?
>s<   $F> AHH)H>H 'G;;H 
HH
H#c                     U R                  5       nU V	s/ s H=  oR                  5       (       d  M  [        R                  " X9R	                  5       5      PM?     n
n	[        [        U
UUUUUS9US9  g s  sn	f )N)rm  rn  r   )rm  )	readlinesr   r   r.  rP   rt  r   )fobjectr   r  r!   rm  rn  rm  r   r   rs   tables              r   ry  ry  
  si    D04B1	&RXXc88:&EB		
 
 Cs
   A2(A2__main__)r   )FF)TT)r   TFF)r   T)FN)r   )T)r   ignorer   )}r,  collectionsr   collections.abcr   r   r   r   rh   	itertoolsr   r   r  	functoolsr	   r
   r   r   r   r>  r  r   ImportErrorr   __all__r   __version__r  r?  r  r  r  r  r!  r2   r   r#   r$   r6   rB   rK   rW   r`   rd   rl   rp   rz   r   LATEX_ESCAPE_RULESr   r   r  r/   sortedr  r   r  compiler'  r(  _esc_csi_osc_st_ansi_escape_patVERBOSEr  encoder  rJ  r   r   r   r   r   r  r   r   r  r  r  r  r  r  r   r$  r)  r1   r2  r=  rE  rJ  rH  rQ  r]  rf  rh  rs  ru  r  r  r  r  r  r  r  r   r  r  r  r   r   r  r  r  r  r  r0   r   r  r?  r  rq  ry  r(  r>   r   r   <module>r     s     " + % 8 % 	 	   
$ F	/       % &:; Y 7
8D 	*A (
.-
2
l 










   <N 5!&nkr3b)RdB/r3b)"dB'D"%%{3	n ["dB'D"%	n* KsCc*S#sC0S#sC0sCc*#sC(S#&	+n> ;ueUE2UE5%8UE5%8ueUE2%.ue,	?nR KueUE2UE5%8UE5%8ueUE2%.ue,	Snf +ueUE2UE5%8UE5%8ueUE2%.ue,	gnz +ueUE2UE5%8UE5%8ueUE2%.ue,	{nN ;ueUE2UE5%8UE5%8ueUE2%.ue,	Onb +ueUE2UE5%8UE5%8ueUE2%.ue,	cnv {sCc*S#sC0sCc*#sC(S#&	wnJ kueUE2UE5%8ueUE2%.ue,	Kn^ {ueUE2UE5%8ueUE2%.ue,	_nr [ueUE2UE5%8ueUE2%.ue,	snF [ueUE2UE5%8ueUE2%.ue,	GnZ kueUE2UE5%8ueUE2%.ue,	[nn [ueUE2UE5%8ueUE2%.ue,	onB ksCc*S#sC0#sC(S#&%	CnV K(.#sC(S#&%	Wnj kS#sC0#sC(S#&	kn~ K$d+S#&	nR kRc2."c2&C$	Snf ksCc*S#sC0sCc*#sC(S#&	gnz KsCc*S#sC0sCc*#sC(S#&	{nN 
;r3b)RdB/r3b)"dB'D"%	Onb <'	
 T2r2.T2r2.tRR(3S9137cn@ .UC,d3	AnT %0eT*	Unh K2+RR8.e<,dE:%	in| +2+RR8.d;,dD9%	}nP	 [+YB30"b"=	Q	nd	 +YB30"b"=*r2
R0	e	nx	 k3dC["b"55r2rB	y	nL
 {3tD12r2>2BB?	M
n`
 
;"dB'D"%	a
nt
 &%-'	 -/wB+-.u-%	Inb ~22456 
Wh F =	
 N , , = , F h F h h F  
5! : ::m, M2 2 &|&|
rl	 
 	 
  6 		 6 		c#  $ jj)2::6JJ/66v>

K " #%::E$  
(DB,   F:/($: 14 D
4 >A E
 .b!*.4!J KO'.0({|:6 "H
V5"';7
0 TX,	;

S 
DNEh** EP_D  z	G WT  G  		s#   e? f ?f
fff