Format: application/x-python-code
⬇ Download File (12.1 KB)
   1  o
   2  
   3  ;'h�%�@s�UddlmZddlZddlZddlmZmZddlmZm	Z	m
   4  Z
   5  mZddlm
   6  Z
   7  ddlmZddlmZddlmZmZmZdd	lmZmZmZmZmZmZejd
   8  kr]ddlmZmZnddlmZmZejdkrqdd
   9  lm Z ndd
  10  lm Z er�ddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<ed�Z=ed�Z>ee?e@ddfZAdeBd<Gdd �d ed!�ZCdS)"�)�annotationsN)�ABCMeta�abstractmethod)�
  11  AsyncIterator�	Awaitable�Callable�Sequence)�AbstractContextManager)�PathLike)�Signals)�
  12  AddressFamily�
  13  SocketKind�socket)�IO�
  14  TYPE_CHECKING�Any�TypeVar�Union�overload)��)�TypeVarTuple�Unpack)r�
  15  )�	TypeAlias)�	HasFileno�)�CapacityLimiter�Event�Lock�	Semaphore)�CancelScope)�TaskInfo)�BlockingPortal�)�ConnectedUDPSocket�ConnectedUNIXDatagramSocket�IPSockAddrType�SocketListener�SocketStream�	UDPSocket�UNIXDatagramSocket�UNIXSocketStream)�Process)�	TaskGroup)�
  16  TestRunner�T_Retval�PosArgsTz
  17  PathLike[str]zPathLike[bytes]r�StrOrBytesPathc@seZdZeed�d
  18  d���Zeed�d
  19  d���Zeed�dd���Zeed�dd���Zeed�dd���Z	ed�dd��Z
  20  ed�dd��Zeed�dd���Zeee
  21  jdd �d�d%d&���Zeed�d'd(���Zeed�d*d+���Zeed�d-d.���Zeed�d1d2���Zeed3dd4�d�d:d;���Zeed�d>d?���Zee		3d�d�dDdE���Zeed�dFdG���Zeed�dIdJ���Zeed�dKdL���Zeed�dNdO���Zeed�dXdY���Zeed�d\d]���Zee	3d�d�ddde���Zeed�didj���Zeed�dndo���Zeed�dpdq���Z eed�dwdx���Z!ee"d�d|d}���Z#ee"d�dd}���Z#eed�d�d}���Z#eed�d�d�d�d��d�d�d����Z$ee	�d�d�d�d����Z%eed�d�d����Z&eed�d�d����Z'eed�d�d����Z(eed�d�d����Z)eed�d�d����Z*eed�d�d����Z+eed�d�d����Z,eed�d�d����Z-d3S)��AsyncBackend�func�1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]�args�tuple[Unpack[PosArgsT]]�kwargs�dict[str, Any]�options�returnr0cC�dS)a�
  22          Run the given coroutine function in an asynchronous event loop.
  23  
  24          The current thread must not be already running an event loop.
  25  
  26          :param func: a coroutine function
  27          :param args: positional arguments to ``func``
  28          :param kwargs: positional arguments to ``func``
  29          :param options: keyword arguments to call the backend ``run()`` implementation
  30              with
  31          :return: the return value of the coroutine function
  32          N�)�clsr4r6r8r:r=r=�JC:\Users\shubh\Videos\agent\nova\Lib\site-packages\anyio/abc/_eventloop.py�run9�zAsyncBackend.run�objectcCr<)z
  33  
  34          :return:
  35          Nr=�r>r=r=r?�
  36  current_tokenOrAzAsyncBackend.current_token�floatcCr<)zz
  37          Return the current value of the event loop's internal clock.
  38  
  39          :return: the clock value (seconds)
  40          Nr=rCr=r=r?�current_timeWrAzAsyncBackend.current_time�type[BaseException]cCr<)zFReturn the exception class that is raised in a task if it's cancelled.Nr=rCr=r=r?�cancelled_exception_class`rAz&AsyncBackend.cancelled_exception_class�Nonec���dS)z�
  41          Check if the task has been cancelled, and allow rescheduling of other tasks.
  42  
  43          This is effectively the same as running :meth:`checkpoint_if_cancelled` and then
  44          :meth:`cancel_shielded_checkpoint`.
  45          Nr=rCr=r=r?�
  46  checkpointe�zAsyncBackend.checkpointc�s(�|��tjkr|��IdHdSdS)z�
  47          Check if the current task group has been cancelled.
  48  
  49          This will check if the task has been cancelled, but will not allow other tasks
  50          to be scheduled if not.
  51  
  52          N)�current_effective_deadline�math�infrKrCr=r=r?�checkpoint_if_cancelledos�	�z$AsyncBackend.checkpoint_if_cancelledc�sD�|jdd��|�d�IdHWd�dS1swYdS)z�
  53          Allow the rescheduling of other tasks.
  54  
  55          This will give other tasks the opportunity to run, but without checking if the
  56          current task group has been cancelled, unlike with :meth:`checkpoint`.
  57  
  58          T)�shieldrN)�create_cancel_scope�sleeprCr=r=r?�cancel_shielded_checkpoint{s�	"�z'AsyncBackend.cancel_shielded_checkpoint�delayc�rJ)zt
  59          Pause the current task for the specified duration.
  60  
  61          :param delay: the duration, in seconds
  62          Nr=)r>rUr=r=r?rS�rLzAsyncBackend.sleepF)�deadlinerQrVrQ�boolr!cC�dS�Nr=)r>rVrQr=r=r?rR��z AsyncBackend.create_cancel_scopecCr<)aQ
  63          Return the nearest deadline among all the cancel scopes effective for the
  64          current task.
  65  
  66          :return:
  67              - a clock value from the event loop's internal clock
  68              - ``inf`` if there is no deadline in effect
  69              - ``-inf`` if the current scope has been cancelled
  70          :rtype: float
  71          Nr=rCr=r=r?rM�rAz'AsyncBackend.current_effective_deadliner.cCrXrYr=rCr=r=r?�create_task_group��zAsyncBackend.create_task_grouprcCrXrYr=rCr=r=r?�create_event�r\zAsyncBackend.create_event�fast_acquirercCrXrYr=)r>r^r=r=r?�create_lock�r\zAsyncBackend.create_lockN)�	max_valuer^�
  72  initial_value�intr`�
  73  int | Noner cCrXrYr=)r>rar`r^r=r=r?�create_semaphore�s	zAsyncBackend.create_semaphore�total_tokensrcCrXrYr=)r>rer=r=r?�create_capacity_limiter�r\z$AsyncBackend.create_capacity_limiter�&Callable[[Unpack[PosArgsT]], T_Retval]�abandon_on_cancel�limiter�CapacityLimiter | Nonec���dSrYr=)r>r4r6rhrir=r=r?�run_sync_in_worker_thread���	z&AsyncBackend.run_sync_in_worker_threadcCrXrYr=rCr=r=r?�check_cancelled�r\zAsyncBackend.check_cancelled�tokencCrXrYr=�r>r4r6ror=r=r?�run_async_from_thread��z"AsyncBackend.run_async_from_threadcCrXrYr=rpr=r=r?�run_sync_from_thread�rrz!AsyncBackend.run_sync_from_threadr#cCrXrYr=rCr=r=r?�create_blocking_portal�r\z#AsyncBackend.create_blocking_portal�command�)StrOrBytesPath | Sequence[StrOrBytesPath]�stdin�int | IO[Any] | None�stdout�stderrrr-c�rkrYr=)r>rurwryrzr8r=r=r?�open_process�s�zAsyncBackend.open_process�workers�set[Process]cCrXrYr=)r>r|r=r=r?�#setup_process_pool_exit_at_shutdown�r\z0AsyncBackend.setup_process_pool_exit_at_shutdown�host�str�port�
  74  local_address�IPSockAddrType | Noner)c�rkrYr=)r>rr�r�r=r=r?�connect_tcp���zAsyncBackend.connect_tcp�path�str | bytesr,c�rkrYr=)r>r�r=r=r?�connect_unix��zAsyncBackend.connect_unix�sockrr(cCrXrYr=�r>r�r=r=r?�create_tcp_listenerr\z AsyncBackend.create_tcp_listenercCrXrYr=r�r=r=r?�create_unix_listenerr\z!AsyncBackend.create_unix_listener�familyr�remote_address�
  75  reuse_port�UDPSocket | ConnectedUDPSocketc�rkrYr=)r>r�r�r�r�r=r=r?�create_udp_socketrmzAsyncBackend.create_udp_socket�
  76  raw_socket�remote_pathr+c�rkrYr=�r>r�r�r=r=r?�create_unix_datagram_socket ��z(AsyncBackend.create_unix_datagram_socketr&c�rkrYr=r�r=r=r?r�&r��str | bytes | None�0UNIXDatagramSocket | ConnectedUNIXDatagramSocketc�rkrYr=r�r=r=r?r�,r�r)r��type�proto�flags�bytes | str | None�str | int | None�int | AddressFamilyr��int | SocketKindr�r��uSequence[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]c�rkrYr=)r>rr�r�r�r�r�r=r=r?�getaddrinfo3s�zAsyncBackend.getaddrinfo�sockaddrr'�tuple[str, str]c�rkrYr=)r>r�r�r=r=r?�getnameinfoIr�zAsyncBackend.getnameinfo�obj�HasFileno | intc�rkrYr=�r>r�r=r=r?�
  77  wait_readablePr�zAsyncBackend.wait_readablec�rkrYr=r�r=r=r?�
  78  wait_writableUr�zAsyncBackend.wait_writablecCrXrYr=rCr=r=r?�current_default_thread_limiterZr\z+AsyncBackend.current_default_thread_limiter�signalsr�.AbstractContextManager[AsyncIterator[Signals]]cGrXrYr=)r>r�r=r=r?�open_signal_receiver_rZz!AsyncBackend.open_signal_receiverr"cCrXrYr=rCr=r=r?�get_current_taskfr\zAsyncBackend.get_current_task�Sequence[TaskInfo]cCrXrYr=rCr=r=r?�get_running_taskskr\zAsyncBackend.get_running_tasksc�rkrYr=rCr=r=r?�wait_all_tasks_blockedpr�z#AsyncBackend.wait_all_tasks_blockedr/cCrXrYr=)r>r:r=r=r?�create_test_runnerur\zAsyncBackend.create_test_runner)
  79  r4r5r6r7r8r9r:r9r;r0)r;rB)r;rE)r;rG)r;rI)rUrEr;rI)rVrErQrWr;r!)r;r.)r;r)r^rWr;r)rarbr`rcr^rWr;r )rerEr;r)FN)
  80  r4rgr6r7rhrWrirjr;r0)r4r5r6r7rorBr;r0)r4rgr6r7rorBr;r0)r;r#)rurvrwrxryrxrzrxr8rr;r-)r|r}r;rIrY)rr�r�rbr�r�r;r))r�r�r;r,)r�rr;r()
  81  r�rr�r�r�r�r�rWr;r�)r�rr�rIr;r+)r�rr�r�r;r&)r�rr�r�r;r�)rr�r�r�r�r�r�r�r�rbr�rbr;r�)r)r�r'r�rbr;r�)r�r�r;rI)r;r)r�rr;r�)r;r")r;r�)r:r9r;r/).�__name__�
  82  __module__�__qualname__�classmethodrr@rDrFrHrKrPrTrSrNrOrRrMr[r]r_rdrfrlrnrqrsrtr{r~r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r=r=r=r?r38s��	�	�	��r3)�	metaclass)D�
  83  __future__rrN�sys�abcrr�collections.abcrrrr�
  84  contextlibr	�osr
  85  �signalrrrr
  86  �typingrrrrrr�version_inforrZtyping_extensionsrZ	_typeshedrZ_core._synchronizationrrrr Z_core._tasksr!Z_core._testingr"Zfrom_threadr#�_socketsr%r&r'r(r)r*r+r,Z
  87  _subprocessesr-�_tasksr.Z_testingr/r0r1r��bytesr2�__annotations__r3r=r=r=r?�<module>s< 
  88  	
  89  (
  90