
    bMh#                    ^   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
 d dlmZ  G d 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ej        d             Zej        d             ZeZeZeZeZegZeegZ ej        eej        j        ej                             e d          g          gZ!g eee!Z"dgZ#ddgZ$dgZ%g e$e#e%Z& ej        e"e&          d             Z' ej        ee$          d             Z( ej        ee#          d             Z) ej        e!e%          d             Z*d  Z+ ej         e+            d!          e+            d"                   d#             Z,g d$Z-g d%Z.d&d'gZ/d( e.D             Z0 ej        e-)          d*             Z1 ej        e0)          d+             Z2 ej        g d,)          d-             Z3ej        d.             Z4ej        d/             Z5dS )0    )annotationsN)HAS_PYARROW)VERSIONS)read_csv
read_tablec                  `    e Zd ZU dZded<   dZg Zded<   d Zd Zddd	ddZ	d Z
ddddZdS )
BaseParserNz
str | NoneengineTzlist[str | None]float_precision_choicesc                r    |                                 }|                    | j        | j        d           |S )N)r
   
low_memory)copyupdater
   r   )selfkwargss     _/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/io/parser/conftest.pyupdate_kwargszBaseParser.update_kwargs   s2    DOLLMMM    c                D    |                      |          }t          |i |S N)r   r   r   argsr   s      r   r   zBaseParser.read_csv   s(    ##F++((((r   )raise_on_extra_warningscheck_stacklevel	warn_typetype[Warning]warn_msgstrr   boolc                   |                      |          }t          j        ||||          5  t          |i |cd d d            S # 1 swxY w Y   d S )N)matchr   r   )r   tmassert_produces_warningr   )r   r   r   r   r   r   r   s          r   read_csv_check_warningsz"BaseParser.read_csv_check_warnings    s     ##F++'$;-	
 
 
 	- 	- T,V,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s   AAAc                D    |                      |          }t          |i |S r   )r   r   r   s      r   r   zBaseParser.read_table5   s(    ##F++4*6***r   )r   c                   |                      |          }t          j        |||          5  t          |i |cd d d            S # 1 swxY w Y   d S )N)r!   r   )r   r"   r#   r   )r   r   r   r   r   r   s         r   read_table_check_warningsz$BaseParser.read_table_check_warnings9   s     ##F++'X?V
 
 
 	/ 	/ t.v..	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s   AA
A
)r   r   r   r   r   r   )r   r   r   r   )__name__
__module____qualname__r
   __annotations__r   r   r   r   r$   r   r'    r   r   r	   r	      s         FJ022222  ) ) ) !%!%- - - - - -*+ + + !%/ / / / / / / /r   r	   c                      e Zd ZdZg dZdS )CParserc)Nhigh
round_tripNr(   r)   r*   r
   r   r,   r   r   r.   r.   K   s!        F:::r   r.   c                      e Zd ZdZdS )CParserHighMemoryFNr(   r)   r*   r   r,   r   r   r4   r4   P   s        JJJr   r4   c                      e Zd ZdZdS )CParserLowMemoryTNr5   r,   r   r   r7   r7   T   s        JJJr   r7   c                      e Zd ZdZdgZdS )PythonParserpythonNr2   r,   r   r   r9   r9   X   s        F#fr   r9   c                      e Zd ZdZdgZdS )PyArrowParserpyarrowNr2   r,   r   r   r<   r<   ]   s        F#fr   r<   c                     | ddd          S )zG
    The directory path to the data files needed for parser tests.
    ioparserdatar,   datapaths    r   csv_dir_pathrD   b   s    
 8D(F+++r   c                X    t           j                             | ddd          d          S )zH
    The path to the data file "test1.csv" needed for parser tests.
    r?   rA   csvz	test1.csv)ospathjoinrB   s    r   csv1rJ   j   s(    
 7<<vu55{CCCr   pyarrow is not installedreasonmarksr:   c_highc_lowr=   paramsidsc                    |                                  }|j        dk    r9t          j        dt          d                    ddl}|                    d           |S )z)
    Fixture all of the CSV parsers.
    r=   r   N   )paramr
   pytestimportorskipr   r=   set_cpu_count)requestr@   r=   s      r   all_parsersr\      sZ    
 ]]__F}	!!Ix	':;;; 	a   Mr   c                *    |                                  S )z<
    Fixture all of the CSV parsers using the C engine.
    rW   r[   s    r   c_parser_onlyr`          
 ==??r   c                *    |                                  S )zA
    Fixture all of the CSV parsers using the Python engine.
    r^   r_   s    r   python_parser_onlyrc      ra   r   c                *    |                                  S )zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    r^   r_   s    r   pyarrow_parser_onlyre      ra   r   c                    g } g }t          t          t                    D ]\  }}t          |d          r|j        d         }|j        D ]}|j        dk    r8t          j        j	        t          j        
                    t           d          gnd}t          j         |            |f|          }|                     |           |                    | d|            | |d	S )
