Format: application/x-python-code
1 o
2
3 -hF � @ s0 d dl Z ddlmZ dd� Zdd� Zdd � ZdS )
4 � N� )�iscoroutinefunctionc C sP t | dd�rdS t | dd�rdS t�| �rdS t| d�r#t| j�r#dS t| � S )zY
5 Tests to see if an application is a legacy-style (double-callable) application.
6 Z_asgi_single_callableFZ_asgi_double_callableT�__call__)�getattr�inspect�isclass�hasattrr r ��application� r �KC:\Users\shubh\Videos\agent\nova\Lib\site-packages\asgiref/compatibility.py�is_double_callable s
7
8
9
10 r
11 c s � fdd�}|S )zS
12 Transforms a double-callable ASGI application into a single-callable one.
13 c � s �� | �}|||�I d H S )Nr )�scopeZreceive�send�instancer r r �new_application! s �z2double_to_single_callable.<locals>.new_applicationr )r
14 r r r r �double_to_single_callable s r c C s t | �rt| �} | S )z�
15 Takes either a single- or double-callable application and always returns it
16 in single-callable style. Use this to add backwards compatibility for ASGI
17 2.0 applications to your server/test harness/etc.
18 )r
19 r r r r r �guarantee_single_callable( s r )r Zsyncr r
20 r r r r r r �<module> s
21