K i:tdZddlmZddlmZmZddlmZddl m Z m Z ddl mZmZddlZddlZddlZddlZddlZ ddlZdZgd Z d d lmZd Zd ZdZdZdZdZ eduZ!dZ"edgdZ#edgdZ$edgdZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,ddZ-dd Z.d!Z/d"d#d$d%d&d'd(d)d*d+d,d-d. Z0e0fd/Z1d0Z2id1e%e#dd2d3de#dd2d3dde#dd2d3de$dd3de$dd3ddd4d5gd6e%dddde$dd3de$dd3dddd7e%e#d8d2d8d8e#d8d9d8d8e#d8d2d8d8e#d8d2d8d8e$d:d:d:e$d:d:d:d dd;e%e#dd?e#d@d=dAdBe#d@d=dAdBe#dCd=dDdEe$dFdFdFe$dFdFdFd ddGe%e#dHd=d>dIe#d@d=dAdBe#d@d=dAdBe#dJd=dDdKe$dFdFdFe$dFdFdFd ddLe%e#dMdNdOdPe#dQdNdRdSe#dQdNdRdSe#dTdNdUdVe$dWdWdWe$dWdWdWd ddXe%e#dYdNdZd[e#d\dNd]d^e#d@d=dAdBe#d_dNd`dae$dFdFdFe$dFdFdFd ddbe%e#dcdddedfe#dgdddhdie#dgdddhdie#djdddkdle$dmdmdme$dmdmdmd ddne%e#dodddpdqe#drdddsdte#d@d=dAdBe#dudddvdwe$dFdFdFe$dFdFdFd ddxe%e#d8d2d8d8e#d8d9d8d8de#d8d2d8d8e$d:d:d:e$d:d:d:d ddye%e#dd?e#d@d=dAdBde#dCd=dDdEe$dFdFdFe$dFdFdFd ddze%e#dHd=d>dIe#d@d=dAdBde#dJd=dDdKe$dFdFdFe$dFdFdFd dd{e%e#dMdNdOdPe#dQdNdRdSde#dTdNdUdVe$dWdWdWe$dWdWdWd dd|e%e#dYdNdZd[e#d\dNd]d^de#d_dNd`dae$dFdFdFe$dFdFdFd dd}e%e#dcdddedfe#dgdddhdide#djdddkdle$dmdmdme$dmdmdmd dd~e%e#dodddpdqe#drdddsdtde#dudddvdwe$dFdFdFe$dFdFdFd dde%e#d:d2d:d:e#d:d2d:d:dde$d:d:d:e$d:d:d:d d4gide%e(e(dde$d:d:d:e$d:d:d:d d4gde%de#d:d2d8d:dde$d:d:d:e$d:d:d:d dde%dddde$ddde$d:d:d:d dde%de#dd2d8ddde$dd:de$dd:dd dde%e#d8d2d8d8e#d8d2d8d8de#d8d2d8d8e$d:d:d:e$d:d:d:d dde%e#d8d2d8d8e#d:d2d8d:de#d8d2d8d8e$d:d:d:e$d:d:d:d dde%e#dd9d3de#dd9d3dde#dd9d3de$dd3de$dd3dddde%e#dddde#dddde#dddde#ddddee)dee)d:ddde%ddddee-ddee-dd dde%dddde$ddde$dddd dde%e+dde#ddddee,dd ee,dd dd4gde%e+dde#ddddee,ddee,dddd4gde%e.e#ddddde#dddde1e1d dde%e.e#ddddde#ddddee1iee1id dde%ee.de#ddddde#dddde1e1d dde%ee.de#ddddde#dddde1e1d dde%dddde$ddde$ddddde%dddde$ddd:e*d de%ee/d dde#ddddee/dee/d d d4gdZ3e4e5e3jmZ7id6d6d1d1d7d7d;d;dGdGdLdLdXdXdbdbdndnddddddddddddddZ8ejrdZ:ejrdZ;dZe<dZ?de=de>de<de?de<de>de?dZ@ejre@ejZBejre@jdejZDdZEejrdZFdZGd„ZHdÄZIdĄZJeKfdńZLdƄZMddDŽZNdȄZOdɄZPdʄZQd˄ZRd̄ZSd̈́ZTd΄ZUdτZVeWfdЄZXdфZYd҄ZZdӄZ[eWfdԄZ\dՄZ] ddքZ^dׄZ_dd؄Z`ddلZa ddڄZbdۄZcd܄Zdd݄ZedބZfdd߄ZgddZhddZidd1eee e edd ddddf dZjdZkdZldZmdZndZoddZpdZq ddZrdZsdZtGddeuZvdZwGddejZydZzdZ{e|dk(rezyy#e$rdZY wxYw#e$rY wxYw(zPretty-print tabular data.) namedtuple)IterableSized)escape)chain zip_longest)reducepartialNc6t|tjSN) isinstanceioIOBase)fs W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/tabulate/__init__.py_is_filers a ##)tabulatetabulate_formatssimple_separated_format)versionFgdefaultLine)beginhlinesependDataRow)rr!r" TableFormat) lineabovelinebelowheaderlinebetweenrows linebelow headerrowdatarowpaddingwith_header_hidect|}|tk(xs |tk(xr:t|dk\xr |dtk(xst|dk\xr |dtk(}|S)Nrrr)typeliststrlenSEPARATING_LINE)rowrow_typeis_sls r_is_separating_liner6hsdCyH   0S  SQ 43q6_4 9 HM 7c!f7  Lrct|}|dvr d|dz zdzS|dk(rdd|dz zzdzS|dk(r dd|dz zzSd|zS)z~Return a segment of a horizontal line with optional colons which indicate column's alignment (as in `pipe` output format).)rightdecimal-r:centerrleft)aligncolwidthws r_pipe_segment_with_colonsrBqsh A $$q1u $$ ( cQUm$s** &cQUm$$Qwrc|sdgt|z}t||Dcgc]\}}t||}}}ddj|zdzScc}}w)znReturn a horizontal line with optional colons to indicate column's alignment (as in `pipe` output format).r|)r1ziprBjoin) colwidths colalignsarAsegmentss r_pipe_line_with_colonsrKs\ D3y>) > @@ s%A&c|dxxdz cc<dddddfdt||D}ddj|zdzS) NrrNz<.z>.z=.rMc3NK|]\}}j|d|zyw)rNrO).0rIvrSs r z*_textile_row_with_attrs..s% O41aimmAr"Q& Os"%rD)rErF)rRrGrHvaluesrSs @r_textile_row_with_attrsr_sINcNNI O3y+3N OF &! !C ''rcy)Nzr>)colwidths_ignorecolaligns_ignores r _html_begin_table_without_headerrcs rc ddddd}|r@t||Dcgc](\}}dj||j|d|*}}}nHt||Dcgc]1\}}dj||j|dt|3}}}djdj |j } |dk(rd| d } | Scc}}wcc}}w) Nrz style="text-align: right;"z style="text-align: center;"rMz<{0}{1}>{2}z {}thz
z )rEformatrO htmlescaperFrP) celltagunsaferRrGrHrSrTrIrUrowhtmls r_html_row_with_attrsrks.00 I K3 1 & &w a0Da H  K3 1 & &w a0DjQRm T  ""277+<#=#D#D#FGG$&wi/BC N  s -C 6Cc ddddd}t||Dcgc].\}}dj||j|d||z|z0}}}dj|dzScc}}w)NrzzrMz{}{} {} ||)rErfrOrF) rhrRrGrHheaderrSrTrIrUs r_moin_row_with_attrsros/11 I Y/ Aq '9==B#7!f9LM 77$ % ,, s3A!c ddddd}dj|Dcgc]}|j|dc}}dj|sdnd|zd z|rd gSd gScc}w) NlrrTrMr z\begin{tabular}{z\begin{longtable}{}z\toprule\hline)rFrO)rGrHbooktabs longtablerSrItabular_columns_fmts r_latex_line_begin_tabularryssccJI'')"LQ9==C#8"LM 99(1 7L! " $K    *3   #MsAcd}t|dk(r |dg|St|dk(r.|\}}}ddj|z}|r|d||dz|zS|Std) z/handle header and data rows for asciidoc formatc|ddddd}t||Dcgc]}|| c}}|Dcgc]\}}dj||}}}ddj|zdzg} g} |r| jd | r| d dj| zdzgz } d jdj| Scc}wcc}}w) N<>^rMz{:d}{}zcols=","rnz options="z [{}] |====)rErfrFappend) is_headerrGrHrScolalignasciidoc_alignmentswidthr?asciidoc_column_specifiers header_list options_lists rmake_header_linez'_asciidoc_row..make_header_lines!3##N ! IF (+F ?R& .:eUHOOE5 )& "&  388,F#GH3NO      )  K#((<*@@3FG GK##CHH[$9::%G& s B3 B8rFrDTrszm _asciidoc_row() requires two (colwidths, colaligns) or three (cell_values, colwidths, colaligns) arguments) )r1rF ValueError)rargsrrRrGrH data_lines r _asciidoc_rowrs;4 4yA~ --- Ta-1) Y #((;// #D)Y?$FR R  I  rz\&z\%z\$z\#z\_z\^{}z\{z\}z\textasciitilde{}z\textbackslash{}z\ensuremath{<}z\ensuremath{>}) &%$#_r~{rt~\r|r}c fd}|Dcgc]}djt||}}tddd}t||Scc}w)Nc(j||Sr rZ)rTescruless r escape_charz_latex_row..escape_chars||Aq!!rrr\\)rFmapr#_build_simple_row)rRrGrHrrcellescaped_valuesrowfmts ` r _latex_rowrsP"CNN$bggc+t45NNN Rf %F ^V 44Os"Acd}t|}g}|r||d|d<|D].}t|}|r||d|d<|j|0||fS)NcTt|ttfr|jsy|S)Nz..)r r0bytesstripvals r escape_emptyz._rst_escape_first_column..escape_empty%s cC< (Jrr)r/r)rowsheadersr new_headersnew_rowsr3new_rows r_rst_escape_first_columnr$sr w-KH%gaj1 A!s) %c!f-GAJ ! [  rsimpler:z r%r(plaingrid+=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╛outlinesimple_outlinerounded_outline heavy_outline mixed_outlinedouble_outline fancy_outlinegithubpipeorgtbljirarmprestoprettypsqlrst mediawikiz.{| class="wikitable" style="text-align: left;"z |+ |-z|-z|}!moinmoinz''')rnyoutrackz|| z || z| z | z |htmlz
retd unsafehtmlTlatexruz\hline \end{tabular} latex_raw)rlatex_booktabs)rvz\midrulez\bottomrule \end{tabular}latex_longtable)rwz\hline \endheadz\hline \end{longtable}tsv z|_. z|_.z|====)textileasciidocz \r|\n|\r\ns | | z\x1bz\[z\]rz. ( # 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) z8;;z! # "closing" OSC sequence ) utf8zz>^(([+-]?[0-9]{1,3})(?:,([0-9]{3}))*)?(?(1)\.[0-9]*|\.[0-9]+)?$c Ttddddtd|dtd|dddS)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 Nrr)r)r*r+r,)r$r#)rQs rrrs;     "i,Ir*  rc |j}tt j t |S#ttf$rY4wxYw)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 )decodeUnicodeDecodeErrorAttributeErrorboolrematch _float_with_thousands_separatorsstrings r"_isnumber_with_thousands_separatorrsD2  96B CC  /   s5AAc@ ||y#ttf$rYywxYw)NTF)r TypeError)convrs r_isconvertibler9s( V   "s  ctt|syt|ttfrNt j t|st jt|r|jdvSy)z >>> _isnumber("123.45") True >>> _isnumber("123") True >>> _isnumber("spam") False >>> _isnumber("123e45678") False >>> _isnumber("inf") True F)infz-infnanT) rfloatr r0rmathisinfisnanlowerrs r _isnumberrAsS % ( FS%L ) 5=!TZZf %>||~!777 rcht||uxs$t|ttfxr t ||S)zG >>> _isint("123") True >>> _isint("123.45") False )r.r rr0r)rinttypes r_isintrWs7 V  , fucl + , 7F +rc`t|tuxst|ttfxr|dvS)zc >>> _isbool(True) True >>> _isbool("False") True >>> _isbool(1) False )TrueFalse)r.rr rr0rs r_isboolres3 <4  6E3<(HV7H-Hrc,|r!t|ttfr t|}| t dSt |drtSt |rtSt|r|rtSt|r|rtSt|trtStS)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.hasattrrrrintrr)r has_invisiblenumparses r_typerssy FS%L9V$ ~Dz  %  H 6 x FE "  rct|s t|rZt|ry|jd}|dkr|j jdn|}|dk\rt ||z dz Syy)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 .rer)rrrrfindrr1)rposs r _afterpointrsk>vF &>,,s#C/2Qw&,,.&&s+CCax6{S(1,,rc.d|z}|j|S)uLFlush right. >>> _padleft(6, 'яйца') == ' яйца' True z{0:>%ds}rfrsfmts r_padleftr  u C ::a=rc.d|z}|j|S)uLFlush left. >>> _padright(6, 'яйца') == 'яйца ' True z{0:<%ds}r r s r _padrightrrrc.d|z}|j|S)uNCenter string. >>> _padboth(6, 'яйца') == ' яйца ' True z{0:^%ds}r r s r_padbothrrrc|Sr r>) ignore_widthr s r_padnoners Hrczt|trtjd|Stjd|S)aRemove 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_codessub_ansi_codes_bytesr s rrrs2!Sua(( $$UA..rcttrtj}nt}t |t t fr|t|S|t |S)zVisible width of a printed string. ANSI color codes are removed. >>> _visible_width('hello'), _visible_width("world") (5, 5) )wcwidthWIDE_CHARS_MODEwcswidthr1r r0rr)r len_fns r_visible_widthr sG!!!c5\"k!n%%c!f~rct|tr#ttjt |Sttjt |Sr )r r0rrsearch_multiline_codes_multiline_codes_bytesrs r _is_multiliner%s:!SBII.233BII4a899rc Ttt|tjd|Sz1Visible width of a potentially multiline content.[ ])maxrrsplit multiline_s line_width_fns r_multiline_widthr.s s="((8["AB CCrcb|rtn|rtjnt|rfd}|S}|S)z2Return a function to calculate visible cell width.ct|Sr )r.r r-s rz"_choose_width_fn..s-a?rr rrr1renable_widechars is_multilinewidth_fnr-s @r_choose_width_fnr8 s9& ((  ? O! Orct|dk(r-ts|Dcgc]}|j}}t}||fS|dk(r-ts|Dcgc]}|j}}t}||fS|dk(rx|r"|Dcgc]}t t |}}n|Dcgc] }t |}}t |}t||Dcgc]\}}|||z dzz}}}t}||fS|s t}||fSts|Dcgc]}|j}}t}||fScc}wcc}wcc}wcc}wcc}}wcc}w)Nr8r<r9rN) PRESERVE_WHITESPACErr rrrr)rErr)stringsrSrr padfndecimals maxdecimalsdecss r_align_column_choose_padfnr@sSG"*12Qqwwy2G2& E>% h "*12Qqwwy2G2 E> i  =DE KN3EHE0781 A8H8(m ADWhAWXga1 d*c11XX E>  E>#*12Qqwwy2G2 E>)33F8X 3s#DD 0D%D*D/8D5cb|rtn|rtjnt|rfd}|S}|S)Nct|Sr )_align_column_multiline_widthr1s rr2z/_align_column_choose_width_fn..;s:1mLrr3r4s @r_align_column_choose_width_fnrD3s9& ((  L O! Orc Ttt|tjd|Sr')r/rrr*r+s rrCrCAs M288Hk#BC DDrcg}|D]<}t|tr|D]}|j|,|j|>|Sr )r r/r) nested_listretitemsubitems r _flat_listrKFsP C dD ! $ 7# $ JJt   Jrct|||\}}t|||}tt||}t t t ||} |r3|sG|sE|D cgc]6} dj | jD cgc] } || |  c} 8} } } | S|D cgc]/} tjd| D cgc] } t| c} 1} } } t|| Dcgc]*\}}t||Dcgc] \}}| ||z z c}},}}}}}t||D  cgc]L\} }dj t| jxs| |D cgc]\} }||| c}} N} } }} }| S|s|s|D cgc] } || |  } } | Sttt|} t|| Dcgc] \}}| ||z z }}}t||D cgc]\} }||| } } }| Scc} wcc} } wcc} wcc} } wcc}}wcc}}}}wcc}} wcc}} }} wcc} wcc}}wcc}} w)ztring] -> [padded_string]rsr() r@rDr/rr)rKrF splitlinesrr*r1rE)r;rSminwidthrr5r6r<r7s_widthsmaxwidthmsr padded_stringss_lensmwmlrArqvisible_widthss r _align_columnrWQsN0MRNGU,'HC'*+H3z(+,h7H " r}}G!51-GHN6 +JQQ2rxx"'=>!s1v>QFQ"(F3B14B <1QU#<N"'>:B 3 8M2PR3ST41a5A;TUN  :ABQeHa0BNB  #c7+,F=@6=RSTQh!a%0SNS7:'>6RSdaeAqkSNS 5H ?Q<U CTTsr"H ?H H "H?H H*H# HH# /4H1 #H+6 H1 H9 H>/IH HH# +H1 c tddtdtdtdtdt di}t tttttdd}t |j|d|j|d}||S)Nrrrr)rZrYrrrr)r.rrrrr0r)rO)type1type2typesinvtypes moregenerics r _more_genericr`sy T A a Q q q Q  E      : Heiiq)599UA+>?K K  rcj|Dcgc]}t|||}}tt|tScc}w)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 )rr r`r)r;rrr r]s r _column_typerbs6,9@ @1U1mX . @E @ - -- As0c||S|tur|S|tur t||S|tur t|dS|t urc|xrt|ttf}|r2t|}tt ||}|j||Stt ||S|S#tt f$rt|cYSwxYw)uFormat 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) r0rrfrrrrr rreplace) rvaltypefloatfmtintfmt missingvalris_a_colored_numberraw_val formatted_vals r_formatrms {#~ Cc6"" E  sG$ $ E +M 3e 0M !#&G"5>8}|j D])} | | vs|j+| | j-| +@|dk(r|}nt|t.r9|D cgc]} |j1| | }} ttt|}n\|dk(rJt|d kDr9|D cgc]}  j1| | }} ttt|}ng}n |r td|D cgc]!}|D cgc]} |j1| c} #}}} n|dk(rAt|dr5t|dr)t|dr|j2D cgc]} | d  }} nt4t|d kDrxt5j6|d r`t5j8|d D cgc]} | j}} |dk(r|}|Dcgc]}|Dcgc]}t||c}}}}nA|dk(rfv}|dk(r| tA||}nt|tBr|stA|t|}npt|tDr|s tA||}nQ|dk(s tG|r.|s,|tt;t|}tA||}n|dk(s tG|s|s |r8t|d kDr*t|}t|d }||kr dg||z z|z}||fS#t$rd}t|}YdwxYwcc}wcc} wcc} wcc} wcc} }wcc} wcc} wcc}wcc}}w)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. FTNkeysr^__call__ry)ralwaysTrz7tabular data doesn't appear to be a dict or a DataFramedtypenames_fieldsfirstrowrz6headers for a list of dicts is not a dict or a keyword descriptionfetchonerowcountc2t|r|St|Sr )r6r/)rrs rr2z)_normalize_tabular_data..s#6q#9atAwrrrneverr)$rrr/rr^r izip_longestrynamer rr0getattrrrr1tuplersetextendupdateradddictrOr dataclasses is_dataclassfieldsranger.rrrrr) tabular_datar showindexis_headers2bool_brokenryrrvalsr3 uniq_keys firstdictkcolumnfield field_namesrshowindex_is_a_strnhsncolss r_normalize_tabular_datars%B  W !& E|V$x)H <&& 3$$&Dl1134D\7 + %D88 &&++7l0055t<+1166D!H , 2 2 7 78D!H&&D++,E)-.#DI.D.VW W f 3sD>*GL! f TG v  g. **G4#((..G v D A 47E*Q+3sDGOO45G Y]wtAw7GDGX>> repr(_to_str(b'foo')) "'foo'" >>> repr(_to_str('foo')) "'foo'" >>> repr(_to_str(42)) "'42'" )encodingerrors)r rrr0)r rrs r_to_strrs*(!Uxx&x99 q6Mrr>c 0|g}t|||\}}t|\}}| St|d}t| trt | || } n t | |d} t | |}t|| |}| Wt|d}t| trt | || } n t | |d} t | |}t|g| |d}|dk(rt||\}}t}|dk(rd}d} |tk(rdn|}|tk(rdn|}n|tk(rd n|}|tk(rd n|}d jttt|tjd |D}t j#|du}t$duxrt&}t|t(s,|t*vr$t-|rt*j/||}d}nd }t1|||0t3t5|}t | t|}t7||Dcgc]\}}t9||}}}t|t:rt||gz}nPt3|}t|t|kr.|j=t|t|z t>gzt|t:rt||gz}nPt3|}t|t|kr.|j=t|t|z t@gzt|t:rt||gz}nPt3|}t|t|kr.|j=t|t|z tBgzt7|||||D !"#cgc]&\}}} }!}"|D#cgc]}#tE|#|| |!|"|c}#(}}"}!} }}}#|Dcgc]}|ttFfvr|n|}$}| *t| tHsJtK| D] \}%}&|&|$|%< |r|D'cgc] }'0|'|zc}'ndgt|z}(t7||$|(D)*cgc]\}})}*tM||)|*|||}})}}*|r|xsdggt|z}+|$xs|gt|z},t7|(|+D*cgc]#\}*}tO|*tO0fd|D%}(}*}t7||,|(D')*cgc]\}'})}*tQ|'|)|*0|'|0}})}'}*t3t7|}-n2|Dcgc]}tO0fd|D}(}t3t7|}-t|t(stRj/|tRd}t| t:r| nd}.t | t|-|.}/tU|-|tW|||-|(|$||/Scc}}wcc}#wcc}#}"}!} }}wcc}wcc}'wcc}*})}wcc}}*wcc}*})}'wcc}w)uJFormat 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;" |+ |- ! 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"))
strings numbers
spam 41.9999
eggs 451
"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)rr)rrrTr<r9r=rc3<K|]}tt|ywr )rr)r[r3s rr]ztabulate..=sKcGS 1KsF)rrc3.K|] }|ywr r>r[clr7s rr]ztabulate..s32(2,3c3.K|] }|ywr r>rs rr]ztabulate..s2""2rr) rowaligns),rrzr1r rr_expand_numparserr MIN_PADDING_DEFAULT_ALIGNrFrrr from_iterablerr"rrr$multiline_formatsr%rOr8r/rrErbr0r_DEFAULT_FLOATFMT_DEFAULT_INTFMT_DEFAULT_MISSINGVALrmrrrvrWr)ro_table_formatsr} _format_table)1rrtablefmtrgrhnumalignstralignrirdisable_numparser maxcolwidthsrowalignmaxheadercolwidthsrrwnum_colsr min_padding plain_textrr5r6colscolnpcoltypes float_formats int_formats missing_valsrTctfl_fmtint_fmtmiss_vr\alignsidxr?rr minwidthsrIminwt_colst_alignsr ra_defaultrr7s1 @rrrs*Z 4gM7'?}&M#M#}Q'( lC (+L(LQL+L(DIL$%5x@ / <9 %}Q'( (# .!1"H.@" "22DhPT!U $%5x@ ) I)Y   5!9-!Q w K8 '>98x'>98x (N :9%76X  !   K]K K  J &&z2$>Md*> x - ) ) * %$((8<   /?NH  m, -D !13t9=I>A$ >RS73 S2.SHS(C D %  X } D )  #d)c-.@"@EVDW!W X&#$i #  6l { c$i '   D C ,< <@QQ R*c"4yJ</ J' | s4y (   TS->!>CVBW W X/2 (M; /    *Ar67FJKKAB ?K D FN Nr"e ,h(: NF N(H---#H- JCF3K 9@G4q!{ "4aS3t9_ dFI6   Aq$ aD-1A<P D  .2$#g,.6hZ#g,6y&1 a c333 4  "'8Y?  1d !Qhqk< J  CJ<@AqS222A ACJ h ,!%%hx0HI'#6DJ 3t9jAIt%56 '4FLI IT0 L O 5   BsBV>W $W;W  WW W$(W$ !W*W1W cXt|trdg|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_countrrys rrrsK"H-F\) % %E$Ie  %$$% 44rcxt|tr%t|ts||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 rrrs?(H%j3.G7){S]'BCCCy;&&rcL|rd|z}|Dcgc] }||z|z }}|S|Scc}w)NrNr>)cellsr+padr padded_cellss r_pad_rowrs: Gm5:;Td S(; ; BKB S+& 'Fi0 B FAx8K;@-HQK0bBqE0HKHJR% %Iy&IJ L!5B1Hs(CC C C C CCc|syt|dr |||S|\}}}}|Dcgc]}||z }}t||||fScc}w)z3Return a string which represents a horizontal line.Nrr) rGrHlinefmtrfillr!r"rArs r _build_liners] w #y),, 'tS##,-a-- S(9::.s Ac>|jt||||Sr )rr)rrGrHrs r _append_liner s LLY 7;< Lrc&eZdZdZdZedZy)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>rs rr0zJupyterHTMLStr.str s  rN)__name__ __module__ __qualname____doc__rpropertyr0r>rrrr s rrc g}|r|jr |jng}|j} |j} |D cgc] } | d| zz } } |rd} tt| }n t } t }| || }|Dcgc] }| ||  }}|jrd|vrt|| ||j|r4|||| || |jrd|vrt|| ||j|rv|jrjd|vrft|dd|D]5\}}|||| ||j| t|| ||j7|||d| ||j|d n}|jxs8|jxs*|jxs|jxstd d d d }|D]2}t|rt|| |||||| ||j4|jrd |vrt|| ||j|s|r1d j!|}|jt"k(r t%|S|Sy cc} wcc}w) z1Produce a plain-text representation of the table.rc|Sr r>)r3rs rr2z_format_table..# sr)rr%r&r'Nr)rrr(rs)r,r+r)r rrrr%rr&r'rEr*r(rr6rFrcr)r rrrGrHr6rrhiddenrr)rAr pad_row append_rowpadded_headersr3 padded_rowsralignseparating_lineoutputs rrr sa E&-#2F2FS ! !RF ++C I,56qa!c'k6M6$2< & Wc*N04573$5K5 }}F2UM9cmmD5.-IN   #4F#B  y#:M:M Ns**/@/N{3B/; OKC sM9ckkF   y#:M:M N  O   O   KKr]      $"" $}} $}} $BB#  NC#3'UM9oN5#}iM  N }}F2UM9cmmD$5! ==< <!&) )M{76s H?<Ic8eZdZdZdZedZdZdZdZ y)ra[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. cfg|_d|_tjj|g|i|yr ) _active_codes max_linestextwrap TextWrapper__init__)rrkwargss rr3z_CustomTextWrap.__init__i s/%%d|djs+||kr&|j#||dj%|zn*|r|djrd||j |j z|krC|j|j |j#||dj%|z |S||j |dz}|d=|r|rb|dj'}|j ||j |j z|jkr||j z|d< |S|j#|||j jz |S|r|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)rz#placeholder too large for max widthrr)rrr0subsequent_indentinitial_indentr7 placeholderlstripreversedrop_whitespacerrrDrJsumrr1rArFrP) rchunksrindentrFrGr chunk_len prev_lines r _wrap_chunksz_CustomTextWrap._wrap_chunks st ::?= JK K >> %~~!//,,yy 499T-=-=-D-D-F#GG$**T !FGG HG//,,JJ6!22E##r (8(8(:b(@U2J IIfRj1 Y&%/OOFJJL1y(G$))F2J/%7&&vx%Hc$))X67##Xb\5G5G5IR5O499Xb\22RLNN*5zA~6"//K1, &q  15(&&ufrwwx7H.HI"$RL..0 '$))D4D4D*E E N$OOD,<,<= ..ufrwwx?P6PQ!  499Xb\#::$RL#!(-b (8(8(:I $ ) 4tyyAQAQ7R R#'::!.-68H8H,Hb % **5&4;K;K;R;R;T2TU ed rN) rrr r!r3 staticmethodr7rArJrWr>rrrra s1= !!63Lmrrc ddl}ddl}ddl}|jtj } |j|j dddgd\}}g}t}t} d} d} d} d } D]\}}|d vrd } |d vr|} |d vr|}|dvr|} "|dvr|j} 7|dvr5|tvr*td|zt||jd|} p|dvr|} w|dvs|t||jds |jgn|}| d k(r |jn t!| d5}|D]Y}|d k(r |j}t#|rt%||| | || || 3t!|5}t%||| | || || ddd[ dddy#|j$r2}t|t||jdYd}~d}~wwxYw#1swYxYw#1swYyxYw)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:)helprnr,zsep=zfloat=zint=zalign=zformat=rrz\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)rrr!rgrhfiler)getoptsysr1dedent_mainr!argv GetoptErrorprintexitrrr*rstdinstdoutopenr _pprint_file)r\r]r1usageoptsrrrrgrhrrr!outfileoptvaluefilesoutrfobjs rr_r_) s00 HOOEMM *E ]] HHQRL  W dG H FHH CG U $ $ G & &G % %H O #F ( ({{}H & &,,:UBCe  H O #C $ $ %L HHQK+, $SYYKE3#**D#,>3 ACxII{#%%!% !W   '!)!)% !)    E    a e   d  !s<%F3AG,4G  G,G+'GG G) %G,,G5c |j}|D cgc]7} | jstj|| j 9} } t t | ||||||ycc} w)N)rgrhr)r[) readlinesrrr*rPrbr) fobjectrrr!rgrhr[rrrrtables rrgrg si    D04 B1 RXXc188: & BE B        Cs A0&A0__main__)r)FF)TT)rTFF)rT)FN)r)T)rignorer )}r! collectionsrcollections.abcrrrrrg itertoolsrrr functoolsr r rrrr1rr ImportErrorr__all__r __version__rr:rrrrrr2rr#r$r6rBrKrWr_rcrkroryrLATEX_ESCAPE_RULESrrrr/sortedrrrcompiler#r$_esc_csi_osc_st_ansi_escape_patVERBOSErencoderr;rrrrrrrrrrr rrrrr r%r1r.r8r@rDrCrKrWr`rbrmrorzr}rrrrrrrrrrrrrrrrr0rrr2rr_rgrr>rrrs "+%8%  $ F /  %&:; Y 7 8D    * A ( . - 2 l              ;ueUE2UE5%8UE5%8ueUE2%.ue, ?nRKueUE2UE5%8UE5%8ueUE2%.ue, Snf+ueUE2UE5%8UE5%8ueUE2%.ue, gnz+ueUE2UE5%8UE5%8ueUE2%.ue, {nN;ueUE2UE5%8UE5%8ueUE2%.ue, Onb+ueUE2UE5%8UE5%8ueUE2%.ue, cnv{sCc*S#sC0sCc*#sC(S#& wnJkueUE2UE5%8ueUE2%.ue, Kn^{ueUE2UE5%8ueUE2%.ue, _nr[ueUE2UE5%8ueUE2%.ue, snF[ueUE2UE5%8ueUE2%.ue, GnZkueUE2UE5%8ueUE2%.ue, [nn[ueUE2UE5%8ueUE2%.ue, onB ksCc*S#sC0#sC(S#&% CnV K(.#sC(S#&% Wnj kS#sC0#sC(S#& kn~ K$d+S#& nR kRc2."c2&C$ Snf ksCc*S#sC0sCc*#sC(S#& gnz KsCc*S#sC0sCc*#sC(S#& {nN ;r3b)RdB/r3b)"dB'D"% Onb <   '  T2r2.T2r2.tRR(3S9137cn@ .UC,d3 AnT %0eT* Unh K2+RR8.e<,dE:% in|+2+RR8.d;,dD9% }nP  [+YB30"b"= Q nd +YB30"b"=*r2 R0 e nx k3dC["b"55r2rB y nL {3tD12r2>2BB? M n`  ;"dB'D"% a nt &%-' -/wB+-. u-% I nb ~22456  W h F=  N  , ,=, F h F h h F  5!:2::m,#M22 &| &| rl     6  6 c#$bjj)2::6 BJJ/66v> K"#-2::E$ (DB,   F: /($:14D 4 >AE  .b!*.4!JKO'. 0 ({|:6      "  H V5" '; 7 0TX, ; S DNEh**EP_D   z GWTG  s#g(g6(g32g36g?>g?