
    vKg#                     *   S SK r S SKrS SKrS SKrS SKJr  S SKJrJr  \R                  S:  a  S SKJ
r
  OS r
\R                  S:  a  SS jrOSS	 jrS
rSrS\\   SS4S jrS\\   SS4S jr " S S\R"                  5      r\
 " S S5      5       rg)    N)TracebackType)OptionalType)      )finalc                 D     SU l         U $ ! [        [        4 a     U $ f = f)ah  This 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    `/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/websockets/asyncio/async_timeout.pyr   r      s5    ,	AK  	* 	 	s    returnc                 $    U R                  5         g N)uncanceltasks    r   _uncancel_taskr   9   s        c                     g r    r   s    r   r   r   >   s    r   z4.0.3)timeout
timeout_atTimeoutdelayr   c                 t    [         R                  " 5       nU b  UR                  5       U -   nOSn[        X!5      $ )aV  timeout 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)asyncioget_running_looptimer   )r   loopdeadlines      r   r   r   H   s8     ##%D99;&8""r   r"   c                 B    [         R                  " 5       n[        X5      $ )an  Schedule 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()


)r   r   r   )r"   r!   s     r   r   r   ]   s     ##%D8""r   c                   $    \ rS rSrSrSrSrSrSrg)_Statep   INITENTERTIMEOUTEXITr   N)	__name__
__module____qualname____firstlineno__r'   r(   r)   r*   __static_attributes__r   r   r   r%   r%   p   s    DEGDr   r%   c            	       v   \ rS rSrSrS\\   S\R                  SS4S jr	SS jr
S	\\\      S
\\   S\\   S\\   4S jrSS jrS	\\\      S
\\   S\\   S\\   4S jr\S\4S j5       r\S\\   4S j5       rSS jrSS jrS\SS4S jrS\SS4S jrSS jrSS jrS	\\\      SS4S jrSS jrSrg)r   w   )	_deadline_loop_state_timeout_handler_taskr"   r!   r   Nc                     X l         [        R                  U l        S U l        S U l        Uc  S U l        g U R                  U5        g r   )r3   r%   r'   r4   r6   r5   r2   update)selfr"   r!   s      r   __init__Timeout.__init__   s<     
kk7;
 $!DNKK!r   c                 Z    [         R                  " S[        SS9  U R                  5         U $ )Nz>with timeout() is deprecated, use async with timeout() instead   )
stacklevel)warningswarnDeprecationWarning	_do_enterr9   s    r   	__enter__Timeout.__enter__   s(    L	

 	r   exc_typeexc_valexc_tbc                 &    U R                  U5        g r   _do_exitr9   rF   rG   rH   s       r   __exit__Timeout.__exit__   s     	hr   c                 .   #    U R                  5         U $ 7fr   )rB   rC   s    r   
__aenter__Timeout.__aenter__   s        c                 .   #    U R                  U5        g 7fr   rJ   rL   s       r   	__aexit__Timeout.__aexit__   s      	hrR   c                 <    U R                   [        R                  :H  $ )z$Is timeout expired during execution?)r4   r%   r)   rC   s    r   expiredTimeout.expired   s     {{fnn,,r   c                     U R                   $ r   )r2   rC   s    r   r"   Timeout.deadline   s    ~~r   c                     U R                   [        R                  [        R                  4;  a"  [	        SU R                   R
                   35      eU R                  5         g)z Reject scheduled timeout if any.invalid state N)r4   r%   r'   r(   RuntimeErrorvalue_rejectrC   s    r   rejectTimeout.reject   sC     ;;v{{FLL990A0A/BCDDr   c                 p    S U l         U R                  b"  U R                  R                  5         S U l        g g r   )r6   r5   cancelrC   s    r   r_   Timeout._reject   s4    
  ,!!((*$(D! -r   r   c                 ^    U R                   nUc  [        S5      eU R                  X!-   5        g)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)r2   r]   r8   )r9   r   r"   s      r   shiftTimeout.shift   s.     >>RSSH$%r   c                 `   U R                   [        R                  :X  a  [        S5      eU R                   [        R                  :X  a  [        S5      eU R
                  b  U R
                  R                  5         Xl        U R                   [        R                  :w  a  U R                  5         gg)a$  Set 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)
r4   r%   r*   r]   r)   r5   rc   r2   r'   _reschedule)r9   r"   s     r   r8   Timeout.update   s     ;;&++%RSS;;&..(BCC  ,!!((*!;;&++% &r   c                    U R                   [        R                  :X  d   eU R                  nUc  g U R                  R                  5       nU R                  b  U R                  R                  5         [        R                  " 5       U l
        X::  a+  U R                  R                  U R                  5      U l        g U R                  R                  XR                  5      U l        g r   )r4   r%   r(   r2   r3   r    r5   rc   r   current_taskr6   	call_soon_on_timeoutcall_at)r9   r"   nows      r   ri   Timeout._reschedule   s    {{fll***>>jjoo  ,!!((*))+
?$(JJ$8$89I9I$JD!$(JJ$6$6xAQAQ$RD!r   c                     U R                   [        R                  :w  a"  [        SU R                   R                   35      e[        R
                  U l         U R                  5         g )Nr\   )r4   r%   r'   r]   r^   r(   ri   rC   s    r   rB   Timeout._do_enter   sF    ;;&++%0A0A/BCDDllr   c                 4   U[         R                  L a`  U R                  [        R                  :X  aB  U R
                  c   e[        U R
                  5        S U l        S U l        [         R                  e[        R                  U l        U R                  5         g r   )r   CancelledErrorr4   r%   r)   r6   r   r5   TimeoutErrorr*   r_   )r9   rF   s     r   rK   Timeout._do_exit  sm    w---$++2O::)))4::&$(D!DJ&&&kkr   c                     U R                   c   eU R                   R                  5         [        R                  U l        S U l        g r   )r6   rc   r%   r)   r4   r5   rC   s    r   rn   Timeout._on_timeout  s5    zz%%%

nn $r   )r2   r3   r4   r6   r5   )r   r   )r   N)r+   r,   r-   r.   	__slots__r   floatr   AbstractEventLoopr:   rD   r   BaseExceptionr   boolrM   rP   rT   propertyrW   r"   r`   r_   rf   r8   ri   rB   rK   rn   r/   r   r   r   r   r   w   sX   & NI" "/6/H/H"	"4./ -( '	
 
$4./ -( '	
 
$ - - - (5/  )
&5 
&T 
&u  *S 
$}*=!> 
4 
%r   )r   zasyncio.Task[object]r   N)r   enumsysr?   typesr   typingr   r   version_infor   r   __version____all__r{   r   r   Enumr%   r   r   r   r   <module>r      s      
   ! wD w
  /#8E? #y #*#% #Y #&TYY  _% _% _%r   