L iNddlZddlZgdZGddeZGddZddZy) N)ReentrancyErrorReentrancyLock non_reentrantc eZdZy)rN)__name__ __module__ __qualname__^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/_lib/_threadsafety.pyrr sr rc(eZdZdZdZdZdZdZy)ra  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. cRtj|_d|_||_yNF) threadingRLock_rlock_entered_err_msg)selferr_msgs r __init__zReentrancyLock.__init__soo'   r c|jj|jr/|jjt |j d|_y)NT)racquirerreleaserr)rs r __enter__zReentrancyLock.__enter__s?  == KK   !!$--0 0 r cFd|_|jjyr)rrr)rtypevalue tracebacks r __exit__zReentrancyLock.__exit__%s  r cbfd}tjjj||S)NcD5||i|cdddS#1swYyxYwNr )funcakwrs r callerz'ReentrancyLock.decorate..caller*s& &Q~"~ & & &s)scipy_lib decoratordecorate)rr$r's` r r+zReentrancyLock.decorate)s' &zz##,,T6::r N)rrr __doc__rrr r+r r r rr s  ;r rcfd}|S)zP Decorate a function with a threading lock and prevent reentrant calls. cb}||jd}t|}|j|S)Nz is not re-entrant)rrr+)r$msglockrs r r*z non_reentrant..decorator4s7 ;]]O#56Cc"}}T""r r )rr*s` r rr0s# r r#)rscipy._lib.decoratorr(__all__ RuntimeErrorrrrr r r r4s/ A l  ; ;F r