
    4[g                     N    d dl Z d dlZg dZ G d de      Z G d d      ZddZy)	    N)ReentrancyErrorReentrancyLocknon_reentrantc                       e Zd Zy)r   N)__name__
__module____qualname__     S/var/www/html/bid-api/venv/lib/python3.12/site-packages/scipy/_lib/_threadsafety.pyr   r   	   s    r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)r   a   
    Threading lock that raises an exception for reentrant calls.

    Calls from different threads are serialized, and nested calls from the
    same thread result to an error.

    The object can be used as a context manager or to decorate functions
    via the decorate() method.

    c                 R    t        j                         | _        d| _        || _        y NF)	threadingRLock_rlock_entered_err_msg)selferr_msgs     r   __init__zReentrancyLock.__init__   s    oo'r   c                     | j                   j                          | j                  r/| j                   j                          t	        | j
                        d| _        y )NT)r   acquirer   releaser   r   )r   s    r   	__enter__zReentrancyLock.__enter__   s?    ==KK!!$--00r   c                 F    d| _         | j                  j                          y r   )r   r   r   )r   typevalue	tracebacks       r   __exit__zReentrancyLock.__exit__%   s    r   c                 b      fd}t         j                  j                  j                  ||      S )Nc                 D    5   | |i |cd d d        S # 1 sw Y   y xY wNr
   )funcakwr   s      r   callerz'ReentrancyLock.decorate.<locals>.caller*   s    Q~"~ s   )scipy_lib	decoratordecorate)r   r$   r'   s   `  r   r+   zReentrancyLock.decorate)   s'    	& zz##,,T6::r   N)r   r   r	   __doc__r   r   r    r+   r
   r   r   r   r      s    	 
;r   r   c                       fd}|S )zP
    Decorate a function with a threading lock and prevent reentrant calls.
    c                 b    }|d| j                   z  }t        |      }|j                  |       S )Nz%s is not re-entrant)r   r   r+   )r$   msglockr   s      r   r*   z non_reentrant.<locals>.decorator4   s4    ;(4==8Cc"}}T""r   r
   )r   r*   s   ` r   r   r   0   s    # r   r#   )r   scipy._lib.decoratorr(   __all__RuntimeErrorr   r   r   r
   r   r   <module>r4      s/      A	l 	 ;  ;F
r   