
    pT:i                    n   % S SK Jr  SrS SKrS SKJr  S SKJr  S SKJ	r	J
r
JrJrJrJr  S SKJr  SS	KJr  SS
KJr  \" S5      r\" S5      rSS jrSS jrSS jr\\" SSS9 " S S5      5       5       rSS jr\" 5       rS\S'    " S S\R<                  5      r " S S\
\   5      r  " S S\
\   5      r!g)     )annotations)EventLoopTokenRunvarTokenRunVar
checkpointcheckpoint_if_cancelledcancel_shielded_checkpointcurrent_tokenN)	dataclass)TracebackType)AnyGenericLiteralTypeVarfinaloverload)WeakKeyDictionary   )get_async_backend)AsyncBackendTDc                 P   #    [        5       R                  5       I Sh  vN   g N7f)z
Check for cancellation and allow the scheduler to switch to another task.

Equivalent to (but more efficient than)::

    await checkpoint_if_cancelled()
    await cancel_shielded_checkpoint()


.. versionadded:: 3.0

N)r   r        R/var/www/html/aadhar_voter_ocr/venv/lib/python3.13/site-packages/anyio/lowlevel.pyr   r      s      

(
(
***   &$&c                 P   #    [        5       R                  5       I Sh  vN   g N7f)z
Enter a checkpoint if the enclosing cancel scope has been cancelled.

This does not allow the scheduler to switch to a different task.

.. versionadded:: 3.0

N)r   r   r   r   r   r   r   *   s      

5
5
777r   c                 P   #    [        5       R                  5       I Sh  vN   g N7f)z
Allow the scheduler to switch to another task but without checking for cancellation.

Equivalent to (but potentially more efficient than)::

    with CancelScope(shield=True):
        await checkpoint()


.. versionadded:: 3.0

N)r   r	   r   r   r   r	   r	   6   s      

8
8
:::r   TF)frozenreprc                  .    \ rS rSr% SrS\S'   S\S'   Srg)	r   F   zU
An opaque object that holds a reference to an event loop.

.. versionadded:: 4.11.0
ztype[AsyncBackend]backend_classobjectnative_tokenr   N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r   r   r   r   r   F   s     &%r   r   c                 L    [        5       n U R                  5       n[        X5      $ )z
Return a token object that can be used to call code in the current event loop from
another thread.

.. versionadded:: 4.11.0

)r   r
   r   )r$   	raw_tokens     r   r
   r
   S   s%     &'M++-I-33r   z1WeakKeyDictionary[object, dict[RunVar[Any], Any]]	_run_varsc                  6    \ rS rSr\R
                  " 5       rSrg)_NoValueSetc   r   N)r'   r(   r)   r*   enumautoNO_VALUE_SETr-   r   r   r   r2   r2   c   s    99;Lr   r2   c                  F    \ rS rSrSrSS jrS	S jr        S
S jrSrg)r   g   _var_value	_redeemedc                *    Xl         X l        SU l        g )NFr9   )selfvarvalues      r   __init__RunvarToken.__init__j   s    	=Br   c                    U $ Nr   r>   s    r   	__enter__RunvarToken.__enter__o   s    r   c                :    U R                   R                  U 5        g rD   )r:   reset)r>   exc_typeexc_valexc_tbs       r   __exit__RunvarToken.__exit__r   s     			r   )r<   r;   r:   N)r?   z	RunVar[T]r@   %T | Literal[_NoValueSet.NO_VALUE_SET])returnRunvarToken[T])rJ   ztype[BaseException] | NonerK   zBaseException | NonerL   zTracebackType | NonerP   None)	r'   r(   r)   r*   	__slots__rA   rF   rM   r-   r   r   r   r   r   g   s<    -I
, & %	
 
r   r   c                      \ rS rSr% SrSr\R                  rS\S'   \4   SS jjr	\
SS j5       r\SS j5       r\SS	 j5       r\4   SS
 jjrSS jrSS jrSS jrSrg)r   {   z
Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop.

Can be used as a context manager, Just like :class:`~contextvars.ContextVar`, that
will reset the variable to its previous value when the context block is exited.
_name_defaultz!Literal[_NoValueSet.NO_VALUE_SET]r6   c                    Xl         X l        g rD   rV   )r>   namedefaults      r   rA   RunVar.__init__   s     
r   c                x    [        5       R                  n [        U   $ ! [         a    0 =n[        U'   Us $ f = frD   )r
   r&   r0   KeyError)r>   r&   run_varss      r   _current_varsRunVar._current_vars   sB    $33	\** 	133Hy.O	s    99c                    g rD   r   r>   r[   s     r   get
RunVar.get   s    (+r   c                    g rD   r   rE   s    r   rd   re      s    r   c                     U R                   U    $ ! [         aE    U[        R                  La  Us $ U R                  [        R                  La  U R                  s $  Of = f[        SU R                   S35      e)NzRun variable "z!" has no value and no default set)r`   r^   r   r6   rX   LookupErrorrW   rc   s     r   rd   re      s{    	%%%d++ 	%f111f&9&99}}$ :	% TZZL(IJ
 	
s    A )A A c                x    U R                   n[        XR                  U [        R                  5      5      nXU '   U$ rD   )r`   r   rd   r   r6   )r>   r@   current_varstokens       r   set
RunVar.set   s7    ))D"2"249L9L"MN"Tr   c                (   UR                   U La  [        S5      eUR                  (       a  [        S5      eUR                  [        R
                  L a   U R                  U 	 OUR                  U R                  U '   SUl        g ! [         a     Nf = f)Nz)This token does not belong to this RunVarz This token has already been usedT)r:   
ValueErrorr<   r;   r2   r6   r`   r^   )r>   rk   s     r   rI   RunVar.reset   s    ::T!HII???@@<<;333&&t, (-||Dt$  s   B 
BBc                $    SU R                   < S3$ )Nz<RunVar name=>)rW   rE   s    r   __repr__RunVar.__repr__   s    tzznA..r   )rX   rW   N)rZ   strr[   rO   )rP   zdict[RunVar[T], T])r[   r   rP   T | D)rP   r   )r[   z%D | Literal[_NoValueSet.NO_VALUE_SET]rP   rv   )r@   r   rP   rQ   )rk   rQ   rP   rR   )rP   ru   )r'   r(   r)   r*   r+   rS   r2   r6   r,   rA   propertyr`   r   rd   rl   rI   rs   r-   r   r   r   r   r   {   s     $I6A6N6NL3N KW  "G    + +  @L
<
	
"/r   r   )rP   rR   )rP   r   )"
__future__r   __all__r4   dataclassesr   typesr   typingr   r   r   r   r   r   weakrefr   _core._eventloopr   abcr   r   r   r   r   r	   r   r
   r0   r,   Enumr2   r   r   r   r   r   <module>r      s    "  !  B B % / CLCL+ 	8;  
$U#  $ 
4 @Q?R	< R$)) '!* (H/WQZ H/r   