
    A j]_                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlZ	d dl
ZdZdZ G d de          Z G d d	e          Z G d
 de          Z G d de          Z G d de          ZdS )    N)chain)
itemgetter   
   c                   (    e Zd ZdZddZd Zd	dZdS )
TextEdgeat  Defines a text edge coordinates relative to a left-bottom
    origin. (PDF coordinate space)

    Parameters
    ----------
    x : float
        x-coordinate of the text edge.
    y0 : float
        y-coordinate of bottommost point.
    y1 : float
        y-coordinate of topmost point.
    align : string, optional (default: 'left')
        {'left', 'right', 'middle'}

    Attributes
    ----------
    intersections: int
        Number of intersections with horizontal text rows.
    is_valid: bool
        A text edge is valid if it intersections with at least
        TEXTEDGE_REQUIRED_ELEMENTS horizontal text rows.

    leftc                 Z    || _         || _        || _        || _        d| _        d| _        d S )Nr   F)xy0y1alignintersectionsis_valid)selfr   r   r   r   s        `C:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\camelot/core.py__init__zTextEdge.__init__.   s1    
    c                     t          | j        d          }t          | j        d          }t          | j        d          }d| d| d| d| j         d| j         dS )N   z<TextEdge x=z y0= y1=z align=z valid=>)roundr   r   r   r   r   )r   r   r   r   s       r   __repr__zTextEdge.__repr__6   sl    $&!47A47AX1XX"XX"XXTZXXXXX	
r   2   c                     t          j        | j        ||          r_| j        | j        z  |z   t          | j        dz             z  | _        || _        | xj        dz  c_        | j        t          k    rd| _        dS dS dS )zdUpdates the text edge's x and bottom y coordinates and sets
        the is_valid attribute.
        atol   TN)npiscloser   r   r   floatTEXTEDGE_REQUIRED_ELEMENTSr   )r   r   r   edge_tols       r   update_coordszTextEdge.update_coords>   s     :dgr111 	%(461A5t?QTU?U9V9VVDFDG!# !$>> % $	% 	%% %r   N)r	   r   )__name__
__module____qualname____doc__r   r   r%    r   r   r   r      sU         0   
 
 
% % % % % %r   r   c                   T    e Zd ZdZddZed             Zd Zd Zd Z	d Z
d	 Zd
 ZdS )	TextEdgeszDefines a dict of left, right and middle text edges found on
    the PDF page. The dict has three keys based on the alignments,
    and each key's value is a list of camelot.core.TextEdge objects.
    r   c                 *    || _         g g g d| _        d S )Nr	   rightmiddle)r$   
_textedges)r   r$   s     r   r   zTextEdges.__init__R   s     #%bAAr   c                 P    | j         }| j        }|||z
  dz  z   }|||d}||         S )zYReturns the x coordinate of a text row based on the
        specified alignment.
        g       @)r	   r1   r0   )x0x1)textliner   x_leftx_rightx_middlex_coords         r   get_x_coordzTextEdges.get_x_coordV   s?    
 +Wv-44!XHHu~r   c                     t          | j        |                   D ]%\  }}t          j        |j        |d          r|c S &dS )zkReturns the index of an existing text edge using
        the specified x coordinate and alignment.
        g      ?r   N)	enumerater2   r    r!   r   )r   r:   r   ites        r   findzTextEdges.finda   sT     tu566 	 	EArz"$c222 tr   c                     |                      ||          }|j        }|j        }t          ||||          }| j        |                             |           dS )z)Adds a new text edge to the current dict.)r   N)r;   r   r   r   r2   append)r   r6   r   r   r   r   r?   s          r   addzTextEdges.addj   s\    Xu--[[aRu---%%b)))))r   c                     dD ]z}|                      ||          }|                     ||          }||                     ||           G| j        |         |                             ||j        | j                   {dS )z2Updates an existing text edge in the current dict.r/   N)r$   )r;   r@   rC   r2   r%   r   r$   )r   r6   r   r:   idxs        r   updatezTextEdges.updater   s    0 	 	E&&x77G))GU++C 5))))&s+99X[4= :    	 	r   c                     |D ]N}t          |                                                                          dk    r|                     |           OdS )zMGenerates the text edges dict based on horizontal text
        rows.
        r   N)lenget_textstriprF   )r   	textlinestls      r   generatezTextEdges.generate~   sV      	  	 B2;;==&&(())A-  B	  	 r   c                 `   t          d | j        d         D                       t          d | j        d         D                       t          d | j        d         D                       d}t          |                                t	          d          	          d
         }| j        |         S )zReturns the list of relevant text edges (all share the same
        alignment) based on which list intersects horizontal text rows
        the most.
        c              3   2   K   | ]}|j         	|j        V  d S Nr   r   .0r?   s     r   	<genexpr>z)TextEdges.get_relevant.<locals>.<genexpr>   s@        %'bk      r   r	   c              3   2   K   | ]}|j         	|j        V  d S rP   rQ   rR   s     r   rT   z)TextEdges.get_relevant.<locals>.<genexpr>   s@        %'r{      r   r0   c              3   2   K   | ]}|j         	|j        V  d S rP   rQ   rR   s     r   rT   z)TextEdges.get_relevant.<locals>.<genexpr>   s@        %'      r   r1   r/   r   keyr   )sumr2   maxitemsr   )r   intersections_sumrelevant_aligns      r   get_relevantzTextEdges.get_relevant   s       +/?6+B       +/?7+C       +/?8+D    

 

 .4466JqMMJJJ1M~..r   c                    d }|                     d            i }|D ]}|j        r|sd||j        |j        |j        |j        f<   )d}|D ](}|j        |d         k    r|j        |d         k    r|} n)|d||j        |j        |j        |j        f<   v|                    |           |d         t          |j        |d                   t          |d         |j                  t          |d         |j                  f}d||<   d}	|D ]}
