
    A j                      b	   d dl Z d dlZ	 d dlmZ dZn# e$ r dZY nw xY wddlmZm	Z	m
Z
  e j        d          Ze                    e j                    G d de          Z ej        e          Z ej        d	           ej        e
           ej        dddd           ej        dddd           ej        ddd           ej        ddd           ej        dd ej        g d          d           ej        d d!dd"           ej        d#d$dd%           ej        d&d'dd(           ej        d)d*d+           ej        d,d-d.d/d01          ej        d2                                                                                                                                                             Ze                    d3           ej        d4d5g dd67           ej        d8d9g dd:7           ej        d;d<dd=           ej        d>d?d@dA           ej        dBdCg  ej        dDdEg          ddFG           ej        dHdIdJdKg ej        g dL          ddMG           ej        dNdOdPdQ           ej        dRdSdPdT           ej        dUdVd@dW           ej        dXdYdZd[           ej        d\d]d d^           ej        d_d`dadb           ej        dcdd ej        g de          df           ej        dg ej        dh          i          edj                                                                                                                                                                                                 Ze                    dk           ej        d4d5g dd67           ej        d8d9g dd:7           ej        dldmg ddn7           ej        dodpdqdr           ej        dsdtdPdu           ej        dvdwd dx           ej        dcdd ej        g dy          df           ej        dg ej        dh          i          edz                                                                                                                         ZdS ){    NTF   )__version__read_pdfplotcamelotc                       e Zd Zd Zd ZdS )Configc                     i | _         d S Nconfig)selfs    _C:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\camelot/cli.py__init__zConfig.__init__   s        c                     || j         |<   d S r   r   )r   keyvalues      r   
set_configzConfig.set_config   s     Cr   N)__name__
__module____qualname__r   r    r   r   r	   r	      s2          ! ! ! ! !r   r	   )name)versionz-qz--quietzSuppress logs and warnings.)is_flaghelpz-pz--pages1z?Comma-separated page numbers. Example: 1,3,4 or 1,4-end or all.)defaultr   z-pwz
--passwordzPassword for decryption.)r   z-oz--outputzOutput file path.z-fz--format)csvexcelhtmljsonmarkdownsqlitezOutput file format.)typer   z-zz--zipzCreate ZIP archive.z-splitz--split_textz,Split text that spans across multiple cells.z-flagz--flag_sizez@Flag text based on font size. Useful to detect super/subscripts.z-stripz--strip_textzOCharacters that should be stripped from a string before assigning it to a cell.z-Mz	--margins   )g      ?g      ?g?z2PDFMiner char_margin, line_margin and word_margin.)nargsr   r   c                     t                      | _        |                                D ] \  }}| j                            ||           !dS )z(Camelot: PDF Table Extraction for HumansN)r	   objitemsr   )ctxargskwargsr   r   s        r   clir/       sP    \ hhCGllnn ' '
U3&&&&' 'r   latticez-Rz--table_regionszbPage regions to analyze. Example: x1,y1,x2,y2 where x1, y1 -> left-top and x2, y2 -> right-bottom.)r   multipler   z-Tz--table_areaszaTable areas to process. Example: x1,y1,x2,y2 where x1, y1 -> left-top and x2, y2 -> right-bottom.z-backz--process_backgroundzProcess background lines.z-scalez--line_scale   zOLine size scaling factor. The larger the value, the smaller the detected lines.z-copyz--copy_texthvz?Direction in which text in a spanning cell will be copied over.)r   r&   r1   r   z-shiftz--shift_textlt) r5   rr6   bz5Direction in which text in a spanning cell will flow.z-lz
--line_tol   zFTolerance parameter used to merge close vertical and horizontal lines.z-jz--joint_tolzaTolerance parameter used to decide whether the detected lines and points lie close to each other.z-blockz--threshold_blocksizezFor adaptive thresholding, size of a pixel neighborhood that is used to calculate a threshold value for the pixel. Example: 3, 5, 7, and so on.z-constz--threshold_constantzFor adaptive thresholding, constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well.z-Iz--iterationsz5Number of times for erosion/dilation will be applied.z-resz--resolutioni,  z*Resolution used for PDF to PNG conversion.z-plotz--plot_type)textgridcontourjointlinez5Plot elements found on PDF page for visual debugging.filepath)exists)r&   c                    | j         }|                    d          }|                    d          }|                    d          }|                    d          }|                    d          }|                    d          }	|                    d          }
|                    |           t          |d                   }|sd	n||d<   t          |d
                   }|sd	n||d
