HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/anyio/__pycache__/lowlevel.cpython-310.pyc
o

���gI�@s�UddlmZddlZddlmZddlmZmZmZm	Z	m
Z
ddlmZddl
mZe	d�Ze	d	�Zd#dd
�Zd#dd�Zd#dd�Zd$dd�Ze�Zded<iZded<edd�Gdd�d��ZGdd�dej�ZGdd �d ee�ZGd!d"�d"ee�ZdS)%�)�annotationsN)�	dataclass)�Any�Generic�Literal�TypeVar�overload)�WeakKeyDictionary�)�get_async_backend�T�D�return�Nonec���t���IdHdS)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�
checkpoint�rr�9/usr/local/lib/python3.10/dist-packages/anyio/lowlevel.pyr��
rc�r)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�checkpoint_if_cancelledrrrrrs�	rc�r)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�cancel_shielded_checkpointrrrrr*rr�objectcCs
t���S)ze
    Return a backend specific token object that can be used to get back to the event
    loop.

    )r�
current_tokenrrrrr:s
rz&WeakKeyDictionary[Any, dict[str, Any]]�	_run_varszdict[Any, _TokenWrapper]�_token_wrappersT)�frozenc@seZdZUdZded<dS)�
_TokenWrapper)�_token�__weakref__rrN)�__name__�
__module__�__qualname__�	__slots__�__annotations__rrrrrGs
rc@seZdZe��ZdS)�_NoValueSetN)rr r!�enum�auto�NO_VALUE_SETrrrrr$Msr$c@seZdZdZd	dd�ZdS)
�RunvarToken��_var�_value�	_redeemed�var�	RunVar[T]�value�%T | Literal[_NoValueSet.NO_VALUE_SET]cCs||_||_d|_dS)NFr))�selfr-r/rrr�__init__Ts
zRunvarToken.__init__N)r-r.r/r0)rr r!r"r2rrrrr(Qsr(c@s�eZdZUdZdZejZded<e�Z	ded<efd$dd�Z
ed%dd��Ze
d&dd��Ze
d'dd��Zefd(dd�Zd)dd�Zd*dd �Zd+d!d"�Zd#S),�RunVarz[
    Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop.
    ��_name�_defaultz!Literal[_NoValueSet.NO_VALUE_SET]r'zset[_TokenWrapper]r�name�str�defaultr0cCs||_||_dS�Nr4)r1r7r9rrrr2es
zRunVar.__init__r�dict[str, T]cCs4t�}zt|WStyi}t|<|YSwr:)rr�KeyError)r1�token�run_varsrrr�
_current_varsks
�zRunVar._current_varsr
�T | DcC�dSr:r�r1r9rrr�gett�z
RunVar.getrcCrAr:r�r1rrrrCwrD�%D | Literal[_NoValueSet.NO_VALUE_SET]cCs\z|j|jWSty$|tjur|YS|jtjur"|jYSYnwtd|j�d���)NzRun variable "z!" has no value and no default set)r?r5r<r3r'r6�LookupErrorrBrrrrCzs

���r/�RunvarToken[T]cCs*|j}t||�|jtj��}|||j<|Sr:)r?r(rCr5r3r')r1r/�current_varsr=rrr�set�s
z
RunVar.setr=rcCsf|j|ur	td��|jrtd��|jtjur'z|j|j=Wnty&Ynw|j|j|j<d|_dS)Nz)This token does not belong to this RunVarz This token has already been usedT)	r*�
ValueErrorr,r+r$r'r?r5r<)r1r=rrr�reset�s
�
zRunVar.resetcCsd|j�d�S)Nz
<RunVar name=�>)r5rErrr�__repr__�szRunVar.__repr__N)r7r8r9r0)rr;)r9r
rr@)rr)r9rFrr@)r/rrrH)r=rHrr)rr8)rr r!�__doc__r"r$r'r#rJrr2�propertyr?rrCrLrNrrrrr3Zs$
��

r3)rr)rr)�
__future__rr%�dataclassesr�typingrrrrr�weakrefr	�_core._eventlooprrr
rrrrrr#rr�Enumr$r(r3rrrr�<module>s&