|	|
j        |
j        z
  z  }	d}|D ](}|
j        |d         k    r|
j        |d         k    r|} n)||                    |           t          |
j        |d                   t          |
j        |d                   t          |d         |
j	                  t          |d         |
j                  f}d||<   |	t          t          |                    z  }i }|D ]}d| |||          <   |S )	zpReturns a dict of interesting table areas on the PDF page
        calculated using relevant text edges.
        c                     | d         t           z
  }| d         t           z
  }| d         t           z   }| d         |dz  z   }||||fS )Nr   r   r         )TABLE_AREA_PADDING)areaaverage_row_heightr4   r   r5   r   s         r   padz&TextEdges.get_table_areas.<locals>.pad   sR    a--Ba--Ba--Ba-11BB##r   c                      | j          | j        fS rP   )r   r   )r?   s    r   <lambda>z+TextEdges.get_table_areas.<locals>.<lambda>   s    ~ r   rW   Nr   ra   r   r   )sortr   r   r   r   popminrZ   r4   r5   r"   rH   )r   rK   relevant_textedgesrf   table_areasr?   foundrd   updated_areasum_textline_heightrL   average_textline_heighttable_areas_paddeds                r   get_table_areaszTextEdges.get_table_areas   s}   
	$ 	$ 	$ 	$=$=>>>$ 	9 	9B{ 9" 9>BKrubdBE :;; E + " "5DG+ "a0@ "$(E!E 
9BFRT25"$$>??#...!!HuQx00a"$//a"%00	( 59L1   	1 	1B2525=0E#  5DG# a(8  EE 1&&&uQx((uQx((a"%((a"%((	  -1L)"5c)nn8M8M"M   	J 	JDEIss4)@AABB!!r   Nr&   )r'   r(   r)   r*   r   staticmethodr;   r@   rC   rF   rM   r^   rs   r+   r   r   r-   r-   L   s         
B B B B   \  * * *
 
 
     / / /.G" G" G" G" G"r   r-   c                   j    e Zd ZdZd Zd Zed             Zej        d             Zed             Z	dS )Cella\  Defines a cell in a table with coordinates relative to a
    left-bottom origin. (PDF coordinate space)

    Parameters
    ----------
    x1 : float
        x-coordinate of left-bottom point.
    y1 : float
        y-coordinate of left-bottom point.
    x2 : float
        x-coordinate of right-top point.
    y2 : float
        y-coordinate of right-top point.

    Attributes
    ----------
    lb : tuple
        Tuple representing left-bottom coordinates.
    lt : tuple
        Tuple representing left-top coordinates.
    rb : tuple
        Tuple representing right-bottom coordinates.
    rt : tuple
        Tuple representing right-top coordinates.
    left : bool
        Whether or not cell is bounded on the left.
    right : bool
        Whether or not cell is bounded on the right.
    top : bool
        Whether or not cell is bounded on the top.
    bottom : bool
        Whether or not cell is bounded on the bottom.
    hspan : bool
        Whether or not cell spans horizontally.
    vspan : bool
        Whether or not cell spans vertically.
    text : string
        Text assigned to cell.

    c                     || _         || _        || _        || _        ||f| _        ||f| _        ||f| _        ||f| _        d| _        d| _	        d| _
        d| _        d| _        d| _        d| _        d S )NF )r5   r   x2y2lbltrbrtr	   r0   topbottomhspanvspan_textr   r5   r   ry   rz   s        r   r   zCell.__init__  s    r(r(r(r(	





r   c           	          t          | j                  }t          | j                  }t          | j                  }t          | j                  }d| d| d| d| d	S )Nz	<Cell x1=r   z x2=z y2=r   )r   r5   r   ry   rz   r   s        r   r   zCell.__repr__"  s_    47^^47^^47^^47^^828828828828888r   c                     | j         S rP   )r   r   s    r   textz	Cell.text)  s
    zr   c                 H    d                     | j        |g          | _        d S )Nrx   )joinr   )r   ts     r   r   z	Cell.text-  s    WWdj!_--