<   t          |d                   }|sd	n||d<   t          |d                   |d<   |	t          st          d          n,|t          j        d          |t          j        d          t          |
f|d|d|}t          j	        d|j
         d           |	+|D ]&}t          ||	           t          j                     'd	S |                    |||           d	S )z*Use lines between text to parse the table.pagesoutputformatzipquiet	plot_typerA   table_regionsNtable_areas	copy_text
shift_text$matplotlib is required for plotting..Please specify output file path using --output0Please specify output file format using --formatr0   rD   flavorsuppress_stdoutFound  tableskindfcompressr   popupdatelist_HAS_MPLImportErrorclick
UsageErrorr   echonr   pltshowexport)cr-   r.   confrD   rE   rY   rZ   rH   rI   rA   rJ   rK   rL   tablestables                   r   r0   r0   S   s$   | 8DHHWEXXhFAxxHHHWE

;''Izz*%%H
MM$011M*7Jdd]F?vm,--K(3DDDF=VK())I&/>$$YF;| 455F< W 	FDEEE	F  	U"#STTT 	W"#UVVVi JP F 
J))))*** 6 	 	EY''''HJJJJ	 	 	fH55555r   streamz-Cz	--columnsz#X coordinates of column separators.z-ez
--edge_tol2   z7Tolerance parameter for extending textedges vertically.z-rz	--row_tolzFTolerance parameter used to combine text vertically, to generate rows.z-cz--column_tolzKTolerance parameter used to combine text horizontally, to generate columns.)r<   r=   r>   textedgec                    | j         }|                    d          }|                    d          }|                    d          }|                    d          }|                    d          }|                    d          }	|                    d          }
|                    |           t          |d                   }|sd	n||d<   t          |d
                   }|sd	n||d
<   t          |d                   }|sd	n||d<   |	t          st          d          n,|t          j        d          |t          j        d          t          |
f|d|d|}t          j	        d|j
         d           |	+|D ]&}t          ||	           t          j                     'd	S |                    |||           d	S )z+Use spaces between text to parse the table.rD   rE   rF   rG   rH   rI   rA   rJ   NrK   columnsrN   rO   rP   rl   rQ   rT   rU   rV   rX   r[   )rh   r-   r.   ri   rD   rE   rY   rZ   rH   rI   rA   rJ   rK   rp   rj   rk   s                   r   rl   rl      s   j 8DHHWEXXhFAxxHHHWE

;''Izz*%%H
MM$011M*7Jdd]F?vm,--K(3DDDF=6)$%%G$+8F9 W 	FDEEE	F  	U"#STTT 	W"#UVVVh IO F 
J))))*** 6 	 	EY''''HJJJJ	 	 	fH55555r   )loggingra   matplotlib.pyplotpyplotre   r_   r`   r7   r   r   r   	getLoggerloggersetLevelINFOobjectr	   make_pass_decoratorpass_configgroupversion_optionoptionChoicepass_contextr/   commandargumentPathr0   rl   r   r   r   <module>r      s    ###### HH    HHH
 * ) ) ) ) ) ) ) ) ) 
	9	%	%    ! ! ! ! !V ! ! ! (e'// )k***dIu3PQQQ	M	   e\(BCCCdJ%8999	LLL	M	M		   dGT0EFFF	7	   	N	   
   
	=   ' '      GF  :9 DC  RQ +* X' Y
<   
<   #T8S   
'	   	sCj	!	!	M   #J	...	/	/	@   	T	   
>	   
/	   
(	   	@	   
	5	   	BBB	C	C	@	   
4!8!8!8999&6 &6  :9              x&6R X
<   
<   	.   	E	   	T	   
?	   	===	>	>	@	   
4!8!8!8999%6 %6  :9        f%6 %6 %6s    