kfJ*ddlZddlZddlZddlZddlmZddlmZmZej dkrddlm Z nddl m Z ej dkrdd Z ndd Z d Z d Zdeed dfdZdeed dfdZGddejZe GddZdS)N) TracebackType)OptionalType))final)r taskasyncio.Task[object]returnc.|dSN)uncancelr s v/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/async_timeout/__init__.py_uncancel_taskrs cdSrrs rrrs rz4.0.3)timeout timeout_atTimeoutdelayrctj}|||z}nd}t||S)artimeout 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: >>> async with timeout(0.001): ... async with aiohttp.get('https://github.com') as r: ... await r.text() delay - value in seconds or None to disable timeout logic N)asyncioget_running_looptimer)rloopdeadlines rrr sA  # % %D 99;;& 8T " ""rrcHtj}t||S)aSchedule the timeout at absolute time. deadline argument points on the time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with timeout_at(loop.time() + 10): ... async with aiohttp.get('https://github.com') as r: ... await r.text() )rrr)rrs rrr5s"  # % %D 8T " ""rceZdZdZdZdZdZdS)_StateINITENTERTIMEOUTEXITN)__name__ __module__ __qualname__r#r$r%r&rrrr"r"Hs" D EG DDDrr"c eZdZdZdeedejddfdZddZ dee e d ee d ee dee fd Zdd Zdee e d ee d ee dee fd Zede fdZedeefdZddZddZdeddfdZdeddfdZddZddZdee e ddfdZddZdS)r) _deadline_loop_state_timeout_handler_taskrrr Nc||_tj|_d|_d|_| d|_dS||dSr)r,r"r#r-r/r.r+update)selfrrs r__init__zTimeout.__init__dsL k 7; $  !DNNN KK ! ! ! ! !rcftjdtd||S)Nz>with timeout() is deprecated, use async with timeout() instead) stacklevel)warningswarnDeprecationWarning _do_enterr2s r __enter__zTimeout.__enter__qs; L      rexc_typeexc_valexc_tbc0||dSr_do_exitr2r=r>r?s r__exit__zTimeout.__exit__zs htrc2K||Sr)r:r;s r __aenter__zTimeout.__aenter__s  rc4K||dSrrArCs r __aexit__zTimeout.__aexit__s htrc,|jtjkS)z$Is timeout expired during execution?)r-r"r%r;s rexpiredzTimeout.expireds{fn,,rc|jSr)r+r;s rrzTimeout.deadlines ~rc|jtjtjfvrt d|jj|dS)z Reject scheduled timeout if any.invalid state N)r-r"r#r$ RuntimeErrorvalue_rejectr;s rrejectzTimeout.rejectsG ;v{FL9 9 9C 0ACCDD D rcfd|_|j"|jd|_dSdSr)r/r.cancelr;s rrPzTimeout._rejects=  ,  ! ( ( * * *$(D ! ! ! - ,rrcf|j}|td|||zdS)zAdvance timeout on delay seconds. The delay can be negative. Raise RuntimeError if shift is called when deadline is not scheduled Nz1cannot shift timeout if deadline is not scheduled)r+rNr1)r2rrs rshiftz Timeout.shifts=>  RSS S Hu$%%%%%rc:|jtjkrtd|jtjkrtd|j|j||_|jtjkr| dSdS)aTSet deadline to absolute value. deadline argument points on the time in the same clock system as loop.time(). If new deadline is in the past the timeout is raised immediately. Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. z1cannot reschedule after exit from context managerz!cannot reschedule expired timeoutN) r-r"r&rNr%r.rSr+r# _reschedule)r2rs rr1zTimeout.updates ;&+ % %RSS S ;&. ( (BCC C  ,  ! ( ( * * *! ;&+ % %         & %rc|jtjksJ|j}|dS|j}|j|jtj |_ ||kr&|j |j |_dS|j ||j |_dSr)r-r"r$r+r,rr.rSr current_taskr/ call_soon _on_timeoutcall_at)r2rnows rrWzTimeout._reschedules{fl****>   Fjoo  ,  ! ( ( * * *)++ s??$(J$8$89I$J$JD ! ! !$(J$6$6xAQ$R$RD ! ! !rc|jtjkrtd|jjtj|_|dS)NrM)r-r"r#rNrOr$rWr;s rr:zTimeout._do_entersN ;&+ % %C 0ACCDD Dl  rc|tjurL|jtjkr7|jJt |jd|_d|_tjtj |_| dSr) rCancelledErrorr-r"r%r/rr. TimeoutErrorr&rP)r2r=s rrBzTimeout._do_exitso w- - -$+2O2O:))) 4: & & &$(D !DJ& &k  trcz|jJ|jtj|_d|_dSr)r/rSr"r%r-r.r;s rr[zTimeout._on_timeouts;z%%% n $r)r r)r N)r'r(r) __slots__rfloatrAbstractEventLoopr3r<r BaseExceptionrboolrDrFrHpropertyrJrrQrPrUr1rWr:rBr[rrrrrOsE&NI "  "/6/H "  " " " "4 ./-('  $ 4 ./-('  $ ----X-(5/X)))) &5 &T & & & &u*SSSS  $}*=!> 4    %%%%%%r)r r r N)renumsysr7typesrtypingrr version_infortyping_extensionsr __version____all__rdrrEnumr"rrrrrrs !!!!!!!!v''''''w       /#8E?#y####*#%#Y####&TY_%_%_%_%_%_%_%_%_%_%r