
    Oh#                    j   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<                  jA                  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/e.D  cg c]  } e/D ]	  }| |  d(  c}} Z0 ej(                  e-)      d*        Z1 ej(                  e0)      d+        Z2 ej(                  g d,)      d-        Z3ej(                  d.        Z4ej(                  d/        Z5yc c}} w )0    )annotationsN)HAS_PYARROW)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     g/var/www/html/diagnosisapp-backend/venv/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_table5   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_warnings9   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.   K   s    F:r   r.   c                      e Zd ZdZy)CParserHighMemoryFNr(   r)   r*   r   r,   r   r   r4   r4   P   s    Jr   r4   c                      e Zd ZdZy)CParserLowMemoryTNr5   r,   r   r   r7   r7   T   s    Jr   r7   c                      e Zd ZdZdgZy)PythonParserpythonNr2   r,   r   r   r9   r9   X   s    F#fr   r9   c                      e Zd ZdZdgZy)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    
 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?   rA   csvz	test1.csv)ospathjoinrB   s    r   csv1rJ   j   s"    
 77<<vu5{CCr   pyarrow is not installedreasonmarksr:   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_parsersr\      sH    
 ]]_F}}	!Ix	':; 	a Mr   c                "    | j                         S )z<
    Fixture all of the CSV parsers using the C engine.
    rW   r[   s    r   c_parser_onlyr`          
 ==?r   c                "    | j                         S )zA
    Fixture all of the CSV parsers using the Python engine.
    r^   r_   s    r   python_parser_onlyrc      ra   r   c                "    | j                         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(  r@t        j                  j                  t        j                  j                  t         d      gnd}t        j                   |       |f|      }| j                  |       |j                  | 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	68$]]1%F77 	3I ==I- KK**KK&&'0J '    LL&(I!6dCEMM% JJ)Ai[12	3	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UTFz{0})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| 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.
    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	%)=)=	=(()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
    r\   ru   r   Nr=   z,https://github.com/apache/arrow/issues/38676rL   )r   r   r
   rX   skip)r[   r@   s     r   pyarrow_skipr   B  sg     ,,,((7	%)=)=	=(()EFqI}}	!I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_seps_encoding_prefixes_encoding_fmtsr~   r   r   r   r   )sepprefixs   00r   <module>r      s   " 	  % , 7/ 7/t;j ;
 w %: %
%J %
 , , D D ' $ !? %'89FLLKK""KK;7QR
  M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/