U >Y@s&ddlZdZGdddZddZdS)Nz1.3.0c@sneZdZdZddddZddZdd Zejd d Z ejd d Z e ddZ ddZ ddZddZdS)timeoutatimeout context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> with timeout(0.001): ... async with aiohttp.get('https://github.com') as r: ... await r.text() timeout - value in seconds or None to disable timeout logic loop - asyncio compatible event loop NloopcCsF|dk r|dkrd}||_|dkr*t}||_d|_d|_d|_dS)NrF)_timeoutasyncioZget_event_loop_loop_task _cancelled_cancel_handler)selfrrr /__init__.py__init__sztimeout.__init__cCs|SN _do_enterr r r r __enter__ sztimeout.__enter__cCs||dSr_do_exitr exc_typeZexc_valZexc_tbr r r __exit__#sztimeout.__exit__cCs|Srrrr r r __aenter__&sztimeout.__aenter__cCs||dSrrrr r r __aexit__*sztimeout.__aexit__cCs|jSr)r rr r r expired.sztimeout.expiredcCs@|jdk rsD