
    g"                       d dl mZ d dlZd dl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                  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             Z- ej        e*&          d'             Z. ej        e-&          d(             Z/ ej        g d)&          d*             Z0ej        d+             Z1ej        d,             Z2dS )-    )annotationsN)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     k/var/www/html/nodeJS/PythonScripts/venv3.11/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_table4   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_warnings8   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-   J   s!        F:::r   r-   c                      e Zd ZdZdS )CParserHighMemoryFNr'   r(   r)   r   r+   r   r   r3   r3   O   s        JJJr   r3   c                      e Zd ZdZdS )CParserLowMemoryTNr4   r+   r   r   r6   r6   S   s        JJJr   r6   c                      e Zd ZdZdgZdS )PythonParserpythonNr1   r+   r   r   r8   r8   W   s        F#fr   r8   c                      e Zd ZdZdgZdS )PyArrowParserpyarrowNr1   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_pathrC   a   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>   r@   csvz	test1.csv)ospathjoinrA   s    r   csv1rI   i   s(    
 7<<vu55{CCCr   marksr9   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_parsersrX      sZ    
 ]]__F}	!!Ix	':;;; 	a   Mr   c                *    |                                  S )z<
    Fixture all of the CSV parsers using the C engine.
    rS   rW   s    r   c_parser_onlyr\          
 ==??r   c                *    |                                  S )zA
    Fixture all of the CSV parsers using the Python engine.
    rZ   r[   s    r   python_parser_onlyr_      r]   r   c                *    |                                  S )zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    rZ   r[   s    r   pyarrow_parser_onlyra      r]   r   c                 |   g } g }t          t          t                    D ]\  }}t          |d          r|j        d         }|j        D ]o}|j        dk    rt          j        j	        nd}t          j
         |            |f|          }|                     |           |                    | d|            p| |dS )za
    Return all allowable parser and float precision
    combinations and corresponding ids.
    valuesr   r<   r+   rJ   -rN   )zip_all_parsers_all_parser_idshasattrrc   r
   r	   rT   mark
single_cpurS   append)rO   rP   r?   	parser_id	precisionri   rS   s          r   ,_get_all_parser_float_precision_combinationsrn      s    
 F
C ?? 	3 	3	68$$ 	&]1%F7 	3 	3I-3]i-G-G6;))RDL&&((I!6dCCCEMM%   JJ)11i112222	3 S)))r   rO   rP   c                    | j         S )zR
    Fixture for all allowable combinations of parser
    and float precision
    rZ   r[   s    r   all_parsers_all_precisionsrp      s     =r   )          ) rd   _utfUTFc                0    g | ]}t           D ]	}| | d 
S )z{0})_encoding_prefixes).0sepprefixs      r   
<listcomp>r}      sH       !BT 8>vs   r   )rO   c                    | j         S )zE
    Fixture for all possible integer values for a UTF encoding.
    rZ   r[   s    r   	utf_valuer          
 =r   c                    | j         S )zD
    Fixture for all possible string formats of a UTF encoding.
    rZ   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   )ru   ru   )-_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.
    rZ   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.
    rX   rp   r   Nr<   zpyarrow doesn't support this.reason)fixturenamesgetfixturevaluer	   rT   ri   xfailapplymarker)rW   r?   ri   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
    rX   rp   r   Nr<   z,https://github.com/apache/arrow/issues/38676r   )r   r   r	   rT   skip)rW   r?   s     r   pyarrow_skipr   0  s     ,,,((77	%)=	=	=(()EFFqI}	!!IJJJJJJ "!r   )3
__future__r   rF   rT   pandas.compat._optionalr   pandasr   r   pandas._testing_testingr!   r   r-   r3   r6   r8   r;   fixturerC   rI   _cParserHighMemory_cParserLowMemory_pythonParser_pyarrowParser_py_parsers_only_c_parsers_onlyrS   ri   rj   _pyarrow_parsers_onlyrf   _py_parser_ids_c_parser_ids_pyarrow_parsers_idsrg   rX   r\   r_   ra   rn   rp   _utf_values_encoding_sepsry   _encoding_fmtsr   r   r   r   r   r+   r   r   <module>r      su   " " " " " " 				  , , , , , ,             7/ 7/ 7/ 7/ 7/ 7/ 7/ 7/t; ; ; ; ;j ; ; ;
           w   % % % % %: % % %
% % % % %J % % %
 , , , D D D ' $ !? %'89%nFK<RSSST L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   