Ë
    £�DjÂ…  ã                   ó  — d Z ddlmZmZ ddlmZmZ ddlZdNd„Z G d„ de	«      Z
d„ Z G d	„ d
e	«      Z G d„ d«      Z	  edOi dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd g“d!d"“d#d“d$d “d%d “d&d “d'd “d(d“d)d“d*d+“ŽZ edOi dd,“dd“dd“dd“dd“dd“dd“dd“dd"“dd“dd-“d.d “dd g“d!d"“d#d“d$d/“d%d/“d(d“d&d “d'd “d)d“d*d+“ŽZ edOi dd“dd“dd“dd“dd“dd“dd“dd0“dd1“dd“dd2g“d.d2“d!d"“d#d“d$d3“d%d3“d(d4“d&d3“d'd3“d)d4“d*d5“ŽZ edOi dd6“dd7“dd8“dd9“dd“d:d;“dd<“dd“dd“dd=“dd g“d.d “d!d"“d#d“d>d"“d$d?“d%d?“d(d“d&d?“d'd?“d)d“d*d+“d@dAdBdCdDdEdFdGdHœ“ŽZ eeeee¬I«      Z edJddK¬L«      ZdM„ Zy)PaÕ  
Provides a simple table class.  A SimpleTable is essentially
a list of lists plus some formatting functionality.

Dependencies: the Python 2.5+ standard library.

Installation: just copy this module into your working directory (or
   anywhere in your pythonpath).

Basic use::

   mydata = [[11,12],[21,22]]  # data MUST be 2-dimensional
   myheaders = [ "Column 1", "Column 2" ]
   mystubs = [ "Row 1", "Row 2" ]
   tbl = SimpleTable(mydata, myheaders, mystubs, title="Title")
   print( tbl )
   print( tbl.as_csv() )

A SimpleTable is inherently (but not rigidly) rectangular.
You should create it from a *rectangular* (2d!) iterable of data.
Each item in your rectangular iterable will become the data
of a single Cell.  In principle, items can be any object,
not just numbers and strings.  However, default conversion
during table production is by simple string interpolation.
(So you cannot have a tuple as a data item *and* rely on
the default conversion.)

A SimpleTable allows only one column (the first) of stubs at
initilization, concatenation of tables allows you to produce tables
with interior stubs.  (You can also assign the datatype 'stub' to the
cells in any column, or use ``insert_stubs``.) A SimpleTable can be
concatenated with another SimpleTable or extended by another
SimpleTable. ::

    table1.extend_right(table2)
    table1.extend(table2)


A SimpleTable can be initialized with `datatypes`: a list of ints that
provide indexes into `data_fmts` and `data_aligns`.  Each data cell is
assigned a datatype, which will control formatting.  If you do not
specify the `datatypes` list, it will be set to ``range(ncols)`` where
`ncols` is the number of columns in the data.  (I.e., cells in a
column have their own datatype.) This means that you can just specify
`data_fmts` without bothering to provide a `datatypes` list.  If
``len(datatypes)<ncols`` then datatype assignment will cycle across a
row.  E.g., if you provide 10 columns of data with ``datatypes=[0,1]``
then you will have 5 columns of datatype 0 and 5 columns of datatype
1, alternating.  Corresponding to this specification, you should provide
a list of two ``data_fmts`` and a list of two ``data_aligns``.

Cells can be assigned labels as their `datatype` attribute.
You can then provide a format for that lable.
Us the SimpleTable's `label_cells` method to do this.  ::

    def mylabeller(cell):
        if cell.data is np.nan:
            return 'missing'

    mytable.label_cells(mylabeller)
    print(mytable.as_text(missing='-'))


Potential problems for Python 3
-------------------------------

- Calls ``next`` instead of ``__next__``.
  The 2to3 tool should handle that no problem.
  (We will switch to the `next` function if 2.5 support is ever dropped.)
- Let me know if you find other problems.

:contact: alan dot isaac at gmail dot com
:requires: Python 2.5.1+
:note: current version
:note: HTML data format currently specifies tags
:todo: support a bit more of http://www.oasis-open.org/specs/tr9503.html
:todo: add labels2formatters method, that associates a cell formatter with a
       datatype
