a
    é´«j¸#  ã                   @  sJ  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„ 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ejj e dd�g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/d0d1„ e.D ƒZ0eje-d2�d3d4„ ƒZ1eje0d2�d5d6„ ƒZ2ejg d7¢d2�d8d9„ ƒZ3ejd:d;„ ƒZ4ejd<d=„ ƒZ5dS )>é    )ÚannotationsN)ÚHAS_PYARROW)ÚVERSIONS)Úread_csvÚ
read_tablec                   @  sr   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dœdd„Z	dd„ Z
ddœ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   ú^/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/pandas/tests/io/parser/conftest.pyÚupdate_kwargs   s    zBaseParser.update_kwargsc                 O  s   |   |¡}t|i |¤ŽS ©N)r   r   ©r   Úargsr   r   r   r   r      s    
zBaseParser.read_csv)Úraise_on_extra_warningsÚcheck_stacklevelztype[Warning]ÚstrÚbool)Ú	warn_typeÚwarn_msgr   c                O  sN   |   |¡}tj||||d�� t|i |¤ŽW  d   ƒ S 1 s@0    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  s   |   |¡}t|i |¤ŽS r   )r   r   r   r   r   r   r   5   s    
zBaseParser.read_table)r   )r   r   c                O  sL   |   |¡}tj|||d�� t|i |¤ŽW  d   ƒ S 1 s>0    Y  d S )N)r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   Úread_table_check_warnings9   s
    
ÿz$BaseParser.read_table_check_warnings)Ú__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ÚhighZ
round_tripN©r    r!   r"   r   r	   r   r   r   r   r$   K   s   r$   c                   @  s   e Zd ZdZdS )ÚCParserHighMemoryFN©r    r!   r"   r
   r   r   r   r   r(   P   s   r(   c                   @  s   e Zd ZdZdS )ÚCParserLowMemoryTNr)   r   r   r   r   r*   T   s   r*   c                   @  s   e Zd ZdZdgZdS )ÚPythonParserÚpythonNr'   r   r   r   r   r+   X   s   r+   c                   @  s   e Zd ZdZdgZdS )ÚPyArrowParserÚpyarrowNr'   r   r   r   r   r-   ]   s   r-   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_pathb   s    r4   c                 C  s   t j | dddƒd¡S )zH
    The path to the data file "test1.csv" needed for parser tests.
    r/   r1   Úcsvz	test1.csv)ÚosÚpathÚjoinr2   r   r   r   Úcsv1j   s    r9   úpyarrow is not installed©Úreason©Zmarksr,   Zc_highZc_lowr.   ©ÚparamsÚidsc                 C  s8   |   ¡ }|jdkr4t dtd ¡ ddl}| d¡ |S )z)
    Fixture all of the CSV parsers.
    r.   r   Né   )Úparamr   ÚpytestZimportorskipr   r.   Zset_cpu_count)Úrequestr0   r.   r   r   r   Úall_parsersŒ   s    

rE   c                 C  s   |   ¡ S )z<
    Fixture all of the CSV parsers using the C engine.
    ©rB   ©rD   r   r   r   Úc_parser_onlyœ   s    rH   c                 C  s   |   ¡ S )zA
    Fixture all of the CSV parsers using the Python engine.
    rF   rG   r   r   r   Úpython_parser_only¤   s    rI   c                 C  s   |   ¡ S )zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    rF   rG   r   r   r   Úpyarrow_parser_only¬   s    rJ   c                  C  s    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d�gnd}tj|ƒ |f|d�}|  |¡ | |› d|› �¡ q4q| |d	œS )
za
    Return all allowable parser and float precision
    combinations and corresponding ids.
    Úvaluesr   r.   r:   r;   r   r=   ú-r>   )ÚzipÚ_all_parsersÚ_all_parser_idsÚhasattrrK   r	   r   rC   ÚmarkÚ
