Format: application/x-python-code
⬇ Download File (4.7 KB)
   1  o
   2  
   3  ;'hW�@s>UddlmZddlZddlZddlZddlmZmZmZddl	m
   4  Z
   5  ddlmZddl
   6  mZmZmZddlZejdkrEddl
   7  mZmZnddlmZmZerUd	d
   8  lmZdZed�Zed
   9  �Ze��ZiZded<ddd�d:dd�Zd;d d!�Z d<d"d#�Z!d=d%d&�Z"d>d'd(�Z#d?d*d+�Z$d@d-d.�Z%e
  10  dAd4d5��Z&dBdCd8d9�Z'dS)D�)�annotationsN)�	Awaitable�Callable�	Generator)�contextmanager)�
  11  import_module)�
  12  TYPE_CHECKING�Any�TypeVar)��)�TypeVarTuple�Unpack�)�AsyncBackend)�asyncioZtrio�T_Retval�PosArgsTzdict[str, type[AsyncBackend]]�loaded_backendsr)�backend�backend_options�func�1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]�args�Unpack[PosArgsT]r�strr�dict[str, Any] | None�returnc
  13  Gs�zt��}Wn
  14  tjyYn	wtd|�d���zt|�}Wnty3}ztd|���|�d}~wwd}tj�d�durDtj�	|�}z|pHi}|�
  15  ||i|�W|rZtj�|�SS|rdtj�|�ww)u�
  16      Run the given coroutine function in an asynchronous event loop.
  17  
  18      The current thread must not be already running an event loop.
  19  
  20      :param func: a coroutine function
  21      :param args: positional arguments to ``func``
  22      :param backend: name of the asynchronous event loop implementation – currently
  23          either ``asyncio`` or ``trio``
  24      :param backend_options: keyword arguments to call the backend ``run()``
  25          implementation with (documented :ref:`here <backend options>`)
  26      :return: the return value of the coroutine function
  27      :raises RuntimeError: if an asynchronous event loop is already running in this
  28          thread
  29      :raises LookupError: if the named backend is not found
  30  
  31      zAlready running z in this threadzNo such backend: N)�sniffio�current_async_libraryZAsyncLibraryNotFoundError�RuntimeError�get_async_backend�ImportError�LookupErrorZcurrent_async_library_cvar�get�set�run�reset)rrrr�
  32  asynclib_nameZ
  33  async_backend�exc�token�r+�LC:\Users\shubh\Videos\agent\nova\Lib\site-packages\anyio/_core/_eventloop.pyr&s.�����r&�delay�float�Nonec�s�t��|�IdHS)zi
  34      Pause the current task for the specified duration.
  35  
  36      :param delay: the duration, in seconds
  37  
  38      N)r!�sleep)r-r+r+r,r0Ps�r0c�s�ttj�IdHdS)z�
  39      Pause the current task until it's cancelled.
  40  
  41      This is a shortcut for ``sleep(math.inf)``.
  42  
  43      .. versionadded:: 3.1
  44  
  45      N)r0�math�infr+r+r+r,�
  46  sleep_foreverZs�	r3�deadlinec�s$�t�}tt||d��IdHdS)z�
  47      Pause the current task until the given time.
  48  
  49      :param deadline: the absolute time to wake up at (according to the internal
  50          monotonic clock of the event loop)
  51  
  52      .. versionadded:: 3.1
  53  
  54      rN)�current_timer0�max)r4�nowr+r+r,�sleep_untilfs�
  55  r8cC�
  56  t���S)zo
  57      Return the current value of the event loop's internal clock.
  58  
  59      :return: the clock value (seconds)
  60  
  61      )r!r5r+r+r+r,r5ts
  62  r5�tuple[str, ...]cCstS)z5Return a tuple of the names of all built-in backends.)�BACKENDSr+r+r+r,�get_all_backends~sr<�type[BaseException]cCr9)z@Return the current async library's cancellation exception class.)r!Zcancelled_exception_classr+r+r+r,�get_cancelled_exc_class�s
  63  r>�
  64  backend_class�type[AsyncBackend]r*�object�Generator[Any, None, None]ccs.�|t_|t_z
  65  dVWt`t`dSt`t`w�N)�threadlocalsZcurrent_async_backend�
  66  current_token)r?r*r+r+r,�claim_worker_thread�s��rFr(�
  67  str | NonecCsL|durt��}zt|WSty%td|���}|jt|<|jYSw)Nzanyio._backends._)rrr�KeyErrorrr?)r(�moduler+r+r,r!�s
  68  
  69  
  70  �r!)
  71  rrrrrrrrrr)r-r.rr/)rr/)r4r.rr/)rr.)rr:)rr=)r?r@r*rArrBrC)r(rGrr@)(�
  72  __future__rr1�sys�	threading�collections.abcrrr�
  73  contextlibr�	importlibr�typingrr	r
  74  r�version_infor
  75  rZtyping_extensions�abcrr;rr�localrDr�__annotations__r&r0r3r8r5r<r>rFr!r+r+r+r,�<module>s>
  76  �
  77  1
  78  
  79  
  80  
  81  
  82  
  83  
  84  
  85