:todo: add colspan support to Cell
:since: 2008-12-21
:change: 2010-05-02 eliminate newlines that came before and after table
:change: 2010-05-06 add `label_cells` to `SimpleTable`
é    )ÚlmapÚlrange)ÚcycleÚzip_longestNc                 óì  ‡— t        «       }t        | d¬«      5 }t        j                  |«      }|du rt	        |«      }n|du rd}|du r=t        «       }|D ]-  }|sŒ|j                  |d   «       |j                  |dd «       Œ/ n|D ]  }|sŒ|j                  |«       Œ |du rd}ddd«       t        |d   «      Št        ˆfd	„|D «       «      rt        d
«      ‚t        |||¬«      S # 1 sw Y   ŒDxY w)a%  Return SimpleTable instance,
    created from the data in `csvfile`,
    which is in comma separated values format.
    The first row may contain headers: set headers=True.
    The first column may contain stubs: set stubs=True.
    Can also supply headers and stubs as tuples of strings.
    zutf-8)ÚencodingTF© r   é   Nc              3   ó:   •K  — | ]  }t        |«      ‰k7  –— Œ y ­w©N©Úlen)Ú.0ÚrowÚncolss     €ú[C:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\statsmodels/iolib/table.pyú	<genexpr>zcsv2st.<locals>.<genexpr>w   s   øè ø€ Ò
- Œ3ˆs‹8�uÕÑ
-ùs   ƒz+All rows of CSV file must have same length.)ÚdataÚheadersÚstubs)
ÚlistÚopenÚcsvÚreaderÚnextÚappendr   ÚanyÚOSErrorÚSimpleTable)	Úcsvfiler   r   ÚtitleÚrowsÚfhr   r   r   s	           @r   Úcsv2str$   [   sÿ   ø€ ô ‹6€DÜ	ˆg Ô	(ð ¨BÜ—‘˜B“ˆØ�d‰?Ü˜6“l‰GØ˜ÑØˆGØ�D‰=Ü“FˆEØò )�ÚØ—L‘L  Q¡Ô(Ø—K‘K  A B Õ(ñ)ð
 ò %�ÚØ—K‘K Õ$ð%ð �E‰>ØˆE÷#ô$ ��Q‘‹L€EÜ
Ó
-¨Ô
-Ô-ÜÐCÓDÐDÜ˜D¨'¸Ô?Ð?÷+ð ús   ™AC*Á2C*ÂC*Ã*C3c                   ó¨   — e Zd ZdZ	 	 	 dd„Zd„ Zd„ Zd„ Zdd„Zd„ Z	dd	„Z
dd
„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Zed„ «       Zy)r   a  Produce a simple ASCII, CSV, HTML, or LaTeX table from a
    *rectangular* (2d!) array of data, not necessarily numerical.
    Directly supports at most one header row,
    which should be the length of data[0].
    Directly supports at most one stubs column,
    which must be the length of data.
    (But see `insert_stubs` method.)
    See globals `default_txt_fmt`, `default_csv_fmt`, `default_html_fmt`,
    and `default_latex_fmt` for formatting options.

    Sample uses::

        mydata = [[11,12],[21,22]]  # data MUST be 2-dimensional
        myheaders = [ "Column 1", "Column 2" ]
        mystubs = [ "Row 1", "Row 2" ]
        tbl = text.SimpleTable(mydata, myheaders, mystubs, title="Title")
        print( tbl )
        print( tbl.as_html() )
        # set column specific data formatting
        tbl = text.SimpleTable(mydata, myheaders, mystubs,
            data_fmts=["%3.2f","%d"])
        print( tbl.as_csv() )
        with open('c:/temp/temp.tex','w') as fh:
            fh.write( tbl.as_latex_tabular() )
    Nc                 ó¬  — || _         || _        | j                  €,t        |«      dk(  rg nt        t        |d   «      «      | _        t        j                  «       | _        t        j                  «       | _        t        j                  «       | _
        t        j                  «       | _        | j                  j                  |«       | j                  j                  |«       | j                  j                  |«       | j                  j                  |«       | j                  j                  |xs
 t        «       «       | j                  j                  |xs
 t        «       «       | j                  j                  |xs
 t        «       «       | j                  j                  |	xs
 t        «       «       t        | j                  | j                  | j                  | j                  ¬«      | _        |
xs t         | _        |xs t$        | _        | j)                  |«      }t*        j-                  | |«       | j/                  ||«       t        «       | _        y)a�  
        Parameters
        ----------
        data : list of lists or 2d array (not matrix!)
            R rows by K columns of table elements
        headers : list (or tuple) of str
            sequence of K strings, one per header
        stubs : list (or tuple) of str
            sequence of R strings, one per stub
        title : str
            title of the table
        datatypes : list of int
            indexes to `data_fmts`
        txt_fmt : dict
            text formatting options
        ltx_fmt : dict
            latex formatting options
        csv_fmt : dict
            csv formatting options
        hmtl_fmt : dict
            hmtl formatting options
        celltype : class
            the cell class for the table (default: Cell)
        rowtype : class
            the row class for the table (default: Row)
        fmt_dict : dict
            general formatting options
        Nr   )Útxtr   ÚhtmlÚlatex)r!   Ú
_datatypesr   r   Údefault_txt_fmtÚcopyÚ_txt_fmtÚdefault_latex_fmtÚ
_latex_fmtÚdefault_csv_fmtÚ_csv_fmtÚdefault_html_fmtÚ	_html_fmtÚupdateÚdictÚoutput_formatsÚCellÚ_CellÚRowÚ_RowÚ
_data2rowsr   Ú__init__Ú_add_headers_stubsÚ
_colwidths)Úselfr   r   r   r!   Ú	datatypesÚcsv_fmtÚtxt_fmtÚltx_fmtÚhtml_fmtÚcelltypeÚrowtypeÚfmt_dictr"   s                 r   r<   zSimpleTable.__init__–   s¡  € ð> ˆŒ
Ø#ˆŒØ�?‰?Ð"Ü$'¨£I°¢N™b¼¼sÀ4ÈÁ7»|Ó8LˆDŒOä'×,Ñ,Ó.ˆŒÜ+×0Ñ0Ó2ˆŒÜ'×,Ñ,Ó.ˆŒÜ)×.Ñ.Ó0ˆŒð 	�‰×Ñ˜XÔ&Ø�‰×Ñ˜XÔ&Ø�‰×Ñ˜xÔ(Ø�‰×Ñ˜hÔ'à�‰×Ñ˜WÒ.¬«Ô/Ø�‰×Ñ˜WÒ.¬«Ô/Ø�‰×Ñ˜wÒ0¬$«&Ô1Ø�‰×Ñ˜hÒ0¬$«&Ô1Ü"Ø—‘Ø—‘Ø—‘Ø—/‘/ô	
ˆÔð Ò%¤ˆŒ
Ø’NœsˆŒ	Ø�‰˜tÓ$ˆÜ�‰�d˜DÔ!Ø×Ñ ¨Ô/Ü›&ˆ�ó    c                 ó"   — | j                  «       S r   )Úas_text©r?   s    r   Ú__str__zSimpleTable.__str__Ö   s   € Ø�|‰|‹~ÐrH   c                 ó*   — t        t        | «      «      S r   )ÚstrÚtyperK   s    r   Ú__repr__zSimpleTable.__repr__Ù   s   € Ü”4˜“:‹ÐrH   c                 ó&   —  | j                   di |¤ŽS )Nr	   )Úas_html)r?   rG   s     r   Ú_repr_html_zSimpleTable._repr_html_Ü   s   € Øˆt�|‰|Ñ'˜hÑ'Ð'rH   c                 ó(   —  | j                   |fi |¤ŽS r   )Úas_latex_tabular)r?   ÚcenterrG   s      r   Ú_repr_latex_zSimpleTable._repr_latex_ß   s   € Ø$ˆt×$Ñ$ VÑ8¨xÑ8Ð8rH   c                 óZ   — |r| j                  d|d¬«       |r| j                  d|«       yy)ak  Return None.  Adds headers and stubs to table,
        if these were provided at initialization.
        Parameters
        ----------
        headers : list[str]
            K strings, where K is number of columns
        stubs : list[str]
            R strings, where R is number of non-header rows

        :note: a header row does not receive a stub!
        r   Úheader_dec_below)Ú	dec_belowN)Úinsert_header_rowÚinsert_stubs)r?   r   r   s      r   r=   zSimpleTable._add_headers_stubsâ   s5   € ñ Ø×"Ñ" 1 gÐ9KÐ"ÔLÙØ×Ñ˜a Õ'ð rH   c                 ó–   — |€	 |j                   }| j                  ||| ¬«      }t        j	                  | ||«       y# t        $ r Y Œ7w xY w)z1Return None.  Insert a row into a table.
        N)ÚdatatypeÚtable)r^   ÚAttributeErrorr:   r   Úinsert)r?   Úidxr   r^   s       r   ra   zSimpleTable.insertó   sR   € ð ÐðØŸ<™<�ð �i‰i˜ h°dˆiÓ;ˆÜ�‰�D˜#˜sÕ#øô "ò Ùðús   „< ¼	AÁAc           	      ó(  — |D �cg c]  }|j                  d«      ‘Œ }}t        t        |i t        d¬«      ¤Ž«      }|j	                  «        t        |«      D ]3  \  }}| j                  ||d¬«       |dk(  r|| |   _        Œ*d| |   _        Œ5 yc c}w )z¯Return None.  Insert a row of headers,
        where ``headers`` is a sequence of strings.
        (The strings may contain newlines, to indicated multiline headers.)
        ú