r   c                 @    | j         | j        z   | j        z   | j        z   S )z1The number of sides on which the cell is bounded.)r   r   r	   r0   r   s    r   boundz
Cell.bound1  s!     x$+%	1DJ>>r   N)
r'   r(   r)   r*   r   r   propertyr   setterr   r+   r   r   rv   rv      s        ' 'R  "9 9 9   X 
[. . [. ? ? X? ? ?r   rv   c                       e Zd ZdZd Zd Zd Zed             Zed             Z	d Z
dd	Zd
 Zd Zd Zd Zd Zd Zd Zd ZdS )Tablea  Defines a table with coordinates relative to a left-bottom
    origin. (PDF coordinate space)

    Parameters
    ----------
    cols : list
        List of tuples representing column x-coordinates in increasing
        order.
    rows : list
        List of tuples representing row y-coordinates in decreasing
        order.

    Attributes
    ----------
    df : :class:`pandas.DataFrame`
    shape : tuple
        Shape of the table.
    accuracy : float
        Accuracy with which text was assigned to the cell.
    whitespace : float
        Percentage of whitespace in the table.
    order : int
        Table number on PDF page.
    page : int
        PDF page number.

    c                     | _         || _        fd|D             | _        d | _        d| _        d| _        d| _        d | _        d | _        d S )Nc                 .    g | ]fd D             S )c           	      d    g | ],}t          |d          d         |d         d                    -S r   r   )rv   )rS   crs     r   
