Format: application/x-python-code
⬇ Download File (5.7 KB)
   1  o
   2  
   3  ;'h��@s�ddlmZddlZddlmZddlmZddlmZddl	m
   4  Z
   5  mZdd	lm
   6  Z
   7  Gd
   8  d�dee�Ze�ZGdd
   9  �d
  10  �Ze	dd dd��Zdd!dd�Zd"dd�Zd#dd�ZdS)$�)�annotationsN)�	Generator)�contextmanager)�
  11  TracebackType�)�	TaskGroup�
  12  TaskStatus�)�get_async_backendc@seZdZdd	dd�ZdS)
  13  �_IgnoredTaskStatusN�value�object�return�NonecCsdS�N���selfrrr�HC:\Users\shubh\Videos\agent\nova\Lib\site-packages\anyio/_core/_tasks.py�started
  14  �z_IgnoredTaskStatus.startedr)rr
  15  rr)�__name__�
  16  __module__�__qualname__rrrrrrsrc@s�eZdZdZejdd�d$d	d
  17  �Zd%dd
  18  �Zed&dd��Z	e	j
  19  d'dd��Z	ed(dd��Zed(dd��Zed(dd��Z
  20  e
  21  j
  22  d)dd��Z
  23  d*dd�Zd+d!d"�Zd#S),�CancelScopez�
  24      Wraps a unit of work that can be made separately cancellable.
  25  
  26      :param deadline: The time (clock value) when this scope is cancelled automatically
  27      :param shield: ``True`` to shield the cancel scope from external cancellation
  28      F��deadline�shieldr�floatr�boolrcCst�j||d�S)N)rr)r
  29  �create_cancel_scope)�clsrrrrr�__new__szCancelScope.__new__rcC�t�)zCancel this scope immediately.��NotImplementedError�rrrr�cancel!�zCancelScope.cancelcCr#)z�
  30          The time (clock value) when this scope is cancelled automatically.
  31  
  32          Will be ``float('inf')`` if no timeout has been set.
  33  
  34          r$r&rrrr%�zCancelScope.deadlinercCr#rr$rrrrr/r(cCr#)z+``True`` if :meth:`cancel` has been called.r$r&rrr�
  35  cancel_called3szCancelScope.cancel_calledcCr#)a
  36          ``True`` if this scope suppressed a cancellation exception it itself raised.
  37  
  38          This is typically used to check if any work was interrupted, or to see if the
  39          scope was cancelled due to its deadline being reached. The value will, however,
  40          only be ``True`` if the cancellation was triggered by the scope itself (and not
  41          an outer scope).
  42  
  43          r$r&rrr�cancelled_caught8szCancelScope.cancelled_caughtcCr#)z�
  44          ``True`` if this scope is shielded from external cancellation.
  45  
  46          While a scope is shielded, it will not receive cancellations from outside.
  47  
  48          r$r&rrrrEr)zCancelScope.shieldcCr#rr$rrrrrOr(cCr#rr$r&rrr�	__enter__SrzCancelScope.__enter__�exc_type�type[BaseException] | None�exc_val�BaseException | None�exc_tb�TracebackType | NonecCr#rr$)rr-r/r1rrr�__exit__VszCancelScope.__exit__N)rrrrrr)rr�rr)rrrr)rr)rrrr)rr)r-r.r/r0r1r2rr)rrr�__doc__�math�infr"r'�propertyr�setterr*r+rr,r3rrrrrs&�
  49  		
  50  rF�delay�float | Nonerrr�"Generator[CancelScope, None, None]ccsv�t�j}|dur|�|ntj}t�j||d��}|VWd�n1s'wY|jr7|�|jkr9t�dSdS)a�
  51      Create a context manager which raises a :class:`TimeoutError` if does not finish in
  52      time.
  53  
  54      :param delay: maximum allowed time (in seconds) before raising the exception, or
  55          ``None`` to disable the timeout
  56      :param shield: ``True`` to shield the cancel scope from external cancellation
  57      :return: a context manager that yields a cancel scope
  58      :rtype: :class:`~typing.ContextManager`\[:class:`~anyio.CancelScope`\]
  59  
  60      Nr)r
  61  �current_timer6r7r r+r�TimeoutError)r:rr=rZcancel_scoperrr�
  62  fail_after_s����r?cCs,|durt���|ntj}t�j||d�S)aD
  63      Create a cancel scope with a deadline that expires after the given delay.
  64  
  65      :param delay: maximum allowed time (in seconds) before exiting the context block, or
  66          ``None`` to disable the timeout
  67      :param shield: ``True`` to shield the cancel scope from external cancellation
  68      :return: a cancel scope
  69  
  70      Nr)r
  71  r=r6r7r )r:rrrrr�
  72  move_on_afterys�r@rcC�
  73  t���S)a?
  74      Return the nearest deadline among all the cancel scopes effective for the current
  75      task.
  76  
  77      :return: a clock value from the event loop's internal clock (or ``float('inf')`` if
  78          there is no deadline in effect, or ``float('-inf')`` if the current scope has
  79          been cancelled)
  80      :rtype: float
  81  
  82      )r
  83  �current_effective_deadlinerrrrrB�s
  84  rBrcCrA)z:
  85      Create a task group.
  86  
  87      :return: a task group
  88  
  89      )r
  90  �create_task_grouprrrrrC�s
  91  rC)F)r:r;rrrr<)r:r;rrrrr4)rr)�
  92  __future__rr6�collections.abcr�
  93  contextlibr�typesrZ
  94  abc._tasksrrZ
  95  _eventloopr
  96  r
  97  rZTASK_STATUS_IGNOREDrr?r@rBrCrrrr�<module>s K�
  98