Ú )Ú	fillvalueÚheader©r^   r   N)Úsplitr   r   r5   ÚreverseÚ	enumeratera   rZ   )	r?   Úrownumr   rZ   rg   Úheader_rowsr"   Úir   s	            r   r[   zSimpleTable.insert_header_rowþ   s‘   € ð
 9@Ö@¨f�v—|‘| DÕ)Ð@ˆÐ@ä”K ÐC´¸rÔ0BÑCÓDˆØ�‰ŒÜ “oò 	.‰FˆAˆsØ�K‰K˜ ¨hˆKÔ7Ø�AŠvØ)2��V‘Õ&à)-��V‘Õ&ñ	.ùò	 As   …Bc                 ó   — | j                   }t        |«      }| D ]J  }|j                  dk(  r |dd¬«      }|j                  ||«       Œ/	 |j	                  |t        |«      «       ŒL y# t        $ r t        d«      ‚w xY w)z½Return None.  Insert column of stubs at column `loc`.
        If there is a header row, it gets an empty cell.
        So ``len(stubs)`` should equal the number of non-header rows.
        rg   re   Úemptyrh   z'length of stubs must match table lengthN)r8   Úiterr^   ra   Úinsert_stubr   ÚStopIterationÚ
ValueError)r?   Úlocr   r8   r   Ú
empty_cells         r   r\   zSimpleTable.insert_stubs  s„   € ð
 —
‘
ˆÜ�U“ˆØò 	PˆCØ�|‰|˜xÒ'Ù" 2°Ô8�
Ø—
‘
˜3 
Õ+ðPØ—O‘O C¬¨e«Õ5ñ	Pøô %ò PÜ$Ð%NÓOÐOðPús   Á
A(Á(A=c                 óè   — | j                   }| j                  }g }|D ]R  }t        | j                  «      } ||d| |¬«      }|D ]  }t	        |«      |_        ||_        Œ |j                  |«       ŒT |S )zCReturn list of Row,
        the raw data as rows of cells.
        r   )r^   r_   rE   )r8   r:   r   r*   r   r^   r   r   )	r?   Úraw_datar8   r:   r"   ÚdatarowÚdtypesÚnewrowÚcells	            r   r;   zSimpleTable._data2rows  s~   € ð
 —
