U
    ÎZjê  ã                +   @  st  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eee•ZdgZ ddgZ!dgZ"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)d)d*d+gZ*d,d-d.gZ+d/d0gZ,d1d2„ e+D ƒZ-eje*d3�d4d5„ ƒZ.eje-d3�d6d7„ ƒZ/ejd8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dag*d3�dbdc„ ƒZ0ejddde„ ƒZ1ejdfdg„ ƒZ2dS )hé    )ÚannotationsN)ÚVERSIONS)Úread_csvÚ
read_tablec                   @  sb   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„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   úb/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/site-packages/pandas/tests/io/parser/conftest.pyÚupdate_kwargs   s    zBaseParser.update_kwargsc                 O  s   |   |¡}t||ŽS ©N)r   r   ©r   Úargsr   r   r   r   r      s    
zBaseParser.read_csvztype[Warning]Ústr)Ú	warn_typeÚwarn_msgc              
   O  s:   |   |¡}tj||d�� t||ŽW  5 Q R £ S Q R X d S ©N)Úmatch)r   ÚtmÚassert_produces_warningr   ©r   r   r   r   r   r   r   r   Úread_csv_check_warnings   s    
z"BaseParser.read_csv_check_warningsc                 O  s   |   |¡}t||ŽS r   )r   r   r   r   r   r   r   )   s    
zBaseParser.read_tablec              
   O  s:   |   |¡}tj||d�� t||ŽW  5 Q R £ S Q R X d S r   )r   r   r   r   r   r   r   r   Úread_table_check_warnings-   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dddgZdS )ÚCParserÚcNÚhighZ
round_trip©r   r   r    r   r   r   r   r   r   r"   8   s   r"   c                   @  s   e Zd ZdZdS )ÚCParserHighMemoryFN©r   r   r    r	   r   r   r   r   r&   =   s   r&   c                   @  s   e Zd ZdZdS )ÚCParserLowMemoryTNr'   r   r   r   r   r(   A   s   r(   c                   @  s   e Zd ZdZdgZdS )ÚPythonParserÚpythonNr%   r   r   r   r   r)   E   s   r)   c                   @  s   e Zd ZdZdgZdS )ÚPyArrowParserÚpyarrowNr%   r   r   r   r   r+   J   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_pathO   s    r2   c                 C  s   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Újoinr0   r   r   r   Úcsv1W   s    r7   ©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)Úrequestr.   r,   r   r   r   Úall_parsersq   s    

r@   c                 C  s   |   ¡ S )z<
    Fixture all of the CSV parsers using the C engine.
    ©r=   ©r?   r   r   r   Úc_parser_only�   s    rC   c                 C  s   |   ¡ S )zA
    Fixture all of the CSV parsers using the Python engine.
    rA   rB   r   r   r   Úpython_parser_only‰   s    rD   c                 C  s   |   ¡ S )zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    rA   rB   r   r   r   Úpyarrow_parser_only‘   s    rE   c                  C  sŽ   g } g }t ttƒD ]p\}}t|dƒr.|jd }|jD ]L}|jdkrJtjj	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   r8   ú-r9   )ÚzipÚ_all_parsersÚ_all_parser_idsÚhasattrrF   r   r   r>   ÚmarkÚ
single_cpur=   Úappend)r:   r;   r.   Z	parser_idÚ	precisionrL   r=   r   r   r   Ú,_get_all_parser_float_precision_combinations™   s    



rP   r:   r;   c                 C  s   | j S )zR
    Fixture for all allowable combinations of parser
    and float precision
    rA   rB   r   r   r   Úall_parsers_all_precisions®   s    	rQ   é   é   é    Ú rG   Ú_ÚutfZUTFc                 C  s&   g | ]}t D ]}|› |› �d  ‘qqS )z{0})Ú_encoding_prefixes)Ú.0ÚsepÚprefixr   r   r   Ú
<listcomp>¿   s      r\   )r:   c                 C  s   | j S )zE
    Fixture for all possible integer values for a UTF encoding.
    rA   rB   r   r   r   Ú	utf_valueÄ   s    r]   c                 C  s   | j S )zD
    Fixture for all possible string formats of a UTF encoding.
    rA   rB   r   r   r   Úencoding_fmtÌ   s    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,1ra   )z1,r`   )z,1ra   )z-,1gš™™™™™¹¿)z1_,r`   )z1_234,56ç
×£p=J“@)z
1_234,56e0rb   )rV   rV   )ú-_rc   )ú-_1rd   )ú-_1e0re   )Ú_1rf   )ú_1,rg   )ú_1,_rh   )Ú_1e0ri   )ú1,2e_1rj   )ú1,2e1_0rk   )ú1,_2rl   )ú,1__2rm   )ú,1ern   )ú-,1ero   )ú1_000,000_000rp   )ú1,e1_2rq   )úe11,2rr   )ú1e11,2rs   )ú1,2,2rt   )ú1,2_1ru   )ú	1,2e-10e1rv   )ú--1,2rw   )ú1a_2,1rx   )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.
    rA   rB   r   r   r   Únumeric_decimalÔ   s    4ry   c                 C  s\   d| j kr|  d¡}nd| j kr0|  d¡d }ndS |jdkrXtjjdd�}| j |¡ dS )z>
    Fixture that xfails a test if the engine is pyarrow.
    r@   rQ   r   Nr,   úpyarrow doesn't support this.)Úreason)ÚfixturenamesÚgetfixturevaluer   r>   rL   ZxfailÚnodeZ
add_marker)r?   r.   rL   r   r   r   Úpyarrow_xfail  s    


r   c                 C  sL   d| j kr|  d¡}nd| j kr0|  d¡d }ndS |jdkrHt d¡ dS )z=
    Fixture that skips a test if the engine is pyarrow.
    r@   rQ   r   Nr,   rz   )r|   r}   r   r>   Úskip)r?   r.   r   r   r   Úpyarrow_skip  s    


r�   )3Ú
__future__r   r4   r>   Zpandas.compat._optionalr   Zpandasr   r   Zpandas._testingZ_testingr   r   r"   r&   r(   r)   r+   Zfixturer2   r7   Z_cParserHighMemoryZ_cParserLowMemoryZ_pythonParserZ_pyarrowParserZ_py_parsers_onlyZ_c_parsers_onlyr=   rL   rM   Z_pyarrow_parsers_onlyrI   Z_py_parser_idsZ_c_parser_idsZ_pyarrow_parsers_idsrJ   r@   rC   rD   rE   rP   rQ   Z_utf_valuesZ_encoding_sepsrX   Z_encoding_fmtsr]   r^   ry   r   r�   r   r   r   r   Ú<module>   sÊ   (







þ


ÿ



Õÿ/

