Ë
    q^ëif  ã                   ó|   — d dl Z d dlmZ d dlmZ d dlmZ d„ Z	 d dlm	Z	 y# e
$ r d dlmZ  G d„ d	e«      Z	Y yw xY w)
é    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     €€úE/var/www/eb/venv/lib/python3.12/site-packages/django/utils/asyncio.pyÚinnerz.async_unsafe.<locals>.decorator.<locals>.inner   sP   ø€ ð<Ü Ô"ô —z‘z—~‘~Ð&AÔBÜ2°7Ó;Ð;á˜Ð( Ñ(Ð(øô  ò Ùðú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   )Úaclosing)ÚAbstractAsyncContextManagerc                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)r   z°
        Async context manager for safely finalizing an asynchronously
        cleaned-up resource such as an async generator, calling its
        ``aclose()`` method.
        c                 ó   — || _         y ©N©Úthing)Úselfr   s     r   Ú__init__zaclosing.__init__9   s	   € ØˆD�Jr   c              ƒ   ó"   K  — | j                   S ­wr   r   )r    s    r   Ú
__aenter__zaclosing.__aenter__<   s   è ø€ Ø—:‘:Ðùs   ‚c              ‡   óT   K  — | j                   j                  «       ƒ d {  –—†  y 7 Œ­wr   )r   Úaclose)r    Úexc_infos     r   Ú	__aexit__zaclosing.__aexit__?   s   è ø€ Ø—*‘*×#Ñ#Ó%×%Ò%ús   ‚( &¡(N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r#   r'   © r   r   r   r   2   s   „ ñ	ò	ò	ó	&r   r   )r   Úasyncior   Ú	functoolsr   Údjango.core.exceptionsr   r   Ú
contextlibr   ÚImportErrorr   r,   r   r   ú<module>r2      s>   ðÛ 	Ý $Ý å ;òðD&Þ#øØò &å6ô&Ð.ö &ð&ús   ›" ¢;º;