‘
ˆØ�y‰yˆØˆØò 	 ˆGÜ˜4Ÿ?™?Ó+ˆFÙ˜'¨F¸$ÈÔOˆFØò "�Ü $ V£�”Ø!�•ð"ð �K‰K˜Õð	 ð ˆrH   c                 ó   — t        |||«      S )z%DEPRECATED: just use the pad function)Úpad)r?   ÚsÚwidthÚaligns       r   r~   zSimpleTable.pad1  s   € ä�1�e˜UÓ#Ð#rH   c                 ó  ‡‡
— t        ‰«      Š| j                  ‰   j                  «       Š
‰
j                  |«       t	        d„ | D «       «      }‰
j                  d«      }|dk(  rdg|z  S |€dg|z  }nLt        |t        «      r|g|z  }n5t        |«      |k  r't        |«      D �cg c]  }||t        |«      z     ‘Œ }}g }t        | Ž D ](  }t	        ˆ
ˆfd„|D «       «      }|j                  |«       Œ* t        t        ||«      }	|	S c c}w )z2Return list, the calculated widths of each column.c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   r   )r   r   s     r   r   z-SimpleTable._get_colwidths.<locals>.<genexpr>:  s   è ø€ Ò- ”C˜—HÑ-ùs   ‚Ú	colwidthsr   c              3   óX   •K  — | ]!  }t         |j                  d ‰fi ‰¤Ž«      –— Œ# y­w)r   N)r   Úformat)r   ÚcÚfmtÚoutput_formats     €€r   r   z-SimpleTable._get_colwidths.<locals>.<genexpr>F  s(   øè ø€ ÒOÀaœ3˜x˜qŸx™x¨¨=Ñ@¸CÑ@×AÑOùs   ƒ'*)Úget_output_formatr6   r,   r4   ÚmaxÚgetÚ
isinstanceÚintr   ÚrangeÚzipr   r   )r?   r‰   rG   r   Úrequestrn   Ú
min_widthsÚcolÚmaxwidthÚresultrˆ   s    `        @r   Ú_get_colwidthszSimpleTable._get_colwidths5  s  ù€ ä)¨-Ó8ˆØ×!Ñ! -Ñ0×5Ñ5Ó7ˆØ�
‰
�8ÔÜÑ-¨Ô-Ó-ˆØ—'‘'˜+Ó&ˆØ�aŠ<Ø�3˜‘;ÐØˆ_Ø�c˜E‘k‰GÜ˜¤Ô%Ø�i %Ñ'‰GÜ�‹\˜EÒ!Ü:?À»,ÖG°Q�w˜q¤3 w£<Ñ/Ó0ÐGˆGÐGØˆ
Ü˜�:ò 	(ˆCÜÔOÈ3ÔOÓOˆHØ×Ñ˜hÕ'ð	(ô ”c˜: wÓ/ˆØˆùò Hs   Â%Dc           
      ó  — |g}t        |j                  «       «      D ]‰  \  }}t        |t        «      r|j	                  |t        |«      f«       Œ3t        |t        «      r4|j	                  |t        t        |j                  «       «      «      f«       Œw|j	                  ||f«       Œ‹ t        |«      }	 | j                  |   S # t        $ r2  | j                  |fi |¤Ž| j                  |<   | j                  |   cY S w xY w)z'Return list, the widths of each column.)
ÚsortedÚitemsr�   r   r   Útupler5   r>   ÚKeyErrorr–   )r?   r‰   rG   Ú	call_argsÚkÚvÚkeys          r   Úget_colwidthszSimpleTable.get_colwidthsK  sì   € à"�Oˆ	Ü˜8Ÿ>™>Ó+Ó,ò 	)‰DˆAˆqÜ˜!œTÔ"Ø× Ñ  !¤U¨1£X Õ/Ü˜AœtÔ$Ø× Ñ  !¤U¬6°!·'±'³)Ó+<Ó%=Ð!>Õ?à× Ñ  ! Q Õ(ð	)ô �IÓˆð	(Ø—?‘? 3Ñ'Ð'øÜò 	(Ø#6 4×#6Ñ#6°}ñ $CØ9Añ$CˆD�O‰O˜CÑ à—?‘? 3Ñ'Ò'ð	(ús   Â5C Ã8C?Ã>C?c                 ó°   — t        |«      }	 | j                  |   j                  «       }|j                  |«       |S # t        $ r t	        d|z  «      ‚w xY w©ú-Return dict, the formatting options.
        úUnknown format: %s)rŠ   r6   r,   r›   rt   r4   ©r?   r‰   rG   rˆ   s       r   Ú_get_fmtzSimpleTable._get_fmt]  sd   € ô *¨-Ó8ˆð	CØ×%Ñ% mÑ4×9Ñ9Ó;ˆCð 	�
‰
�8ÔØˆ
øô	 ò 	CÜÐ1°MÑAÓBÐBð	Cús	   �= ½Ac                 óJ   —  | j                   di |¤Ž} | j                  di |¤ŽS )zXReturn string, the table in CSV format.
        Currently only supports comma separator.)r   r	   )r¦   rJ   )r?   rG   rˆ   s      r   Úas_csvzSimpleTable.as_csvj  s+   € ð ˆd�m‰mÑ. XÑ.ˆØˆt�|‰|Ñ"˜cÑ"Ð"rH   c                 óÜ  —  | j                   d
i |¤Ž}| D �cg c]  } |j                  di |¤Ž‘Œ }}t        |d   «      }|j                  dd«      }|r|j	                  d||z  «       | j
                  }|r9t        | j
                  ||j                  dd«      «      }|j	                  d|«       |j                  dd«      }|r|j                  ||z  «       d	j                  |«      S c c}w )z!Return string, the table as text.éÿÿÿÿÚtable_dec_aboveú=r   Útitle_alignr‡   Útable_dec_belowú-rd   ©r'   )Útext)	r¦   Ú	as_stringr   rŒ   ra   r!   r~   r   Újoin)	r?   rG   rˆ   r   Úformatted_rowsÚrowlenr«   r!   r®   s	            r   rJ   zSimpleTable.as_textq  sé   € ð ˆd�m‰mÑ. XÑ.ˆàBFÖG¸3˜-˜#Ÿ-™-Ñ6°#Ó6ÐGˆÐGÜ�^ BÑ'Ó(ˆð Ÿ'™'Ð"3°SÓ9ˆÙØ×!Ñ! ! _°vÑ%=Ô>ð —
‘
ˆÙÜ˜Ÿ
™
 F¨C¯G©G°MÀ3Ó,GÓHˆEØ×!Ñ! ! UÔ+àŸ'™'Ð"3°SÓ9ˆÙØ×!Ñ! /°FÑ":Ô;Ø�y‰y˜Ó(Ð(ùò# Hs   —C)c                 óþ   ‡—  | j                   di |¤ŽŠdg}| j                  r d| j                  z  }|j                  |«       |j                  ˆfd„| D «       «       |j                  d«       dj	                  |«      S )z°Return string.
        This is the default formatter for HTML tables.
        An HTML table formatter must accept as arguments
        a table and a format dictionary.
        z<table class="simpletable">z<caption>%s</caption>c              3   óB   •K  — | ]  } |j                   di ‰¤Ž–— Œ y­w)r(   N©r(   )r²   )r   r   rˆ   s     €r   r   z&SimpleTable.as_html.<locals>.<genexpr>•  s   øè ø€ ÒK¸s˜m˜cŸm™mÑ:°cÕ:ÑKùs   ƒz</table>rd   r¸   )r¦   r!   r   Úextendr³   )r?   rG   r´   r!   rˆ   s       @r   rR   zSimpleTable.as_html‰  st   ø€ ð ˆd�m‰mÑ/ hÑ/ˆØ7Ð8ˆØ�:Š:Ø+¨d¯j©jÑ8ˆEØ×!Ñ! %Ô(Ø×ÑÓKÀdÔKÔKØ×Ñ˜jÔ)Ø�y‰y˜Ó(Ð(rH   c                 ó~  —  | j                   di |¤Ž}g }|r|j                  d«       |d   xs d}|d   xs d}d}d}| |gz   D ]˜  }	|	|k(  rd}
n |	j                  di |¤Ž}
|
|k7  rM|r"|j                  |«       |j                  d«       |
r'|j                  d|
z  «       |s|j                  |«       |	|k7  r#|j                   |	j                  dd	di|¤Ž«       |
}Œš | j                  r d
| j                  z  }|j                  |«       |r|j                  d«       dj                  |«      j                  dd«      S )ziReturn string, the table as a LaTeX tabular environment.
        Note: will require the booktabs package.r)   z\begin{center}r«   re   r®   Nz\end{tabular}z\begin{tabular}{%s}r‰   z%%\caption{%s}z\end{center}rd   z$$ú )r)   r	   )r¦   r   Ú
get_alignsr²   r!   r³   Úreplace)r?   rV   rG   rˆ   r´   r«   r®   Úprev_alignsÚlastr   Úalignsr!   s               r   rU   zSimpleTable.as_latex_tabular™  sa  € ð ˆd�m‰mÑ0 xÑ0ˆàˆÙØ×!Ñ!Ð"3Ô4àÐ/Ñ0Ò6°BˆØÐ/Ñ0Ò6°BˆàˆØˆØ˜4˜&‘=ò 	!ˆCØ�dŠ{Ø‘à'˜Ÿ™Ñ7°3Ñ7�à˜Ò$áà"×)Ñ)¨/Ô:Ø"×)Ñ)Ð*:Ô;Ùà"×)Ñ)Ð*@À6Ñ*IÔJÙ&à&×-Ñ-¨oÔ>Ø�dŠ{Ø×%Ñ%Ø!�C—M‘MÑ?°Ð?¸3Ñ?ôAà ‰Kð+	!ð0 �:Š:Ø%¨¯
©
Ñ2ˆEØ×!Ñ! %Ô(ÙØ×!Ñ! /Ô2ð �y‰y˜Ó(×0Ñ0°°sÓ;Ð;rH   c                 óN   — t        | |«      D ]  \  }}|j                  |«       Œ y)aö  Return None.
        Extend each row of `self` with corresponding row of `table`.
        Does **not** import formatting from ``table``.
        This generally makes sense only if the two tables have
        the same number of rows, but that is not enforced.
        :note: To extend append a table below, just use `extend`,
        which is the ordinary list method.  This generally makes sense
        only if the two tables have the same number of columns,
        but that is not enforced.
        N)r�   r¹   )r?   r_   Úrow1Úrow2s       r   Úextend_rightzSimpleTable.extend_rightÉ  s*   € ô ˜d EÓ*ò 	‰JˆD�$Ø�K‰K˜Õñ	rH   c                 óD   — | D ]  }|D ]  } ||«      }|€Œ||_         Œ Œ y)z§Return None.  Labels cells based on `func`.
        If ``func(cell) is None`` then its datatype is
        not changed; otherwise it is set to ``func(cell)``.
        Nrh   )r?   Úfuncr   r|   Úlabels        r   Úlabel_cellszSimpleTable.label_cells×  s8   € ð
 ò 	*ˆCØò *�Ù˜T›
�ØÑ$Ø$)�D•Mñ*ñ	*rH   c                 ó@   — | D �cg c]  }|j                   ‘Œ c}S c c}w r   ©r   )r?   r   s     r   r   zSimpleTable.dataâ  s   € à$(Ö)˜S�—“Ò)Ð)ùÒ)ó   …)
NNre   NNNNNNN)Tr   )rY   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r<   rL   rP   rS   rW   r=   ra   r[   r\   r;   r~   r–   r    r¦   r¨   rJ   rR   rU   rÄ   rÈ   Úpropertyr   r	   rH   r   r   r   |   sŽ   „ ñð2 >@ØEIØ7;ó>!ò@òò(ó9ò(ó"	$ó.ò Pò"ò$$òò,(ò$ò#ò)ò0)ó .<ò`ò	*ð ñ*ó ñ*rH   r   c                 óˆ   — |dk(  r| j                  |«      } | S |dk(  r| j                  |«      } | S | j                  |«      } | S )zCReturn string padded with spaces,
    based on alignment parameter.ÚlÚr)ÚljustÚrjustrV   )r   r€   r�   s      r   r~   r~   ç  sP   € ð �‚|Ø�G‰G�E‹Nˆð
 €Hð	 