za
    Return all allowable parser and float precision
    combinations and corresponding ids.
    valuesr   r=   rK   rL   r,   rN   -rR   )zip_all_parsers_all_parser_idshasattrrg   r   r
   rX   mark
single_cpuskipifr   rW   append)rS   rT   r@   	parser_id	precisionrm   rW   s          r   ,_get_all_parser_float_precision_combinationsrs      s   
 F
C ?? 3 3	68$$ 	&]1%F7 	3 	3I =I-- K*K&&'0J '      L&&((I!6dCCCEMM%   JJ)11i112222	3  S)))r   rS   rT   c                    | j         S )zR
    Fixture for all allowable combinations of parser
    and float precision
    r^   r_   s    r   all_parsers_all_precisionsru      s     =r   )          ) rh   _utfUTFc                0    g | ]}t           D ]	}| | d 
S )z{0})_encoding_prefixes).0sepprefixs      r   
<listcomp>r      sH       !BT 8>vs   r   )rS   c                    | j         S )zE
    Fixture for all possible integer values for a UTF encoding.
    r^   r_   s    r   	utf_valuer          
 =r   c                    | j         S )zD
    Fixture for all possible string formats of a UTF encoding.
    r^   r_   s    r   encoding_fmtr      r   r   )*)z-1,0      )z-1,2e0g333333)z-1e0r   )z+1e0      ?)z+1e+0r   )z+1e-1皙?)z+,1e1r   )z+1,e0r   )z-,1e1r   )z-1,e0r   )z0,1r   )z1,r   )z,1r   )z-,1g)z1_,r   )z1_234,56
ףp=J@)z
1_234,56e0r   )rz   rz   )-_r   )-_1r   )-_1e0r   )_1r   )_1,r   )_1,_r   )_1e0r   )1,2e_1r   )1,2e1_0r   )1,_2r   ),1__2r   ),1er   )-,1er   )1_000,000_000r   )1,e1_2r   )e11,2r   )1e11,2r   )1,2,2r   )1,2_1r   )	1,2e-10e1r   )--1,2r   )1a_2,1r   )z1,2E-1gQ?)z1,2E1g      (@c                    | j         S )z
    Fixture for all numeric formats which should get recognized. The first entry
    represents the value to read while the second represents the expected result.
    r^   r_   s    r   numeric_decimalr      s    h =r   c                   d| j         v r|                     d          }n'd| j         v r|                     d          d         }ndS |j        dk    r7t          j                            d          }|                     |           dS dS )z
    Fixture that xfails a test if the engine is pyarrow.

    Use if failure is do to unsupported keywords or inconsistent results.
    r\   ru   r   Nr=   zpyarrow doesn't support this.rL   )fixturenamesgetfixturevaluer
   rX   rm   xfailapplymarker)r[   r@   rm   s      r   pyarrow_xfailr   /  s     ,,,((77	%)=	=	=(()EFFqI}	!!{  (G HHD!!!!! "!r   c                    d| j         v r|                     d          }n'd| j         v r|                     d          d         }ndS |j        dk    rt          j        d           dS dS )z
    Fixture that skips a test if the engine is pyarrow.

    Use if failure is do a parsing failure from pyarrow.csv.read_csv
    r\   ru   r   Nr=   z,https://github.com/apache/arrow/issues/38676rL   )r   r   r
   rX   skip)r[   r@   s     r   pyarrow_skipr   B  s     ,,,((77	%)=	=	=(()EFFqI}	!!IJJJJJJ "!r   )6
__future__r   rG   rX   pandas.compatr   pandas.compat._optionalr   pandasr   r   pandas._testing_testingr"   r	   r.   r4   r7   r9   r<   fixturerD   rJ   _cParserHighMemory_cParserLowMemory_pythonParser_pyarrowParser_py_parsers_only_c_parsers_onlyrW   rm   rn   ro   _pyarrow_parsers_onlyrj   _py_parser_ids_c_parser_ids_pyarrow_parsers_idsrk   r\   r`   rc   re   rs   ru   _utf_values_encoding_sepsr~   _encoding_fmtsr   r   r   r   r   r,   r   r   <module>r      s   " " " " " " 				  % % % % % % , , , , , ,             7/ 7/ 7/ 7/ 7/ 7/ 7/ 7/t; ; ; ; ;j ; ; ;
           w   % % % % %: % % %
% % % % %J % % %
 , , , D D D ' $ !? %'89FLK"K;7QRR
    ML#3L6KL7#!{ JMJNJ5IJ |999  :9 M:::  ;: '^<<<  =< ,2FGGG  HG* * *< 7799(C4466u=   	  kkU^  %3  
 {###  $# ~&&&  '& , , ,. . .^ _. .^ " " "$ K K K K Kr   