o
    l¨Êh—  ã                   @   st   d dl Z d dlmZmZ d dlmZ d dlmZ d dlm	Z	m
Z
 edd„ ƒZeddd	gƒed
ddgƒdd„ ƒƒZdS )é    N)Úmake_memmapÚconcurrency_safe_rename)Ú
with_numpy)Úparametrize)ÚParallelÚdelayedc                 C   sB   |   d¡j}dtj }tjd }t||d|d�}|j|ksJ ‚d S )Nz	test.mmapé   é   zw+)ÚshapeÚmodeÚoffset)ÚjoinÚstrpathÚmmapÚALLOCATIONGRANULARITYr   r   )ÚtmpdirÚfnameÚsizer   Ú
memmap_obj© r   úL/var/www/html/env/lib/python3.10/site-packages/joblib/test/test_backports.pyÚtest_memmap	   s
   

r   Údst_contentzdst contentÚbackendÚ	threadingc                    sš   ‡fdd„t dƒD ƒ}|D ]}| d¡ qˆ d¡‰ |d ur#ˆ  |¡ td|d�‡ fdd„|D ƒƒ ˆ  ¡ s8J ‚ˆ  ¡ dks@J ‚|D ]}| ¡ rJJ ‚qBd S )	Nc                    s   g | ]	}ˆ   d | ¡‘qS )zsrc_%d)r   )Ú.0Úi)r   r   r   Ú
<listcomp>   s    z0test_concurrency_safe_rename.<locals>.<listcomp>é   zsrc contentÚdst)Ún_jobsr   c                 3   s"   � | ]}t tƒ|jˆ jƒV  qd S )N)r   r   r   )r   Úsrc_path)Údst_pathr   r   Ú	<genexpr>   s
   € ÿ
ÿz/test_concurrency_safe_rename.<locals>.<genexpr>)ÚrangeÚwriter   r   ÚexistsÚread)r   r   r   Ú	src_pathsr!   r   )r"   r   r   Útest_concurrency_safe_rename   s   

þÿr)   )r   Újoblib.backportsr   r   Újoblib.test.commonr   Újoblib.testingr   Újoblibr   r   r   r)   r   r   r   r   Ú<module>   s    
