← Back
Editing: compatibility.cpython-311.pyc
� "z�cF � �, � d dl Z ddlmZ d� Zd� Zd� ZdS )� N� )�iscoroutinefunctionc �� � t | dd� � rdS t | dd� � rdS t j | � � rdS t | d� � rt | j � � rdS t | � � S )zY Tests to see if an application is a legacy-style (double-callable) application. �_asgi_single_callableF�_asgi_double_callableT�__call__)�getattr�inspect�isclass�hasattrr r ��applications �7/usr/lib/python3/dist-packages/asgiref/compatibility.py�is_double_callabler s� � � �{�3�U�;�;� ��u��{�3�U�;�;� ��t���{�#�#� ��t��{�J�'�'� � �{�3�4�4� ��5�"�;�/�/�/�/� c � � � � fd�}|S )zS Transforms a double-callable ASGI application into a single-callable one. c � �B �K � �| � � } |||� � � d {V ��S )N� )�scope�receive�send�instancer s �r �new_applicationz2double_to_single_callable.<locals>.new_application! s: �� � � ��;�u�%�%���X�g�t�,�,�,�,�,�,�,�,�,r r )r r s ` r �double_to_single_callabler s$ �� � -� -� -� -� -� �r c �B � t | � � rt | � � } | S )z� Takes either a single- or double-callable application and always returns it in single-callable style. Use this to add backwards compatibility for ASGI 2.0 applications to your server/test harness/etc. )r r r s r �guarantee_single_callabler ( s'