
    ni%                        S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
JrJrJrJrJrJrJr  \	" \5      r\\\\R*                  4   rSS jrSS jr\ " S	 S
5      5       rSS jrSS jrg)z5
Utility module providing some convenient functions.
    )annotationsN)	dataclass)	getLogger)IOIterableListOptionalSequenceUnioncastc                     SSK n  U R                  SS/U R                  S9R                  5       nU$ ! [         a    Sn U$ f = f)zAShow Java version

Returns:
    str: Result of ``java -version``
r   Njavaz-version)stderrz`java -version` faild. `java` command is not found from this Pythonprocess. Please ensure Java is installed and PATH is set for `java`)
subprocesscheck_outputSTDOUTdecodeFileNotFoundError)r   ress     G/var/www/html/land-ocr/venv/lib/python3.13/site-packages/tabula/util.pyjava_versionr      se     	
%%Z ):): & 

&( 	 J  
R 	
 J
s   *2 AAc                    SSK n SSKnSSKJn  [	        SU R
                   S[        5       R                  5        SU S[        R                  " 5        S[        [        R                  " 5       5       S	UR                  5        S
UR                  5        S
UR                  5        S[        R                  " 5        35        g)zShow environment information for reporting.

Returns:
    str:
        Detailed information like Python version, Java version,
        or OS environment, etc.
r   N)__version__zPython version:
    z
Java version:
    z
tabula-py version: z
platform: z
uname:
    z
linux_distribution: ('z', 'z')
mac_ver: )sysdistrotabular   printversionr   stripplatformstrunamenamecodenamemac_ver)r   r   r   s      r   environment_infor&   )   s     "	[[M ^ = !
  	 {{}oT&..*:);4@Q?R S




			!    c                      \ rS rSr% SrSrS\S'   SrS\S'   SrS	\S
'   Sr	S\S'   Sr
S\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SS jrS S jrSrg)!TabulaOptionF   a@  Build options for tabula-java

Args:
    pages (str, int, `iterable` of `int`, optional):
        An optional values specifying pages to extract from. It allows
        `str`,`int`, `iterable` of :`int`. Default: `1`

        Examples:
            ``'1-2,3'``, ``'all'``, ``[1,2]``
    guess (bool, optional):
        Guess the portion of the page to analyze per page. Default `True`
        If you use "area" option, this option becomes `False`.

        Note:
            As of tabula-java 1.0.3, guess option becomes independent from
            lattice and stream option, you can use guess and lattice/stream option
            at the same time.

    area (iterable of float, iterable of iterable of float, optional):
        Portion of the page to analyze(top,left,bottom,right).
        Default is entire page.

        Note:
            If you want to use multiple area options and extract in one table, it
            should be better to set ``multiple_tables=False`` for :func:`read_pdf()`

        Examples:
            ``[269.875,12.75,790.5,561]``,
            ``[[12.1,20.5,30.1,50.2], [1.0,3.2,10.5,40.2]]``

    relative_area (bool, optional):
        If all area values are between 0-100 (inclusive) and preceded by ``'%'``,
        input will be taken as % of actual height or width of the page.
        Default ``False``.
    lattice (bool, optional):
        Force PDF to be extracted using lattice-mode extraction
        (if there are ruling lines separating each cell, as in a PDF of an
        Excel spreadsheet)
    stream (bool, optional):
        Force PDF to be extracted using stream-mode extraction
        (if there are no ruling lines separating each cell, as in a PDF of an
        Excel spreadsheet)
    password (str, optional):
        Password to decrypt document. Default: empty
    silent (bool, optional):
        Suppress all stderr output.
    columns (Sequence, optional):
        X coordinates of column boundaries. Must be sorted and of a datatype that
        preserves order, e.g. tuple or list

        Example:
            ``[10.1, 20.2, 30.3]``
    relative_columns (bool, optional):
        If all values are between 0-100 (inclusive) and preceded by '%',
        input will be taken as % of actual width of the page.
        Default ``False``.
    format (str, optional):
        Format for output file or extracted object.
        (``"CSV"``, ``"TSV"``, ``"JSON"``)
    batch (str, optional):
        Convert all PDF files in the provided directory. This argument should be
        directory path.
    output_path (str, optional):
        Output file path. File format of it is depends on ``format``.
        Same as ``--outfile`` option of tabula-java.
    options (str, optional):
        Raw option string for tabula-java.
    multiple_tables (bool, optional):
        Extract multiple tables into a dataframe. Default: True
