o
    ýÞhF  ã                   @   s0   d dl Z ddlmZ dd„ Zdd„ Zdd	„ ZdS )
é    Né   )Úiscoroutinefunctionc                 C   sP   t | ddƒrdS t | ddƒrdS t | ¡rdS t| dƒr#t| jƒr#dS 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   ©Úapplication© r   úU/var/www/html/premium_crap/venv/lib/python3.10/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   )ÚscopeÚreceiveÚsendÚinstancer   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   )r   Úsyncr   r   r   r   r   r   r   r   Ú<module>   s
    