fINUddlmZddlZddlmZddlmZmZmZm Z m Z ddl m Z ddl mZe dZe d Zdd Zdd Zdd Zdd Ze Zded<iZded<edGddZGddej2ZGddeeZGddeeZy)) annotationsN) dataclass)AnyGenericLiteralTypeVaroverload)WeakKeyDictionary)get_async_backendTDcPKtjd{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 checkpointW/var/lib/jenkins/workspace/mettalog/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 :::rc2tjS)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)frozenceZdZUdZded<y) _TokenWrapper)_token __weakref__objectr N)__name__ __module__ __qualname__ __slots____annotations__rrrrrGs 'I Nrrc.eZdZejZy) _NoValueSetN)r#r$r%enumauto NO_VALUE_SETrrrr)r)Ms499;Lrr)ceZdZdZddZy) RunvarToken_var_value _redeemedc.||_||_d|_y)NFr/)selfvarvalues r__init__zRunvarToken.__init__Ts =B rN)r5z RunVar[T]r6%T | Literal[_NoValueSet.NO_VALUE_SET])r#r$r%r&r7rrrr.r.Qs -Irr.ceZdZUdZdZej Zded<eZ ded<ef ddZ e ddZ e dd Ze dd Zef dd Zdd Zdd ZddZy)RunVarz[ Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop. _name_defaultz!Literal[_NoValueSet.NO_VALUE_SET]r,zset[_TokenWrapper]rc ||_||_yNr;)r4namedefaults rr7zRunVar.__init__es  rcbt} t|S#t$rix}t|<|cYSwxYwr?)rrKeyError)r4tokenrun_varss r _current_varszRunVar._current_varsks< U# # *, ,Hy'O s ..cyr?rr4rAs rgetz RunVar.getts(+rcyr?rr4s rrIz RunVar.getwsrc |j|jS#t$rC|tjur|cYS|j tjur|j cYSYnwxYwt d|jd)NzRun variable "z!" has no value and no default set)rFr<rCr:r,r= LookupErrorrHs rrIz RunVar.getzs %%%djj1 1 %f111f&9&99}}$: % TZZL(I J  sA'(A'&A'c|j}t||j|jtj }|||j<|Sr?)rFr.rIr<r:r,)r4r6 current_varsrDs rsetz RunVar.setsC)) D,"2"24::v?R?R"ST#( TZZ  rc\|j|ur td|jr td|jtj ur |j |j=d|_y|j|j |j<d|_y#t$r Yd|_ywxYw)Nz)This token does not belong to this RunVarz This token has already been usedT) r0 ValueErrorr2r1r)r,rFr<rC)r4rDs rresetz RunVar.resets ::T !HI I ???@ @ <<;33 3 &&tzz2 .3\\D  tzz *    sB B+*B+c"d|jdS)Nz )r<rKs r__repr__zRunVar.__repr__stzznA..rN)r@strrAr8)returnz dict[str, T])rArrXT | D)rXr )rAz%D | Literal[_NoValueSet.NO_VALUE_SET]rXrY)r6r rXRunvarToken[T])rDrZrXNone)rXrW)r#r$r%__doc__r&r)r,r'rPrr7propertyrFr rIrSrVrrrr:r:Zs$I6A6N6NL3N*-%O'/KW  "G ++ @L  <     "/rr:)rXr[)rXr") __future__rr* dataclassesrtypingrrrrr weakrefr _core._eventloopr r rrrrrrr'rrEnumr)r.r:rrrrds" !;;%/ CL CL + 8 ; /5F4G 1G,.). $ $))'!*G/WQZG/r