Nz(Optional[Union[str, int, Iterable[int]]]pagesTboolguessz;Optional[Union[Iterable[float], Iterable[Iterable[float]]]]areaFrelative_arealatticestreamzOptional[str]passwordzOptional[bool]silentzOptional[Sequence[float]]columnsrelative_columnsformatbatchoutput_path optionsmultiple_tablesc                   [        U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R
                  =(       d    UR
                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  U R                  =(       d    UR                  S9$ )zBMerge two TabulaOption.
self will overwrite other fields' values.
)r+   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r:   r;   )r)   r+   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r:   r;   )selfothers     r   mergeTabulaOption.merge   s    **+**+(ejj,,C0C0CLL1EMM;;.%,,]]4enn;;.%,,LL1EMM!22Le6L6L;;.%,,**+((=E,=,=LL1EMM 00IE4I4I
 	
r'   c                   / nU R                   (       a#  U[        R                  " U R                   5      -  nU R                  (       a  U R                  n[	        U R                  [
        5      (       a  [        U R                  5      nOL[        U R                  5      [        [        4;   a)  SR                  [        [        U R                  5      5      n[        [        U5      nUSU/-  nO[        R                  S5        SnU R                  (       a  SU l        [        U R                  5      [        [        4;   a  [#        S U R                   5       5      (       aT  U R                   HC  n[        [$        [&           U5      n[)        U5        [+        X@R,                  5      nUSU/-  nSnME     OH[        [$        [&           U R                  5      n[)        U5        [+        X`R,                  5      nUSU/-  nU R.                  (       a  UR1                  S5        U R2                  (       a  UR1                  S	5        U R                   (       a  U(       d  UR1                  S
5        U R4                  (       a  USU R4                  /-  nU R6                  (       a  USU R6                  /-  nU R8                  (       a^  [        U R8                  5      [;        U R8                  5      :w  a  [=        S5      e[+        U R8                  U R>                  5      nUSU/-  nU R@                  (       a  USU R@                  /-  nU RB                  (       a  USU RB                  /-  nU RD                  (       a  UR1                  S5        U$ )z"Convert to tabula-java option list,z--pageszJ'pages' argument isn't specified.Will extract only from page 1 by default.Fc              3  R   #    U  H  n[        U5      [        [        4;   v   M     g 7f)N)typelisttuple).0es     r   	<genexpr>1TabulaOption.build_option_list.<locals>.<genexpr>   s     CAtAw4-/s   %'z--areaTz	--latticez--streamz--guessz--formatz	--outfilezcolumns option should be sortedz	--columnsz
--passwordz--batchz--silent)#r:   shlexsplitr+   
isinstanceintr!   rD   rE   rF   joinmapr   loggerwarningr.   r-   anyr   float_validate_area_format_with_relativer/   r0   appendr1   r6   r8   r4   sorted
ValueErrorr5   r2   r7   r3   )r=   _TabulaOption__options_TabulaOption__pagesmultiple_areasrH   _TabulaOption__arear.   _TabulaOption__columnss           r   build_option_listTabulaOption.build_option_list   s   	<<T\\22I::jjG$**c**djj/djj!dE]2((3sDJJ#783(G)W--INN<
 99DJDII4-/CCCC!YY %!4&q)!6q:L:L!M!h%77	)- '  ;D"4(249K9KLF(F!33I<<[);;Z(::nY';;*dkk22I+t'7'788I<<DLL!VDLL%99 !BCC-dllD<Q<QRI+y11I==,66I::)TZZ00I;;Z(r'   )r-   )r>   r)   returnr)   )ra   z	List[str])__name__
__module____qualname____firstlineno____doc__r+   __annotations__r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r:   r;   r?   r_   __static_attributes__ r'   r   r)   r)   F   s    EN 7;E3:E4HLD
ELM4GTFD"Hm"!FN!)-G&-"d" FM E=!%K%G] OT 
,Ir'   r)   c                b    U(       a  SOSnSR                  [        [        U 5      5      nU U 3$ )N%r9   rB   )rO   rP   r!   )valuesis_relativepercent	value_strs       r   rV   rV     s/     cbGS&)*IYyk""r'   c                    [        [        U 5      5      nUS:w  a  [        SU  SU 35      eU u  p#pEX$:  a  [        SU SU 35      eX5:  a  [        SU SU 35      eg )N   z.area should have 4 values for each option but z has zarea option bottom=z should be greater than top=zarea option right=z should be greater than left=)lenrE   rY   )rl   value_lengthtopleftbottomrights         r   rU   rU     s    tF|$Lq<VHE,X
 	
  &Cv
}!&)EcUK
 	
 } 'DTFK
 	
 r'   )ra   r!   )ra   None)rl   Iterable[float]rm   r,   ra   r!   )rl   ry   ra   rx   )rf   
__future__r   osr    rK   dataclassesr   loggingr   typingr   r   r   r	   r
   r   r   rb   rQ   r!   PathLikeFileLikeObjr   r&   r)   rV   rU   ri   r'   r   <module>r      sw    # 	   !  F F F	8	BR[[(),: w w wt#
r'   