�#ŠØ�G‰G�E‹Nˆð €Hð �H‰H�U‹OˆØ€HrH   c                   óR   — e Zd ZdZ	 	 dd„Zd„ Zd„ Zd„ Zd„ Zdd„Z	d	„ Z
ed
„ «       Zy)r9   zjProvides a table row as a list of cells.
    A row can belong to a SimpleTable, but does not have to.
    Nc                 óÚ   ‡ ‡— |‰ _         |‰ _        ‰€|€t        Šn|j                  Š‰‰ _        |‰ _        t        «       ‰ _        |‰ _        t        j                  ‰ ˆˆ fd„|D «       «       y)aw  
        Parameters
        ----------
        seq : sequence of data or cells
        table : SimpleTable
        datatype : str ('data' or 'header')
        dec_below : str
          (e.g., 'header_dec_below' or 'row_dec_below')
          decoration tag, identifies the decoration to go below the row.
          (Decoration is repeated as needed for text formats.)
        Nc              3   ó2   •K  — | ]  } ‰|‰¬ «      –— Œ y­w))r   Nr	   )r   r|   rE   r?   s     €€r   r   zRow.__init__.<locals>.<genexpr>  s   øè ø€ ÒF¸$™X d°×5Ð5ÑFùs   ƒ)
r^   r_   r7   r8   Ú_fmtr5   Úspecial_fmtsrZ   r   r<   )r?   Úseqr^   r_   rE   rZ   rG   s   `   `  r   r<   zRow.__init__÷  s_   ù€ ð !ˆŒØˆŒ
ØÐØˆ}Ü‘à Ÿ;™;�ØˆŒ
ØˆŒ	Ü ›FˆÔØ"ˆŒÜ�‰�dÔFÀ#ÔFÕGrH   c                 ó    — t        |«      }|| j                  vrt        «       | j                  |<   | j                  |   j                  |«       y)zª
        Return None. Adds row-instance specific formatting
        for the specified output format.
        Example: myrow.add_format('txt', row_dec_below='+-')
        N)rŠ   rÚ   r5   r4   )r?   r‰   rG   s      r   Ú
