o 6a>@s,ddlZddlZddZddZddZdS)NcCsTt|ddrdSt|ddrdSt|rdSt|dr$t|jr$dSt| S)zY Tests to see if an application is a legacy-style (double-callable) application. _asgi_single_callableF_asgi_double_callableT__call__)getattrinspectisclasshasattrasyncioiscoroutinefunctionr applicationr 7/usr/lib/python3/dist-packages/asgiref/compatibility.pyis_double_callables      rcsfdd}|S)zS Transforms a double-callable ASGI application into a single-callable one. cs|}|||IdHS)Nr )scopereceivesendinstancer r rnew_application sz2double_to_single_callable..new_applicationr )r rr r rdouble_to_single_callables rcCst|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. )rrr r r rguarantee_single_callable'sr)r rrrrr r r rs