single_cpuÚskipifr   rB   Úappend)r?   r@   r0   Z	parser_idÚ	precisionrQ   rB   r   r   r   Ú,_get_all_parser_float_precision_combinations´   s&    


	úÿþø

rV   r?   r@   c                 C  s   | j S )zR
    Fixture for all allowable combinations of parser
    and float precision
    rF   rG   r   r   r   Úall_parsers_all_precisionsÒ   s    	rW   )é   é   é    )Ú rL   Ú_ÚutfZUTFc                 C  s$   g | ]}t D ]}|› |› d �‘qqS )z{0})Ú_encoding_prefixes)Ú.0ÚsepÚprefixr   r   r   Ú
<listcomp>ã   s   rb   )r?   c                 C  s   | j S )zE
    Fixture for all possible integer values for a UTF encoding.
    rF   rG   r   r   r   Ú	utf_valueè   s    rc   c                 C  s   | j S )zD
    Fixture for all possible string formats of a UTF encoding.
    rF   rG   r   r   r   Úencoding_fmtð   s    rd   )*)z-1,0ç      ð¿)z-1,2e0g333333ó¿)z-1e0re   )z+1e0ç      ð?)z+1e+0rf   )z+1e-1çš™™™™™¹?)z+,1e1rf   )z+1,e0rf   )z-,1e1re   )z-1,e0re   )z0,1rg   )z1,rf   )z,1rg   )z-,1gš™™™™™¹¿)z1_,rf   )z1_234,56ç
×£p=J“@)z
1_234,56e0rh   )r\   r\   )ú-_ri   )ú-_1rj   )ú-_1e0rk   )Ú_1rl   )ú_1,rm   )ú_1,_rn   )Ú_1e0ro   )ú1,2e_1rp   )ú1,2e1_0rq   )ú1,_2rr   )ú,1__2rs   )ú,1ert   )ú-,1eru   )ú1_000,000_000rv   )ú1,e1_2rw   )úe11,2rx   )ú1e11,2ry   )ú1,2,2rz   )ú1,2_1r{   )ú	1,2e-10e1r|   )ú--1,2r}   )ú1a_2,1r~   )z1,2E-1g¸…ëQ¸¾?)z1,2E1g      (@c                 C  s   | 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.
    rF   rG   r   r   r   Únumeric_decimalø   s    4r   c                 C  sZ   d| j v r|  d¡}nd| j v r0|  d¡d }ndS |jdkrVtjjdd�}|  |¡ dS )z‰
    Fixture that xfails a test if the engine is pyarrow.

    Use if failure is do to unsupported keywords or inconsistent results.
    rE   rW   r   Nr.   zpyarrow doesn't support this.r;   )ÚfixturenamesÚgetfixturevaluer   rC   rQ   ZxfailZapplymarker)rD   r0   rQ   r   r   r   Úpyarrow_xfail/  s    


r‚   c                 C  sN   d| j v r|  d¡}nd| j v r0|  d¡d }ndS |jdkrJtjdd� 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
    rE   rW   r   Nr.   z,https://github.com/apache/arrow/issues/38676r;   )r€   r�   r   rC   Úskip)rD   r0   r   r   r   Úpyarrow_skipB  s    


r„   )6Ú
__future__r   r6   rC   Zpandas.compatr   Zpandas.compat._optionalr   Zpandasr   r   Zpandas._testingZ_testingr   r   r$   r(   r*   r+   r-   Zfixturer4   r9   Z_cParserHighMemoryZ_cParserLowMemoryZ_pythonParserZ_pyarrowParserZ_py_parsers_onlyZ_c_parsers_onlyrB   rQ   rR   rS   Z_pyarrow_parsers_onlyrN   Z_py_parser_idsZ_c_parser_idsZ_pyarrow_parsers_idsrO   rE   rH   rI   rJ   rV   rW   Z_utf_valuesZ_encoding_sepsr^   Z_encoding_fmtsrc   rd   r   r‚   r„   r   r   r   r   Ú<module>   s„   :

þþÿ




þ
ÿ



ÿ/