<listcomp>z-Table.__init__.<locals>.<listcomp>.<listcomp>W  s7    BBBtAaD!A$!ad33BBBr   r+   )rS   r   colss    @r   r   z"Table.__init__.<locals>.<listcomp>W  s/    QQQqBBBBTBBBQQQr   )r   r   r   )	r   rowscellsdfshapeaccuracy
whitespaceorderpage)r   r   r   s    ` r   r   zTable.__init__T  sZ    		QQQQDQQQ


			r   c                 2    d| j         j         d| j         dS )N<z shape=r   )	__class__r'   r   r   s    r   r   zTable.__repr___  s"    @4>*@@4:@@@@r   c                 n    | j         |j         k    r| j        |j        k     rdS | j         |j         k     rdS d S )NT)r   r   )r   others     r   __lt__zTable.__lt__b  sI    9
" 	zEK' t9uz! 	4	 	r   c                 \    g }| j         D ]!}|                    d |D                        "|S )z1Returns two-dimensional list of strings in table.c                 @    g | ]}|j                                         S r+   )r   rJ   )rS   cells     r   r   zTable.data.<locals>.<listcomp>n  s$    888Ddioo''888r   )r   rB   )r   drows      r   dataz
Table.datai  sC     : 	: 	:CHH88C8889999r   c                 t    t          | j        d          t          | j        d          | j        | j        d}|S )zlReturns a parsing report with %accuracy, %whitespace,
        table number on page and page number.
        r   )r   r   r   r   )r   r   r   r   r   )r   reports     r   parsing_reportzTable.parsing_reportq  s?     dmQ//33ZI	
 
 r   c                 \    | j         D ]#}|D ]}dx|_        x|_        x|_        |_        $| S )zSets all table edges to True.T)r   r	   r0   r   r   )r   r   r   s      r   set_all_edgeszTable.set_all_edges  sO    : 	G 	GC G GBFF	FDJFDKKGr   r   c                   
 |D ]3fdt          | j                  D             }fdt          | j                  D             }fdt          | j                  D             }|si|d         }|dgk    rz|d         }|r2|d         }	||	k     r#d| j        |         |         _        |dz  }||	k     #t          | j                  }	||	k     r#d| j        |         |         _        |dz  }||	k     #|g k    rt          | j                  dz
  }|r3|d         }	||	k     r#d| j        |         |         _        |dz  }||	k     #Dt          | j                  }	||	k     r#d| j        |         |         _        |dz  }||	k     #|d         }|rN|d         }	||	k     r>d| j        |         |         _        d| j        |         |dz
           _        |dz  }||	k     >t          | j                  }	||	k     r>d| j        |         |         _        d| j        |         |dz
           _        |dz  }||	k     >5|D ]3

fdt          | j                  D             }
fdt          | j                  D             }
fd	t          | j                  D             }|si|d         }|dgk    rz|d         }|r2|d         }	||	k     r#d| j        |         |         _        |dz  }||	k     #t          | j                  }	||	k     r#d| j        |         |         _        |dz  }||	k     #|g k    rt          | j                  dz
  }|r3|d         }	||	k     r#d| j        |         |         _        |dz  }||	k     #Dt          | j                  }	||	k     r#d| j        |         |         _        |dz  }||	k     #|d         }|rN|d         }	||	k     r>d| j        |         |         _        d| j        |dz
           |         _        |dz  }||	k     >t          | j                  }	||	k     r>d| j        |         |         _        d| j        |dz
           |         _        |dz  }||	k     >5| S )
aN  Sets a cell's edges to True depending on whether the cell's
        coordinates overlap with the line's coordinates within a
        tolerance.

        Parameters
        ----------
        vertical : list
            List of detected vertical lines.
        horizontal : list
            List of detected horizontal lines.

        c                 `    g | ]*\  }}t          j        d          |d                    (|+S r   r   r    r!   )rS   r>   r   	joint_tolvs      r   r   z#Table.set_edges.<locals>.<listcomp>  L       Aq:adAaDy999  r   c                 `    g | ]*\  }}t          j        d          |d                   (|+S )ra   r   r   r   )rS   jr   r   r   s      r   r   z#Table.set_edges.<locals>.<listcomp>  r   r   c                 `    g | ]*\  }}t          j        d          |d                   (|+S r   r   r   r   )rS   kr   r   r   s      r   r   z#Table.set_edges.<locals>.<listcomp>  r   r   r   Tr   c                 `    g | ]*\  }}t          j        d          |d                   (|+S r   r   )rS   r>   r   hr   s      r   r   z#Table.set_edges.<locals>.<listcomp>  r   r   c                 `    g | ]*\  }}t          j        d          |d                    (|+S r   r   )rS   r   r   r   r   s      r   r   z#Table.set_edges.<locals>.<listcomp>  r   r   c                 `    g | ]*\  }}t          j        d          |d                   (|+S )r   r   r   r   )rS   r   r   r   r   s      r   r   z#Table.set_edges.<locals>.<listcomp>  r   r   )	r=   r   r   r   r	   rH   r0   r   r   )r   vertical
