o
    �¨Êh"  ã                   @  s,  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„ dƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZejdd„ ƒZejdd„ ƒZeZeZeZeZegZeegZejeejjd�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�dd„ ƒZ$ejee!d�dd„ ƒZ%ejee d�dd „ ƒZ&ejee"d�d!d"„ ƒZ'd#d$„ Z(eje(ƒ d% e(ƒ d& d�d'd(„ ƒZ)g d)¢Z*g d*¢Z+d+d,gZ,d-d.„ e+D ƒZ-eje*d/�d0d1„ ƒZ.eje-d/�d2d3„ ƒZ/ejg d4¢d/�d5d6„ ƒZ0ejd7d8„ ƒZ1ejd9d:„ ƒZ2dS );é    )ÚannotationsN)ÚVERSIONS)Úread_csvÚ
read_tablec                   @  sd   e Zd ZU dZded< dZg Zded< dd„ Zd	d
„ Zdddœddd„Z	dd„ Z
ddœddd„ZdS )Ú
BaseParserNz
str | NoneÚengineTzlist[str | None]Úfloat_precision_choicesc                 C  s    |  ¡ }| | j| jdœ¡ |S )N)r   Ú
low_memory)ÚcopyÚupdater   r	   )ÚselfÚkwargs© r   úQ/var/www/html/env/lib/python3.10/site-packages/pandas/tests/io/parser/conftest.pyÚupdate_kwargs   s   zBaseParser.update_kwargsc                 O  ó   |   |¡}t|i |¤ŽS ©N)r   r   ©r   Úargsr   r   r   r   r      ó   
zBaseParser.read_csv)Úraise_on_extra_warningsÚcheck_stacklevelÚ	warn_typeútype[Warning]Úwarn_msgÚstrr   Úboolc                O  sN   |   |¡}tj||||d�� t|i |¤ŽW  d   ƒ S 1 s w   Y  d S )N)Úmatchr   r   )r   ÚtmÚassert_produces_warningr   )r   r   r   r   r   r   r   r   r   r   Úread_csv_check_warnings   s   
ü$úz"BaseParser.read_csv_check_warningsc                 O  r   r   )r   r   r   r   r   r   r   4   r   zBaseParser.read_table)r   c                O  sL   |   |¡}tj|||d�� t|i |¤ŽW  d   ƒ S 1 sw   Y  d S )N)r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   Úread_table_check_warnings8   s   
ÿ$ýz$BaseParser.read_table_check_warnings)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   r      s   
 	ú	ûr   c                   @  s   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    r&   c                   @  ó   e Zd ZdZdS )ÚCParserHighMemoryFN©r"   r#   r$   r	   r   r   r   r   r,   O   ó    r,   c                   @  r+   )ÚCParserLowMemoryTNr-   r   r   r   r   r/   S   r.   r/   c                   @  ó   e Zd ZdZdgZdS )ÚPythonParserÚpythonNr*   r   r   r   r   r1   W   ó    
r1   c                   @  r0   )ÚPyArrowParserÚpyarrowNr*   r   r   r   r   r4   \   r3   r4   c                 C  s   | dddƒS )zG
    The directory path to the data files needed for parser tests.
    ÚioÚparserÚdatar   ©Údatapathr   r   r   Úcsv_dir_patha   s   r;   c                 C  s   t j | dddƒd¡S )zH
    The path to the data file "test1.csv" needed for parser tests.
    r6   r8   Úcsvz	test1.csv)ÚosÚpathÚjoinr9   r   r   r   Úcsv1i   s   r@   ©Úmarksr2   Úc_highÚc_lowr5   ©ÚparamsÚidsc                 C  s8   |   ¡ }|jdkrt dtd ¡ ddl}| d¡ |S )z)
    Fixture all of the CSV parsers.
    r5   r   Né   )Úparamr   ÚpytestÚimportorskipr   r5   Úset_cpu_count)Úrequestr7   r5   r   r   r   Úall_parsersƒ   s   

