K i #ddlZddlZddlZddlZddlmZddlmZmZejdk\rddlm Z ndZ ejdk\rddZ ndd Z d Z d Z d eedd fdZdeedd fdZGddej"Ze Gdd Zy)N) TracebackType)OptionalType) )finalcB d|_|S#ttf$rY|SwxYw)aThis decorator can be used to indicate to type checkers that the decorated method cannot be overridden, and decorated class cannot be subclassed. For example: class Base: @final def done(self) -> None: ... class Sub(Base): def done(self) -> None: # Error reported by type checker ... @final class Leaf: ... class Other(Leaf): # Error reported by type checker ... There is no runtime checking of these properties. The decorator sets the ``__final__`` attribute to ``True`` on the decorated object to allow runtime introspection. T) __final__AttributeError TypeError)fs f/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/websockets/asyncio/async_timeout.pyrrs5, AK   *    s  returnc$|jyN)uncanceltasks r_uncancel_taskr9s  cyrrs rrr>s rz4.0.3)timeout timeout_atTimeoutdelayrcrtj}||j|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 rrrHs:  # # %D 99;& 8T ""rr"cBtj}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)r"r!s rrr]s  # # %D 8T ""rceZdZdZdZdZdZy)_StateINITENTERTIMEOUTEXITN)__name__ __module__ __qualname__r&r'r(r)rrrr%r%ps D EG Drr%c PeZdZdZdeedejddfdZddZ dee e d ee d ee dee fd Zdd Zdee e d ee d ee dee fd Zede fdZedeefdZddZddZdeddfdZdeddfdZddZddZdee e ddfdZddZy)r) _deadline_loop_state_timeout_handler_taskr"r!rNc||_tj|_d|_d|_|d|_y|j|yr)r/r%r&r0r2r1r.update)selfr"r!s r__init__zTimeout.__init__s> kk 7; $  !DN KK !rc^tjdtd|j|S)Nz>with timeout() is deprecated, use async with timeout() instead) stacklevel)warningswarnDeprecationWarning _do_enterr5s r __enter__zTimeout.__enter__s( L   rexc_typeexc_valexc_tbc&|j|yr_do_exitr5r@rArBs r__exit__zTimeout.__exit__s hrc.K|j|Swr)r=r>s r __aenter__zTimeout.__aenter__s  c.K|j|ywrrDrFs r __aexit__zTimeout.__aexit__s hrJc<|jtjk(S)z$Is timeout expired during execution?)r0r%r(r>s rexpiredzTimeout.expireds{{fnn,,rc|jSr)r.r>s rr"zTimeout.deadlines ~~rc|jtjtjfvr"t d|jj |j y)z Reject scheduled timeout if any.invalid state N)r0r%r&r' RuntimeErrorvalue_rejectr>s rrejectzTimeout.rejectsC ;;v{{FLL9 9 0A0A/BCD D rcnd|_|j"|jjd|_yyr)r2r1cancelr>s rrTzTimeout._rejects4  ,  ! ! ( ( *$(D ! -rrc^|j}| td|j||zy)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.rRr4)r5rr"s rshiftz Timeout.shifts0>>  RS S Hu$%rcZ|jtjk(r td|jtjk(r td|j |j j ||_|jtjk7r|jyy)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) r0r%r)rRr(r1rWr.r& _reschedule)r5r"s rr4zTimeout.updates ;;&++ %RS S ;;&.. (BC C  ,  ! ! ( ( *! ;;&++ %     &rc|jtjk(sJ|j}|y|jj }|j |j jtj|_ ||kr+|jj|j|_y|jj||j|_yr)r0r%r'r.r/r r1rWr current_taskr2 call_soon _on_timeoutcall_at)r5r"nows rr[zTimeout._reschedules{{fll***>>   jjoo  ,  ! ! ( ( *))+ s?$(JJ$8$89I9I$JD !$(JJ$6$6xAQAQ$RD !rc|jtjk7r"td|jjtj |_|j y)NrQ)r0r%r&rRrSr'r[r>s rr=zTimeout._do_entersF ;;&++ % 0A0A/BCD Dll  rc.|tjur^|jtjk(rA|j Jt |j d|_d|_tjtj|_|jyr) rCancelledErrorr0r%r(r2rr1 TimeoutErrorr)rT)r5r@s rrEzTimeout._do_exitsm w-- -$++2O::) )) 4:: &$(D !DJ&& &kk  rc|jJ|jjtj|_d|_yr)r2rWr%r(r0r1r>s rr_zTimeout._on_timeouts5zz%%% nn $r)rr)rN)r*r+r, __slots__rfloatrAbstractEventLoopr6r?r BaseExceptionrboolrGrIrLpropertyrNr"rUrTrYr4r[r=rEr_rrrrrwsX&NI "  "/6/H/H "  "4 ./-('  $ 4 ./-('  $ ---(5/) &5 &T &u*S  $}*=!> 4 %r)rzasyncio.Task[object]rN)renumsysr:typesrtypingrr version_inforr __version____all__rhrrEnumr%rrrrrus !wDw    /#8E?#y#*#%#Y#&TYY_%_%_%r