
    Owg"                    "   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j6                  eej8                  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,e+D  cg c]  } e,D ]	  }| |  d%  c}} Z- ej$                  e*&      d'        Z. ej$                  e-&      d(        Z/ ej$                  g d)&      d*        Z0ej$                  d+        Z1ej$                  d,        Z2yc c}} w )-    )annotationsN)VERSIONS)read_csv
read_tablec                  n    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y)
BaseParserNz
str | NoneengineTzlist[str | None]float_precision_choicesc                v    |j                         }|j                  | j                  | j                  d       |S )N)r	   
low_memory)copyupdater	   r   )selfkwargss     V/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/io/parser/conftest.pyupdate_kwargszBaseParser.update_kwargs   s+    DOOLM    c                :    | j                  |      }t        |i |S N)r   r   r   argsr   s      r   r   zBaseParser.read_csv   s"    ##F+(((r   )raise_on_extra_warningscheck_stacklevelc                   | j                  |      }t        j                  ||||      5  t        |i |cd d d        S # 1 sw Y   y xY w)N)matchr   r   )r   tmassert_produces_warningr   )r   	warn_typewarn_msgr   r   r   r   s          r   read_csv_check_warningsz"BaseParser.read_csv_check_warnings   sR     ##F+''$;-	
 	- T,V,	- 	- 	-s   A  A	c                :    | j                  |      }t        |i |S r   )r   r   r   s      r   r   zBaseParser.read_table4   s"    ##F+4*6**r   )r   c                   | j                  |      }t        j                  |||      5  t        |i |cd d d        S # 1 sw Y   y xY w)N)r   r   )r   r   r   r   )r   r   r   r   r   r   s         r   read_table_check_warningsz$BaseParser.read_table_check_warnings8   sN     ##F+''X?V
 	/ t.v.	/ 	/ 	/s	   ?A)r   type[Warning]r   strr   bool)r   r$   r   r%   )__name__
__module____qualname__r	   __annotations__r   r
   r   r   r    r   r#    r   r   r   r      sq    FJJ02-2) !%!%- - - -*+ !%/ / /r   r   c                      e Zd ZdZg dZy)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y)CParserHighMemoryFNr'   r(   r)   r   r+   r   r   r3   r3   O   s    Jr   r3   c                      e Zd ZdZy)CParserLowMemoryTNr4   r+   r   r   r6   r6   S   s    Jr   r6   c                      e Zd ZdZdgZy)PythonParserpythonNr1   r+   r   r   r8   r8   W   s    F#fr   r8   c                      e Zd ZdZdgZy)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    
 D(F++r   c                R    t         j                  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"    
 77<<vu5{CCr   marksr9   c_highc_lowr<   paramsidsc                    | j                         }|j                  dk(  r2t        j                  dt        d          ddl}|j                  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      sH    
 ]]_F}}	!Ix	':; 	a Mr   c                "    | j                         S )z<
    Fixture all of the CSV parsers using the C engine.
    rS   rW   s    r   c_parser_onlyr\          
 ==?r   c                "    | j                         S )zA
    Fixture all of the CSV parsers using the Python engine.
    rZ   r[   s    r   python_parser_onlyr_      r]   r   c                "    | j                         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 ]r  }|j                  dk(  rt        j                  j                  nd}t        j                   |       |f|      }| j                  |       |j                  | d|        t  | |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	68$]]1%F77 	3I-3]]i-G6;;))RDLL&(I!6dCEMM% JJ)Ai[12	3		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UTFz{0})rO   c                    | j                   S )zE
    Fixture for all possible integer values for a UTF encoding.
    rZ   r[   s    r   	utf_valuery          
 ==r   c                    | j                   S )zD
    Fixture for all possible string formats of a UTF encoding.
    rZ   r[   s    r   encoding_fmtr|      rz   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| j                  d      }n$d| j                   v r| j                  d      d   }ny|j                  dk(  r2t        j                  j                  d      }| j                  |       yy)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	%)=)=	=(()EFqI}}	!{{  (G HD! "r   c                    d| j                   v r| j                  d      }n$d| j                   v r| j                  d      d   }ny|j                  dk(  rt        j                  d       yy)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  sg     ,,,((7	%)=)=	=(()EFqI}}	!I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_seps_encoding_prefixes_encoding_fmtsry   r|   r   r   r   )sepprefixs   00r   <module>r      s   " 	  , 7/ 7/t;j ;
 w %: %
%J %
 , , D D ' $ !? %'89%nFKK<R<RST LL#3L6KL7#!{ JMJNJ5IJ |9 : M: ; '^< = ,2FG H** 79(C46u=	 U^  &4!BT8>vhse5
 {# $ ~& ' ,.^_.^ " "$ K KAs    H