
    F j0                       % S SK Jr  S SKrS SKrS SKrS SKJrJrJr  S SK	J
r
  S SKJr  S SKJr  S SKJrJrJr  SS	KJr  \R*                  S
:  a	  S SKJrJr  OS SKJrJr  S\S'    S SKr\(       a  SSKJr  Sr\" S5      r\" S5      r \RB                  " 5       r"0 r#S\S'   SSS.         S$S jjr$S%S jr%S&S jr&S'S jr'S(S jr(S)S jr)S)S jr*S*S jr+\
      S+S j5       r,S,S-S  jjr-S.S! jr.S/S" jr/S0S# jr0g! \ a    Sr Nf = f)1    )annotationsN)	AwaitableCallable	Generator)contextmanager)Token)import_module)TYPE_CHECKINGAnyTypeVar   )NoEventLoopError)      )TypeVarTupleUnpackr   sniffio   )AsyncBackend)asynciotrioT_RetvalPosArgsTzdict[str, type[AsyncBackend]]loaded_backendsr   )backendbackend_optionsc               0   [        5       =n(       a  [        SU S35      e [        U5      nSnUc  [        U5      n U=(       d    0 nUR                  X0 U5      [        U5        $ ! [         a  n[	        SU 35      UeSnAff = f! [        U5        f = f)u  
Run the given coroutine function in an asynchronous event loop.

The current thread must not be already running an event loop.

:param func: a coroutine function
:param args: positional arguments to ``func``
:param backend: name of the asynchronous event loop implementation – currently
    either ``asyncio`` or ``trio``
:param backend_options: keyword arguments to call the backend ``run()``
    implementation with (documented :ref:`here <backend options>`)
:return: the return value of the coroutine function
:raises RuntimeError: if an asynchronous event loop is already running in this
    thread
:raises LookupError: if the named backend is not found

zAlready running z in this threadzNo such backend: N)current_async_libraryRuntimeErrorget_async_backendImportErrorLookupErrorset_current_async_libraryrunreset_current_async_library)funcr   r   argsasynclib_nameasync_backendexctokens           @c:\Py\emelo-reg\venv\Lib\site-packages\anyio/_core/_eventloop.pyr$   r$   &   s    . .//}/-m_OLMMB)'2 E *'2+)/R  RA#E*  B-gY78cAB 	$E*s"   A' B '
B1B  BBc                P   #    [        5       R                  U 5      I Sh  vN $  N7f)z]
Pause the current task for the specified duration.

:param delay: the duration, in seconds

N)r    sleep)delays    r,   r.   r.   R   s!      #$**51111s   &$&c                 R   #    [        [        R                  5      I Sh  vN   g N7f)zs
Pause the current task until it's cancelled.

This is a shortcut for ``sleep(math.inf)``.

.. versionadded:: 3.1

N)r.   mathinf     r,   sleep_foreverr5   \   s      /s   '%'c                b   #    [        5       n[        [        X-
  S5      5      I Sh  vN   g N7f)z
Pause the current task until the given time.

:param deadline: the absolute time to wake up at (according to the internal
    monotonic clock of the event loop)

.. versionadded:: 3.1

r   N)current_timer.   max)deadlinenows     r,   sleep_untilr;   h   s%      .C
HNA&
'''s   %/-/c                 2    [        5       R                  5       $ )z
Return the current value of the event loop's internal clock.

:return: the clock value (seconds)
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
    current thread

)r    r7   r3   r4   r,   r7   r7   v   s     ++--r4   c                     [         $ )z5Return a tuple of the names of all built-in backends.)BACKENDSr3   r4   r,   get_all_backendsr?      s    Or4   c                     / n [        5        H   n [        U5        U R                  U5        M"     [	        U 5      $ ! [         a     M<  f = f)z
Test for the availability of built-in backends.

:return a tuple of the built-in backend names that were successfully imported

.. versionadded:: 4.12

)r?   r    r!   appendtuple)available_backendsbackend_names     r,   get_available_backendsrE      sV     %'(*	l+ 	!!,/ + #$$  		s   <
A
	A
c                 2    [        5       R                  5       $ )z
Return the current async library's cancellation exception class.

:raises NoEventLoopError: if no supported asynchronous event loop is running in the
    current thread

)r    cancelled_exception_classr3   r4   r,   get_cancelled_exc_classrH      s     88::r4   c              #  f   #    SSK Jn  U" X5      [        l         S v   [        ?g ! [        ?f = f7f)Nr   )EventLoopToken)lowlevelrJ   threadlocalscurrent_token)backend_classr+   rJ   s      r,   claim_worker_threadrO      s+      *!/!EL'&L&s   1& 1.1c                   U c6  [        5       n U (       d%  [        SSR                  [        5       5       35      e [        U    $ ! [
         a0    [        SU  35      nUR                  [        U '   UR                  s $ f = f)NzPNot currently running on any asynchronous event loop. Available async backends: z, zanyio._backends._)r   r   joinr?   r   KeyErrorr	   rN   )r(   modules     r,   r    r       s    -/"--1YY7G7I-J,KM $}-- $!2=/BC)/)=)=&###$s   A 7A>=A>c                     [         c  SS Kn  U R                  5         g [         R                  " 5       $ ! [         a     g f = f! [         R
                   a     g f = f)Nr   r   )r   r   get_running_loopr   r   AsyncLibraryNotFoundError)r   s    r,   r   r      sg    	$$&	0022	  	 	
 00 		s    4 A 
A AAAc                P    [         c  g [         R                  R                  U 5      $ N)r   current_async_library_cvarset)r(   s    r,   r#   r#      s!    --11-@@r4   c                J    U b   [         R                  R                  U 5        g g rX   )r   rY   reset)r+   s    r,   r%   r%      s!    **007 r4   )
r&   z1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]r'   zUnpack[PosArgsT]r   strr   zdict[str, Any] | Nonereturnr   )r/   floatr^   None)r^   r`   )r9   r_   r^   r`   )r^   r_   )r^   ztuple[str, ...])r^   ztype[BaseException])rN   type[AsyncBackend]r+   objectr^   zGenerator[Any, None, None]rX   )r(   
str | Noner^   ra   )r^   rc   )r(   rc   r^   Token | None)r+   rd   r^   r`   )1
__future__r   r1   sys	threadingcollections.abcr   r   r   
contextlibr   contextvarsr   	importlibr	   typingr
   r   r   _exceptionsr   version_infor   r   typing_extensions__annotations__r   ModuleNotFoundErrorabcr   r>   r   r   localrL   r   r$   r.   r5   r;   r7   r?   rE   rH   rO   r    r   r#   r%   r3   r4   r,   <module>rt      s>   "  
  : : %  # . . )w++6	 " :
# 13. 3 -1	)+
;)+)+ )+ +	)+
 )+X2	(	.
%*;  	'%	'.4	'	' 	'$(&A8e  Gs   'C? ?D
	D