add_formatzRow.add_format  sG   € ô *¨-Ó8ˆØ × 1Ñ 1Ñ1Ü/3«vˆD×Ñ˜mÑ,Ø×Ñ˜-Ñ(×/Ñ/°Õ9rH   c                 ór   — | j                   }t        ||«      s|} ||d| ¬«      }| j                  ||«       y)zGReturn None.  Inserts a stub cell
        in the row at `loc`.
        Ústub)r^   r   N)r8   r�   ra   )r?   ru   rß   r8   s       r   rr   zRow.insert_stub  s8   € ð —
‘
ˆÜ˜$ Ô&ØˆDÙ˜¨°DÔ9ˆDØ�‰�C˜ÕrH   c                 ó¨  — t        |«      }	 t        |   j                  «       }	 |j                  | j                  j                  |   «       |j                  | j                  «       |j                  |«       | j                  j                  |d«      }|�|j                  |«       |S # t        $ r t	        d|z  «      ‚w xY w# t        $ r Y Œƒw xY w)r£   r¤   N)rŠ   Údefault_fmtsr,   r›   rt   r4   r_   r6   r`   rÙ   rÚ   rŒ   )r?   r‰   rG   rˆ   Úspecial_fmts        r   r¦   zRow._get_fmt&  sË   € ô *¨-Ó8ˆð	CÜ˜}Ñ-×2Ñ2Ó4ˆCð	Ø�J‰J�t—z‘z×0Ñ0°Ñ?Ô@ð 	�
‰
�4—9‘9ÔØ�
‰
�8ÔØ×'Ñ'×+Ñ+¨M¸4Ó@ˆØÐ"Ø�J‰J�{Ô#Øˆ
øô ò 	CÜÐ1°MÑAÓBÐBð	Cûô
 ò 	Ùð	ús   �B* ¥(C Â*CÃ	CÃCc                 ób   ‡‡—  | j                   ‰fi |¤ŽŠdj                  ˆˆfd„| D «       «      S )zcReturn string, sequence of column alignments.
        Ensure comformable data_aligns in `fmt_dict`.re   c              3   óD   •K  — | ]  } |j                   ‰fi ‰¤Ž–— Œ y ­wr   )Ú	alignment)r   r|   rˆ   r‰   s     €€r   r   z!Row.get_aligns.<locals>.<genexpr>@  s!   øè ø€ ÒMÀ�~�t—~‘~ mÑ;°sÕ;ÑMùs   ƒ )r¦   r³   r¥   s    ` @r   r¼   zRow.get_aligns<  s/   ù€ ð ˆd�m‰m˜MÑ6¨XÑ6ˆØ�w‰wÔMÈÔMÓMÐMrH   c                 óè  —  | j                   |fi |¤Ž}	  | j                  j                  |fi |¤Ž}|€dt        | «      z  }|d   }|j	                  dd«      }|j	                  dd«      }g }t        | |«      D ]+  \  }	}
 |	j                  |
fd|i|¤Ž}|j                  |«       Œ- ||j                  |«      z   |z   } | j                  ||fi |¤Ž}|S # t        $ r |j	                  d«      }Y Œ¾w xY w)a  Return string: the formatted row.
        This is the default formatter for rows.
        Override this to get different formatting.
        A row formatter must accept as arguments
        a row (self) and an output format,
        one of ('html', 'txt', 'csv', 'latex').
        r„   )r   ÚcolsepÚrow_prere   Úrow_postr‰   )r¦   r_   r    r`   rŒ   r   r�   r†   r   r³   Ú_decorate_below)r?   r‰   rG   rˆ   r„   rç   rè   ré   Úformatted_cellsr|   r€   ÚcontentÚformatted_rows                r   r²   zRow.as_stringB  s  € ð ˆd�m‰m˜MÑ6¨XÑ6ˆð	-Ø0˜Ÿ
™
×0Ñ0°ÑFÀ#ÑFˆIð ÐØœs 4›yÑ(ˆIà�X‘ˆØ—'‘'˜) RÓ(ˆØ—7‘7˜: rÓ*ˆØˆÜ˜t YÓ/ò 	,‰KˆD�%Ø!�d—k‘k %ÑL°}ÐLÈÑLˆGØ×"Ñ" 7Õ+ð	,ð   &§+¡+¨oÓ">Ñ>ÀÑIˆØ,˜×,Ñ,¨]¸Mñ 4Ø/2ñ4ˆàÐøô ò 	-ØŸ™ Ó,ŠIð	-ús   •C ÃC1Ã0C1c                 ó  — |j                  | j                  d«      }|€|}|S t        |«      }|dk(  r8t        |«      }t        |«      }t	        ||«      \  }}	|dz   ||z  |d|	 z   z   }|S |dk(  r
|dz   |z   }|S t        d|z  «      ‚)zLThis really only makes sense for the text and latex output formats.
        Nr'   rd   r)   zI cannot decorate a %s header.)rŒ   rZ   rŠ   r   Údivmodrt   )
