o
    v+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.
    Z_asgi_single_callableFZ_asgi_double_callableT__call__)getattrinspectisclasshasattrr   r   application r   QC:\Users\Denis\Desktop\TimeStamps\venv\Lib\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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   Zsyncr   r   r   r   r   r   r   r   <module>   s
    