rN   c                 C  ó   |   ¡ S )z<
    Fixture all of the CSV parsers using the C engine.
    ©rI   ©rM   r   r   r   Úc_parser_only“   ó   rR   c                 C  rO   )zA
    Fixture all of the CSV parsers using the Python engine.
    rP   rQ   r   r   r   Úpython_parser_only›   rS   rT   c                 C  rO   )zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    rP   rQ   r   r   r   Úpyarrow_parser_only£   rS   rU   c                  C  sŽ   g } g }t ttƒD ]8\}}t|dƒr|jd }|jD ]&}|jdkr%tjj	nd}tj
|ƒ |f|d�}|  |¡ | |› d|› �¡ qq	| |dœS )za
    Return all allowable parser and float precision
    combinations and corresponding ids.
    Úvaluesr   r5   r   rA   ú-rE   )ÚzipÚ_all_parsersÚ_all_parser_idsÚhasattrrV   r   r   rJ   ÚmarkÚ
single_cpurI   Úappend)rF   rG   r7   Ú	parser_idÚ	precisionr\   rI   r   r   r   Ú,_get_all_parser_float_precision_combinations«   s   



û
ra   rF   rG   c                 C  ó   | j S )zR
    Fixture for all allowable combinations of parser
    and float precision
    rP   rQ   r   r   r   Úall_parsers_all_precisionsÀ   s   	rc   )é   é   é    )Ú rW   Ú_ÚutfÚUTFc                 C  s$   g | ]}t D ]	}|› |› d �‘qqS )z{0})Ú_encoding_prefixes)Ú.0ÚsepÚprefixr   r   r   Ú
<listcomp>Ñ   s
    ÿÿro   )rF   c                 C  rb   )zE
    Fixture for all possible integer values for a UTF encoding.
    rP   rQ   r   r   r   Ú	utf_valueÖ   ó   rp   c                 C  rb   )zD
    Fixture for all possible string formats of a UTF encoding.
    rP   rQ   r   r   r   Úencoding_fmtÞ   rq   rr   )*)z-1,0ç      ð¿)z-1,2e0g333333ó¿)z-1e0rs   )z+1e0ç      ð?)z+1e+0rt   )z+1e-1çš™™™™™¹?)z+,1e1rt   )z+1,e0rt   )z-,1e1rs   )z-1,e0rs   )z0,1ru   )z1,rt   )z,1ru   )z-,1gš™™™™™¹¿)z1_,rt   )z1_234,56ç
×£p=J“@)z
1_234,56e0rv   )rh   rh   )ú-_rw   )ú-_1rx   )ú-_1e0ry   )Ú_1rz   )ú_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                 C  rb   )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.
    rP   rQ   r   r   r   Únumeric_decimalæ   s   4r�   c                 C  s^   d| j v r|  d¡}nd| j v r|  d¡d }ndS |jdkr-tjjd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.
    rN   rc   r   Nr5   zpyarrow doesn't support this.©Úreason)ÚfixturenamesÚgetfixturevaluer   rJ   r\   ÚxfailÚapplymarker)rM   r7   r\   r   r   r   Úpyarrow_xfail  s   


þr”   c                 C  sR   d| j v r|  d¡}nd| j v r|  d¡d }ndS |jdkr'tjd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
    rN   rc   r   Nr5   z,https://github.com/apache/arrow/issues/38676rŽ   )r�   r‘   r   rJ   Úskip)rM   r7   r   r   r   Úpyarrow_skip0  s   


ÿr–   )3Ú
__future__r   r=   rJ   Úpandas.compat._optionalr   Úpandasr   r   Úpandas._testingÚ_testingr   r   r&   r,   r/   r1   r4   Úfixturer;   r@   Ú_cParserHighMemoryÚ_cParserLowMemoryÚ_pythonParserÚ_pyarrowParserÚ_py_parsers_onlyÚ_c_parsers_onlyrI   r\   r]   Ú_pyarrow_parsers_onlyrY   Ú_py_parser_idsÚ_c_parser_idsÚ_pyarrow_parsers_idsrZ   rN   rR   rT   rU   ra   rc   Ú_utf_valuesÚ_encoding_sepsrk   Ú_encoding_fmtsrp   rr   r�   r”   r–   r   r   r   r   Ú<module>   sx    :





þ
ÿ



ÿ
/
