]L i5\UddlmZddlZddlmZddlmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZe d Ze d Zdd Zdd Zdd Ze eddGddZddZe Zded<Gddej6ZGddeeZGddeeZy)) annotationsN) dataclass)AnyGenericLiteralTypeVarfinaloverload)WeakKeyDictionary)get_async_backend) AsyncBackendTDcPKtjd{y7w)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 checkpointT/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anyio/lowlevel.pyrrs   ( ( *** &$&cPKtjd{y7w)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   5 5 777rcPKtjd{y7w)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+s   8 8 :::rTF)frozenreprc&eZdZUdZded<ded<y)EventLoopTokenza An opaque object that holds a reference to an event loop. .. versionadded:: 4.11.0 ztype[AsyncBackend] backend_classobject native_tokenN)__name__ __module__ __qualname____doc____annotations__rrrrr;s &%rrcNt}|j}t||S)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 current_tokenr)r raw_tokens rr(r(Hs'&'M++-I - 33rz1WeakKeyDictionary[object, dict[RunVar[Any], Any]] _run_varsc.eZdZejZy) _NoValueSetN)r"r#r$enumauto NO_VALUE_SETrrrr,r,Xs499;Lrr,ceZdZdZddZy) RunvarToken_var_value _redeemedc.||_||_d|_y)NFr2)selfvarvalues r__init__zRunvarToken.__init___s =B rN)r8z RunVar[T]r9%T | Literal[_NoValueSet.NO_VALUE_SET])r"r#r$ __slots__r:rrrr1r1\s -Irr1ceZdZUdZdZej Zded<ef ddZe ddZ e ddZ e ddZ ef dd Z dd Z dd Zdd Zy )RunVarz[ Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop. _name_defaultz!Literal[_NoValueSet.NO_VALUE_SET]r/c ||_||_yNr?)r7namedefaults rr:zRunVar.__init__ns  rcvtj} t|S#t$rix}t|<|cYSwxYwrC)r(r!r*KeyError)r7r!run_varss r _current_varszRunVar._current_varstsB$33  \* * 13 3Hy.O s 88cyrCrr7rEs rgetz RunVar.get}s(+rcyrCrr7s rrLz RunVar.getsrc |j|S#t$rC|tjur|cYS|jtjur|jcYSYnwxYwt d|j d)NzRun variable "z!" has no value and no default set)rIrGr>r/rA LookupErrorr@rKs rrLz RunVar.gets{ %%%d+ + %f111f&9&99}}$: % TZZL(I J  sA(AAc||j}t||j|tj}|||<|SrC)rIr1rLr>r/)r7r9 current_varstokens rsetz RunVar.sets;)) D,"2"249L9L"MN" T rc4|j|ur td|jr td|jtj ur |j |=d|_y|j|j |<d|_y#t$r Yd|_ywxYw)Nz)This token does not belong to this RunVarz This token has already been usedT)r3 ValueErrorr5r4r,r/rIrG)r7rSs rresetz RunVar.resets ::T !HI I ???@ @ <<;33 3 &&t, (-||D  t $    s B BBc"d|jdS)Nz )r@rNs r__repr__zRunVar.__repr__stzznA..rN)rDstrrEr;)returnzdict[RunVar[T], T])rErr\T | D)r\r)rEz%D | Literal[_NoValueSet.NO_VALUE_SET]r\r])r9rr\RunvarToken[T])rSr^r\None)r\r[)r"r#r$r%r<r,r/r&r:propertyrIr rLrTrWrZrrrr>r>es$I6A6N6NL3NKW  "G ++ @L  <     "/rr>)r\r_)r\r) __future__rr- dataclassesrtypingrrrrr r weakrefr _core._eventloopr abcrrrrrrrr(r*r&Enumr,r1r>rrrrhs" !BB%/ CL CL + 8 ;  $U#$ 4@Q?R <R$))'!*E/WQZE/r