
    gr                     6    d dl Z d dlmZ d dlmZ d dlmZ d Zy)    N)get_running_loopwraps)SynchronousOnlyOperationc                 @      fd}t               r }d  ||      S |S )z
    Decorator to mark functions as async-unsafe. Someone trying to access
    the function while in an async context will get an error message.
    c                 2     t                fd       }|S )Nc                      	 t                t        j                  j                  d      st	               | i |S # t
        $ r Y w xY w)NDJANGO_ALLOW_ASYNC_UNSAFE)r   osenvirongetr   RuntimeError)argskwargsfuncmessages     l/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/utils/asyncio.pyinnerz.async_unsafe.<locals>.decorator.<locals>.inner   sP    < " zz~~&AB27;;(((   s   
? 	A
Ar   )r   r   r   s   ` r   	decoratorzasync_unsafe.<locals>.decorator   s     	t
	) 

	)     zKYou cannot call this from an async context - use a thread or sync_to_async.)callable)r   r   r   s   `  r   async_unsafer      s3    "  	 r   )r   asyncior   	functoolsr   django.core.exceptionsr   r    r   r   <module>r      s    	 $  ;r   