3
¨ôÁgæ  ã               @   sf   d dl Z d dlZd dlZdd„ Zdd„ Zdd„ ZejdkrNe jZe jZ	e j
Z
ne jZe jZ	d
d„ Z
dS )é    Nc             C   sT   t | ddƒrdS t | ddƒr dS tj| ƒr.dS t| dƒrHtj| jƒrHdS tj| ƒ S )zY
    Tests to see if an application is a legacy-style (double-callable) application.
    Z_asgi_single_callableFZ_asgi_double_callableTÚ__call__)ÚgetattrÚinspectÚisclassÚhasattrÚasyncioÚiscoroutinefunctionr   )Úapplication© r
   úS/var/www/tester-filtro-web/env/lib/python3.6/site-packages/asgiref/compatibility.pyÚis_double_callable   s    

r   c                s   ‡ fdd„}|S )zS
    Transforms a double-callable ASGI application into a single-callable one.
    c             “   s   ˆ | ƒ}|||ƒI d H S )Nr
   )ZscopeZreceiveÚsendÚinstance)r	   r
   r   Únew_application!   s    z2double_to_single_callable.<locals>.new_applicationr
   )r	   r   r
   )r	   r   Údouble_to_single_callable   s    r   c             C   s   t | ƒrt| ƒ} | 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	   r
   r
   r   Úguarantee_single_callable(   s    r   é   é   c             C   s   | S )Nr
   )Útaskr
   r
   r   Ú<lambda>=   s    r   )r   r   )r   r   Úsysr   r   r   Úversion_infoZget_running_loopÚrunZ
run_futureÚcreate_taskÚget_event_loopÚensure_futurer
   r
   r
   r   Ú<module>   s   
