U
    j/eF!                     @   s  d dl Z d dlZd dlmZ d dlmZ d dlZdddddd	d
ddddddddddddddddddddgZdededddddddd eddddedddddddd ddeddedd!Z	zd dl
Z
d e	d< W n ek
r   Y nX zd dlZd e	d
< W n ek
r   Y nX zd dlZd e	d< W n ek
rJ   Y nX zd dlZd e	d< W n ek
rv   Y nX zd dlZd e	d< W n ek
r   Y nX zd dlZd e	d< W n ek
r   Y nX zd dlZd e	d< W n ek
r   d e	d< Y nX zd dlZd e	d< W n ek
r.   Y nX zd dlZd e	d< W n ek
rZ   Y nX zd dlZd e	d< W n ek
r   Y nX zd d"lmZ d e	d< W n ek
r   Y nX zd d#lmZ d e	d< W n ek
r   Y nX zd d$lmZ d e	d< W n ek
r   Y nX zd dlZd e	d< W n ek
rB   Y nX d%d& Ze jd d'd(d) Ze jd d'd*d+ Ze jd,d-d.d/ Ze jd,d-d0d1 Ze jd,d-d2d3 Z dS )4    N)Codec)fsacerobrotlibz2cythondataset
hypothesisfastparquetgandivagcsgdbgziphdfslarge_memorylz4memory_leaknopandasorcpandasparquetparquet_encryptions3snappy	substraitflightslowrequires_testing_datazstdFT)r   r   r   r   r   r
   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )GcsFileSystemS3FileSystem)HadoopFileSystemc                 C   s  |j jrdt| krdS dddddg}|D ]$}d|t| kr*t| s* dS q*d	t| krhtd
 shdS dt| krzdd l}W dS  tk
r   Y dS X dt| krzddlm} W dS  tk
r   Y dS X t	|j ddrdt| k rdS dt| krdS dS )Nz/pyarrow/tests/Tr   r   r   r   r   z
pyarrow/{}zpyarrow/parquet/encryptionr   zpyarrow/cudar   Fz
pyarrow/fsr    doctest_cythonz/pyarrow/_parquet_encryption)
optiondoctestmodulesstrformatdefaultsZpyarrow.cudaImportError
pyarrow.fsr!   getattr)pathconfigZdoctest_groupsgrouppyarrowr!    r0   4/tmp/pip-unpacked-wheel-seu8352k/pyarrow/conftest.pypytest_ignore_collect   sD    	r2   )Zautousec              	   c   sR   | j jj}t| j jdd}|s"|rH| d}|  d V  W 5 Q R X nd V  d S )Nr#   Ftmpdir)r-   r$   r%   r+   ZgetfixturevalueZas_cwd)request	doctest_m	doctest_cr3   r0   r0   r1   _docdir   s    


r7   c              	   c   s   |j jj}t|j jdd}|s"|r~t| d< t }|d }|t|}|d W 5 Q R X || d< t|| d< t|| d< d V  d S )	Nr#   Fr   zpyarrow-fs-example.dats   datalocal
local_pathr,   )	r-   r$   r%   r+   r   ZLocalFileSystemZopen_output_streamr&   write)Zdoctest_namespacer4   Ztmp_pathr5   r6   r8   r,   streamr0   r0   r1   add_fs   s    
r<   session)Zscopec                     sL   ddl m   fdd} d}ddd} | ||d	t it  | |fS )
z+
    Register a unary scalar function.
    r   computec                    s    j d|dg| jdS )Nadd   )memory_pool)call_functionrB   ctxxpcr0   r1   unary_function  s    z*unary_func_fixture.<locals>.unary_functionzy=x+1zadd functionztest add functionsummarydescriptionarray)r/   r?   Zregister_scalar_functionpaint64)rI   	func_nameZ	unary_docr0   rG   r1   unary_func_fixture  s    
rQ   c                  C   sH   ddl m}  dd }d}ddd}| |||d	t it  ||fS )
z4
    Register a unary aggregate function (mean)
    r   r>   c                 S   s   t t|S )N)rN   scalarnpnanmeanrD   r0   r0   r1   func$  s    z$unary_agg_func_fixture.<locals>.funcZmean_udfzy=avg(x)zfind mean of xrJ   rF   )r/   r?   register_aggregate_functionrN   float64rH   rU   rP   Zfunc_docr0   r0   r1   unary_agg_func_fixture  s     rY   c                  C   sN   ddl m}  dd }d}ddd}| |||t t dt  ||fS )	z-
    Register a unary aggregate function
    r   r>   c                 W   s&   d}|D ]}|t |7 }qt|S )Ng        )rS   rT   rN   rR   )rE   argssumargr0   r0   r1   rU   =  s    z&varargs_agg_func_fixture.<locals>.funcZsum_meanzVarargs aggregaterJ   )rF   y)r/   r?   rV   rN   rO   rW   rX   r0   r0   r1   varargs_agg_func_fixture6  s    	r^   )!Zpytestr/   rN   r   r   ZnumpyrS   groupsZis_availabler(   r   r)   r
   Zpyarrow.gandivaZpyarrow.aceroZpyarrow.datasetZpyarrow.orcr   Zpyarrow.parquetZpyarrow.parquet.encryptionZpyarrow.flightr*   r   r!   r"   Zpyarrow.substraitr2   Zfixturer7   r<   rQ   rY   r^   r0   r0   r0   r1   <module>   s  0