r?   Úrow_as_stringr‰   rG   rZ   r•   Úrow0lenÚdec_lenÚrepeatÚaddons
             r   rê   zRow._decorate_below`  sÉ   € ð —L‘L §¡°Ó6ˆ	ØÐØ"ˆFð ˆô .¨mÓ<ˆMØ Ò%Ü˜mÓ,�Ü˜i›.�Ü & w°Ó 8‘�˜Ø&¨Ñ-°¸VÑ1CØ1:¸6¸EÐ1Bñ2Cñ D�ð ˆð  'Ò)Ø&¨Ñ-°	Ñ9�ð ˆô !Ð!AØ!.ñ"/ó 0ð 0rH   c                 ó@   — | D �cg c]  }|j                   ‘Œ c}S c c}w r   rÊ   )r?   r|   s     r   r   zRow.datau  s   € à&*Ö+˜d�—	“	Ò+Ð+ùÒ+rË   )r   NNÚrow_dec_belowr°   )rÌ   rÍ   rÎ   rÏ   r<   rÝ   rr   r¦   r¼   r²   rê   rÐ   r   r	   rH   r   r9   r9   ó  sJ   „ ñð CGØ*óHò4	:òòò,Nóò<ð* ñ,ó ñ,rH   r9   c                   ó`   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zed„ «       Z	dd„Z
d	„ Zd
„ Z eee«      Zy)r7   zQProvides a table cell.
    A cell can belong to a Row, but does not have to.
    Nc                 ó
  — t        |t        «      r4|j                  | _        |j                  | _        |j
                  | _        n|| _        || _        t        «       | _        | j
                  j                  |«       || _        y r   )	r�   r7   r   r^   Ú	_datatyperÙ   r5   r4   r   )r?   r   r^   r   rG   s        r   r<   zCell.__init__~  s]   € Ü�dœDÔ!àŸ	™	ˆDŒIØ!Ÿ]™]ˆDŒNØŸ	™	ˆD�IàˆDŒIØ%ˆDŒNÜ›ˆDŒIØ�	‰	×Ñ˜Ô"Øˆ�rH   c                 ó    — d| j                   z  S )Nú%srÊ   rK   s    r   rL   zCell.__str__‹  s   € Ø�d—i‘iÑÐrH   c                 óÈ  — t        |«      }	 t        |   j                  «       }	 |j                  | j                  j                  j                  |   «       	 |j                  | j                  j                  «       |j                  | j                  «       |j                  |«       |S # t        $ r t	        d|z  «      ‚w xY w# t        $ r Y Œzw xY w# t        $ r Y Œcw xY wr¢   )rŠ   rá   r,   r›   rt   r4   r   r_   r6   r`   rÙ   r¥   s       r   r¦   zCell._get_fmtŽ  sÑ   € ô *¨-Ó8ˆð	CÜ˜}Ñ-×2Ñ2Ó4ˆCð	Ø�J‰J�t—x‘x—~‘~×4Ñ4°]ÑCÔDð	Ø�J‰J�t—x‘x—}‘}Ô%ð 	�
‰
�4—9‘9ÔØ�
‰
�8ÔØˆ
øô ò 	CÜÐ1°MÑAÓBÐBð	Cûô
 ò 	Ùð	ûô
 ò 	Ùð	ús.   �B+ ¥2C Á%C Â+CÃ	CÃCÃ	C!Ã C!c                 óX  —  | j                   |fi |¤Ž}| j                  }|j                  dd«      }t        |t        «      r||t        |«      z     }|S |dk(  r'|j                  d«      xs |j                  dd«      }|S ||v rd|z  }|j                  |d«      }|S t        d|z  «      ‚)	NÚdata_alignsr‡   rß   Ústubs_alignÚ
stub_alignrÒ   z%s_alignúUnknown cell datatype: %s)r¦   r^   rŒ   r�   rŽ   r   rt   )r?   r‰   rG   rˆ   r^   rþ   r�   Úlabel_aligns           r   rå   zCell.alignment¦  sÁ   € Øˆd�m‰m˜MÑ6¨XÑ6ˆØ—=‘=ˆØ—g‘g˜m¨SÓ1ˆÜ�h¤Ô$Ø ¬3¨{Ó+;Ñ ;Ñ<ˆEð ˆð ˜Òà—G‘G˜MÓ*ÒH¨c¯g©g°lÀCÓ.HˆEð ˆð ˜‰_Ø$ xÑ/ˆKØ—G‘G˜K¨Ó-ˆEð ˆô Ð8¸8ÑCÓDÐDrH   c                 ó’   — |dk7  r| S d|v r;t        | t        «      r+t        |d   «      D ]  }| j                  ||d   |   «      } Œ | S )Nr)   Úreplacements)r�   rN   r˜   r½   )r   rˆ   r‰   Úrepls       r   Ú_latex_escapezCell._latex_escape¶  s[   € à˜GÒ#ØˆKØ˜SÑ Ü˜$¤Ô$Ü" 3 ~Ñ#6Ó7ò I�DØŸ<™<¨¨c°.Ñ.AÀ$Ñ.GÓH‘DðIàˆrH   c                 óp  —  | j                   |fi |¤Ž}| j                  }| j                  }|j                  d«      }|€|j                  d«      }|€d}|g}t	        |t
        «      rb|t        |«      z  }||   }t	        |t        «      r||fz  }	nt        |«      r	 ||«      }	nt        d«      ‚|dk(  rR| j                  |	||«      }	n>||v r,| j                  |||«      }|j                  |«      }
	 |
