o
    i*                     @   sX   d dl 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
mZ dd Zdd ZdS )	    N)assert_)raises)ReentrancyLocknon_reentrantReentrancyErrorc                     sv   t ddgg   fddfddtdD } | D ]}|  q| D ]}|  q'd  t    d S )	NZfailureFc                    s   z3& t d   dd< td|   t d  dd< W d    W d S 1 s,w   Y  W d S  tyE    td Y d S w )Nr   Tg?F   )r   timesleep	Exceptionappend	traceback
format_exck)exceptions_raisedfailflaglock ]/home/kim/smarthome/.venv/lib/python3.10/site-packages/scipy/_lib/tests/test__threadsafety.pyworker   s   
&z%test_parallel_threads.<locals>.workerc                    s$   g | ]}t j|f fd d	dqS )c                        | S Nr   r   r   r   r   <lambda>!   s    z2test_parallel_threads.<locals>.<listcomp>.<lambda>)target)	threadingThread).0r   r   r   r   
<listcomp>!   s    z)test_parallel_threads.<locals>.<listcomp>   
)r   rangestartjoinr   )threadstr   )r   r   r   r   r   test_parallel_threads   s   



r&   c                      s"   t   fdd tt d d S )Nc                    r   r   r   )xfuncr   r   r)   /   s   ztest_reentering.<locals>.funcr   )r   assert_raisesr   r   r   r(   r   test_reentering,   s   r+   )r   r   r   Znumpy.testingr   Zpytestr   r*   Zscipy._lib._threadsafetyr   r   r   r&   r+   r   r   r   r   <module>   s    !