Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/django/utils/__pycache__/ |
Upload File : |
o 3�a$ � @ sN d dl Z d dlZd dlZd dlmZ d dlmZ ere jZne jZdd� Z dS )� N)�SynchronousOnlyOperation)�PY37c s( � fdd�}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 s t �� �� �fdd��}|S )Nc sL t j�d�szt� }W n ty Y nw ts|�� rt���� | i |��S )N�DJANGO_ALLOW_ASYNC_UNSAFE)�os�environ�get�get_running_loop�RuntimeErrorr � is_runningr )�args�kwargs� event_loop)�func�message� �6/usr/lib/python3/dist-packages/django/utils/asyncio.py�inner s �z.async_unsafe.<locals>.decorator.<locals>.inner)� functools�wraps)r r �r )r r � decorator s zasync_unsafe.<locals>.decoratorzKYou cannot call this from an async context - use a thread or sync_to_async.)�callable)r r r r r r �async_unsafe s r ) �asyncior r �django.core.exceptionsr �django.utils.versionr r �get_event_loopr r r r r �<module> s