o
    /wiw                     @  sB   d dl mZ d dlmZ d dlZd dlmZ G dd dejZdS )    )annotations)CallableN)Anyc                      s4   e Zd ZdddZdd	d
Zdd fddZ  ZS )_TestableThreadtargetCallable[..., Any]argstuplec                 C  s   t jj| ||d d | _d S )N)r   r   )	threadingThread__init__exc)selfr   r    r   U/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/optuna/testing/threading.pyr   	   s   
z_TestableThread.__init__returnNonec              
   C  s@   z	t j|  W d S  ty } z
|| _W Y d }~d S d }~ww N)r
   r   runBaseExceptionr   )r   er   r   r   r      s   z_TestableThread.runNtimeoutfloat | Nonec                   s    t t| | | jr| jd S r   )superr   joinr   )r   r   	__class__r   r   r      s   z_TestableThread.join)r   r   r   r	   )r   r   r   )r   r   r   r   )__name__
__module____qualname__r   r   r   __classcell__r   r   r   r   r      s    

r   )	
__future__r   collections.abcr   r
   typingr   r   r   r   r   r   r   <module>   s
    