horizontalr   r>   r   r   JLKr   r   s      `      @@r   	set_edgeszTable.set_edges  s     :	 :	A    %di00  A
    %di00  A
    %di00  A
  !AQCx %aD 	!Aa% 04
1a(-Q a%  DIAa% 04
1a(-Q a%  b 	NNQ& 	!Aa% 15
1a(.Q a%  DIAa% 15
1a(.Q a%  aD !Aa% 04
1a(-59
1a!e,2Q a% 
 DIAa% 04
1a(-59
1a!e,2Q a% 
  :	 :	A    %di00  A
    %di00  A
    %di00  A
  !AQCx %aD 	!Aa% /3
1a(,Q a%  DIAa% /3
1a(,Q a%  b 	NNQ& 	!Aa% 26
1a(/Q a%  DIAa% 26
1a(/Q a%  aD !Aa% /3
1a(,6:
1q5)!,3Q a% 
 DIAa% /3
1a(,6:
1q5)!,3Q a% 
 r   c                    t          t          | j                            D ]G}d| j        |         d         _        d| j        |         t          | j                  dz
           _        Ht          t          | j                            D ]G}d| j        d         |         _        d| j        t          | j                  dz
           |         _        H| S )z Sets table border edges to True.Tr   r   )	rangerH   r   r   r	   r   r0   r   r   )r   r   r   s      r   
set_borderzTable.set_border  s    s49~~&& 	; 	;A$(DJqM!!6:DJqM#di..1,-33s49~~&& 	< 	<A#'DJqM! 7;DJs49~~)*1-44r   c                    | j         D ]}|D ]}|j        }|j        }|j        }|j        }|j        dk    r*|j        dk    r@|s|r|r
|rd|_        E|s|r|r
|rd|_        U|s|r|r
|rd|_        e|s|r|r	|rd|_        u|j        dk    r |r|r|s
|sd|_        |r|r|s	|sd|_        |j        dv rd|_        d|_        | S )zSets a cell's hspan or vspan attribute to True depending
        on whether the cell spans horizontally or vertically.
        r   ra   Tr   r   )r   r	   r0   r   r   r   r   r   )r   r   r   r	   r0   r   r   s          r   set_spanzTable.set_span  sy    : 	& 	&C & &y
h:? &Z1_ & *U *s *v *%)

" * * * *%)

  *d *u * *%)

# * *% *C *%)
Z1_ & * *s *6 *%)

 * * *e *%)
Z6) &!%DJ!%DJ/&0 r   c                 d    ddddd}|                     |            | j        j        |fi | dS )zWrites Table to a comma-separated values (csv) file.

        For kwargs, check :meth:`pandas.DataFrame.to_csv`.

        Parameters
        ----------
        path : str
            Output filepath.

        utf-8Fr   )encodingindexheaderquotingN)rF   r   to_csv)r   pathkwargskws       r   r   zTable.to_csv6  sI     "EUqQQ
		&t""r"""""r   c                     ddi}|                     |            | j        j        di |}t          |d          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zWrites Table to a JSON file.

        For kwargs, check :meth:`pandas.DataFrame.to_json`.

        Parameters
        ----------
        path : str
            Output filepath.

        orientrecordswNr+   )rF   r   to_jsonopenwrite)r   r   r   r   json_stringfs         r   r   zTable.to_jsonE  s     	"
		&%dgo++++$__ 	!GGK   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   AA#&A#c                     d| j          d| j         dd}|                    |           t          j        |          } | j        j        |fi | |                                 dS )zWrites Table to an Excel file.

        For kwargs, check :meth:`pandas.DataFrame.to_excel`.

        Parameters
        ----------
        path : str
            Output filepath.

        page--table-r   
sheet_namer   N)r   r   rF   pdExcelWriterr   to_excelsave)r   r   r   r   writers        r   r   zTable.to_excelV  s|     A$)@@DJ@@
 
 			&%%&&2&&&r   c                      | j         j        di |}t          |dd          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zWrites Table to an HTML file.

        For kwargs, check :meth:`pandas.DataFrame.to_html`.

        Parameters
        ----------
        path : str
            Output filepath.

        r   r   r   Nr+   )r   to_htmlr   r   )r   r   r   html_stringr   s        r   r   zTable.to_htmlj  s     &dgo////$g... 	!!GGK   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!   AAAc                      | j         j        di |}t          |dd          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zWrites Table to a Markdown file.

        For kwargs, check :meth:`pandas.DataFrame.to_markdown`.

        Parameters
        ----------
        path : str
            Output filepath.

        r   r   r   Nr+   )r   to_markdownr   r   )r   r   r   	md_stringr   s        r   r   zTable.to_markdowny  s     (DG'11&11	$g... 	!GGI	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                     ddd}|                     |           t          j        |          }d| j         d| j         } | j        j        ||fi | |                                 |                                 dS )zWrites Table to sqlite database.

        For kwargs, check :meth:`pandas.DataFrame.to_sql`.

        Parameters
        ----------
        path : str
            Output filepath.

        replaceF)	if_existsr   r   r   N)	rF   sqlite3connectr   r   r   to_sqlcommitclose)r   r   r   r   conn
table_names         r   	to_sqlitezTable.to_sqlite  s     %u55
		&t$$;TY;;tz;;
z4..2...

r   N)r   )r'   r(   r)   r*   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r+   r   r   r   r   7  s$        8	 	 	A A A     X   X  E E E EN    ># # #! ! !"  (! ! !      r   r   c                   l    e Zd ZdZd Zd Zd Zd Zed             Z	e
d             Zdd	Zd
 ZddZdS )	TableListzDefines a list of camelot.core.Table objects. Each table can
    be accessed using its index.

    Attributes
    ----------
    n : int
        Number of tables in the list.

    c                     || _         d S rP   _tables)r   tabless     r   r   zTableList.__init__  s    r   c                 2    d| j         j         d| j         dS )Nr   z n=r   )r   r'   nr   s    r   r   zTableList.__repr__  s"    84>*88tv8888r   c                 *    t          | j                  S rP   )rH   r  r   s    r   __len__zTableList.__len__  s    4<   r   c                     | j         |         S rP   r  )r   rE   s     r   __getitem__zTableList.__getitem__  s    |C  r   c                 (    t          | d|           S )Nto_)getattr)tabler   s     r   _format_funczTableList._format_func  s    uiAii(((r   c                      t          |           S rP   )rH   r   s    r   r  zTableList.n  s    4yyr   Nc                 F   |                     d          }|                     d          }|                     d          }| j        D ]Y}| d|j         d|j         | }t          j                            ||          }|                     ||          }	 |	|           Zd S )Ndirnamerootext-page-r   )getr  r   r   osr   r   r  )
r   r   r   r  r  r  r  filenamefilepath	to_formats
             r   _write_filezTableList._write_file  s    **Y''zz&!!jj\ 	  	 EKKejKKKcKKHw||GX66H))%33IIh		  	 r   c                 v   |                     d          }|                     d          }|                     d          }|                     d          }t          j                            t          j                            |          |          dz   }t          j        |dd          5 }| j        D ]k}| d	|j         d
|j	         | }	t          j                            ||	          }
|
                    |
t          j                            |
                     l	 d d d            d S # 1 swxY w Y   d S )Nr   r  r  r  .zipr   T
allowZip64r  r   )r  r  r   r   r  zipfileZipFiler  r   r   r   basename)r   r   r   r  r  r  zipnamezr  r  r  s              r   _compress_dirzTableList._compress_dir  s\   zz&!!**Y''zz&!!jj',,rwt44d;;fD_Wcd;;; 	>q > >"OO%*OOU[O#OO7<<::"'"2"28"<"<====>	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   ,A4D..D25D2csvFc                    t           j                            |          }t           j                            |          }t           j                            |          \  }}|rt          j                    }||||d}|dv r" | j        dd|i| |r | j        di | dS dS |dk    r*t           j        	                    ||          }	t          j        |	          }
| j        D ]1}d|j         d|j         }|j                            |
|d           2|
                                 |rt           j        	                    t           j                            |          |          d	z   }t%          j        |d
d          5 }|                    |	t           j                            |	                     ddd           dS # 1 swxY w Y   dS dS |dk    rt           j        	                    ||          }	| j        D ]}|                    |	           |rt           j        	                    t           j                            |          |          d	z   }t%          j        |d
d          5 }|                    |	t           j                            |	                     ddd           dS # 1 swxY w Y   dS dS dS )aC  Exports the list of tables to specified file format.

        Parameters
        ----------
        path : str
            Output filepath.
        f : str
            File format. Can be csv, excel, html, json, markdown or sqlite.
        compress : bool
            Whether or not to add files to a ZIP archive.

        )r   r  r  r  )r%  htmljsonmarkdownr   excelr   r   r   r   r  r   Tr  Nsqliter+   )r  r   r  r!  splitexttempfilemkdtempr  r$  r   r   r   r  r   r   r   r   r   r  r   r   r   )r   r   r   compressr  r!  r  r  r   r  r   r  r   r"  r#  s                  r   exportzTableList.export  s    '//$''7##D))G$$X..	c 	)&((G7DMM33 	BD++q+F+++ -"",,V,,,,,- -'\ 	Bw||GX66H^H--F S SEUZEEEE
!!&Z'!RRRRKKMMM B',,rwt'<'<dCCfL_WcdCCC BqGGHbg&6&6x&@&@AAAB B B B B B B B B B B B B B B B B BB B (] 	Bw||GX66H * *)))) B',,rwt'<'<dCCfL_WcdCCC BqGGHbg&6&6x&@&@AAAB B B B B B B B B B B B B B B B B B	B 	BB Bs$   4GG	G	24J33J7:J7rP   )r%  F)r'   r(   r)   r*   r   r   r  r	  rt   r  r   r  r  r$  r0  r+   r   r   r   r     s           9 9 9! ! !! ! ! ) ) \)   X       
> 
> 
>+B +B +B +B +B +Br   r   )r  r   r  r-  	itertoolsr   operatorr   numpyr    pandasr   r#   rc   objectr   r-   rv   r   r   r+   r   r   <module>r6     s   
			                       
   4% 4% 4% 4% 4%v 4% 4% 4%nX" X" X" X" X" X" X" X"vM? M? M? M? M?6 M? M? M?`b b b b bF b b bJ`B `B `B `B `B `B `B `B `B `Br   