|fz  }	nt        d|z  «      ‚ | j                  |fi |¤Ž}t        |	||«      S # t        $ r |
}	Y Œ-w xY w)ac  Return string.
        This is the default formatter for cells.
        Override this to get different formating.
        A cell formatter must accept as arguments
        a cell (self) and an output format,
        one of ('html', 'txt', 'csv', 'latex').
        It will generally respond to the datatype,
        one of (int, 'header', 'stub').
        Ú	data_fmtsÚdata_fmtrû   zMust be a string or a callabler   r  )r¦   r   r^   rŒ   r�   rŽ   r   rN   ÚcallableÚ	TypeErrorr  rt   rå   r~   )r?   r€   r‰   rG   rˆ   r   r^   r  r	  rì   Údfmtr�   s               r   r†   zCell.formatÀ  sU  € ð ˆd�m‰m˜MÑ6¨XÑ6ˆà�y‰yˆØ—=‘=ˆØ—G‘G˜KÓ(ˆ	ØÐà—w‘w˜zÓ*ˆHØÐØ�Ø!˜
ˆIÜ�h¤Ô$Ø¤# i£.Ñ0ˆHØ  Ñ*ˆHÜ˜(¤CÔ(Ø" d WÑ,‘Ü˜(Ô#Ù" 4›.‘äÐ @ÓAÐAØ˜1Š}Ø×,Ñ,¨W°c¸=ÓI‘Ø˜‰_Ø×%Ñ% d¨C°Ó?ˆDà—7‘7˜8Ó$ˆDðØ $ ™.‘ô Ð8¸8ÑCÓDÐDØ�—‘˜}Ñ4°Ñ4ˆÜ�7˜E 5Ó)Ð)øô ò Ø’ðús   Ã2D' Ä'D5Ä4D5c                 óf   — | j                   €| j                  j                  }|S | j                   }|S r   )rù   r   r^   )r?   Údtypes     r   Úget_datatypezCell.get_datatypeí  s2   € Ø�>‰>Ð!Ø—H‘H×%Ñ%ˆEð ˆð —N‘NˆEØˆrH   c                 ó   — || _         y r   )rù   )r?   Úvals     r   Úset_datatypezCell.set_datatypeô  s	   € àˆ�rH   )re   NNr°   )rÌ   rÍ   rÎ   rÏ   r<   rL   r¦   rå   Ústaticmethodr  r†   r  r  rÐ   r^   r	   rH   r   r7   r7   z  sM   „ ñóò òò0ð  ñó ðó+*òZòñ ˜ lÓ3�HrH   r7   rˆ   r'   r«   r¬   r®   r¯   r­   r‡   rè   re   ré   rY   rö   r„   rç   r»   rþ   rÓ   r  rû   r   rÒ   Úheader_alignÚ
header_fmtÚstub_fmtrg   rß   rv   rp   Úmissingz--r   ú,r	  z"%s"z<tr>
  z
</tr>z<td>%s</td>z<th>%s</th>z	<td></td>z<td>--</td>Últxz\toprulez\bottomrulez\midruleÚstrip_backslashTz  \\z & Úempty_alignz\textbf{%s}r  z\#z\$z\%z\&z$>$z\_z$|$)ú#ú$ú%ú&ú>Ú_ú|©r(   r'   r)   r   r(   r)   )Úhtmr±   r  c                 ó\   — | dvr	 t         |    } | S | S # t        $ r t        d| z  «      ‚w xY w)Nr#  zunknown output format %s)Úoutput_format_translationsr›   rt   )r‰   s    r   rŠ   rŠ   ™  sL   € ØÐ;Ñ;ð	IÜ6°}ÑEˆMð Ðˆ=Ðøô ò 	IÜÐ7¸-ÑGÓHÐHð	Iús   †	 “+)FFNr	   )rÏ   Ústatsmodels.compat.pythonr   r   Ú	itertoolsr   r   r   r$   r   r   r~   r9   r7   r5   r+   r0   r2   r.   rá   r&  rŠ   r	   rH   r   ú<module>r)     s4  ðñR÷h 3ç (Û 
ó@ôBh*�$ô h*òV	ôD,ˆ$ô D,÷N}4ñ }4ðBñ ò Ùðñ ðñ ð	ñ
 ðñ ðñ ðñ ðñ ðñ ðñ ðñ ðð  ‰fð!ñ& ð'ñ( ð)ñ, ð-ñ. ð/ñ0 ð1ñ2 
ð3ñ4 ð5ñ6 ð7ñ8 ð9€ñ> ò Ùðáðñ ðñ
 ðñ ðñ ðñ ðñ ðñ ðñ ðñ ðñ ðð ‰fðñ$ ð%ñ& ð'ñ* ð+ñ, ð-ñ. ð/ñ0 ð1ñ2 
ð3ñ4 ð5ñ6 ð7€ñ< ò áðñ ðñ ð	ñ
 ðñ ðñ ðñ ðñ ðñ ðñ ðð ‰oðñ ðñ$ ð%ñ& ð'ñ* ð+ñ, ð-ñ. ð/ñ0 ð1ñ2 
ð3ñ4 ð5ñ6 ð7Ð ñ< ò %Ùð%ñ  ð%ñ #ð	%ñ
 !ð%ñ ð%ñ ð%ñ ð%ñ ð%ñ ð%ñ ð%ð ‰fð%ñ ð%ñ$ ð%%ñ& ð'%ñ( ð)%ñ, ð-%ñ. ð/%ñ0 ð1%ñ2 ð3%ñ4 
ð5%ñ6 ð7%ñ8 ð9%ð< ØØØØØØòð=%Ð ñN Ø	ØØ
Øô	€ñ "ØØ	ØôÐ órH   