a
    j=ic                     @   s   d dl mZ d dlZd dlZd dlZd dlmZ edZdej	_
dej	_dej	_dd Zdd	 Zd
d ZedddZedd Zdd ZdS )    )contextmanagerN)HDFStoretables   c                 C   s.   | d ur*zt |  W n ty(   Y n0 d S N)osremoveOSErrorpath r   p/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/pandas/tests/io/pytables/common.pysafe_remove   s
    r   c                 C   s,   z| d ur|    W n ty&   Y n0 d S r   )closer	   )storer   r   r   
safe_close   s
    r   c                 C   s   t jt | S )z'create an unopened named temporary file)r   r   jointempfile
gettempdirr
   r   r   r   create_tempfile    s    r   aFc                 c   s|   zTt tj| st| } t| |||dd}|V  W t| |dksL|dkrxt|  n"t| |dksn|dkrvt|  0 d S )NF)mode	complevelcomplib
fletcher32wr   )lenr   r   dirnamer   r   r   r   )r   r   r   r   r   r   r   r   r   ensure_clean_store&   s    

r   c              	   c   sd   zJt | tr"dd | D }|V  nt| g}|d V  W |D ]}t| q<n|D ]}t| qP0 dS )z
    return essentially a named temporary file that is not opened
    and deleted on exiting; if path is a list, then create and
    return list of filenames
    c                 S   s   g | ]}t |qS r   )r   ).0pr   r   r   
<listcomp>B       z%ensure_clean_path.<locals>.<listcomp>r   N)
isinstancelistr   r   )r   	filenamesfr   r   r   ensure_clean_path9   s    

r'   c              	   C   s*   z|  | W n ttfy$   Y n0 dS )z
    For tests using tables, try removing the table to be sure there is
    no content from previous tests using the same table name.
    N)r   
ValueErrorKeyError)r   keyr   r   r   _maybe_removeL   s    r+   )r   NNF)
contextlibr   r   r   ZpytestZpandas.io.pytablesr   Zimportorskipr   
parametersZMAX_NUMEXPR_THREADSZMAX_BLOSC_THREADSZMAX_THREADSr   r   r   r   r'   r+   r   r   r   r   <module>   s    

