U
    &%eU                     @  s   d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZmZ d dlmZ ejdkrtd dlmZ nd dlmZ e	rd d	lmZ ed
ZedddZG dd dee ZG dd dedZdS )    )annotationsN)ABCMetaabstractmethod)TracebackType)TYPE_CHECKINGAny	AwaitableCallableTypeVaroverload)warn)      )Protocol)CancelScopeT_RetvalT_contraT)contravariantc                   @  sF   e Zd ZedddddZedddddZdd
ddddZd	S )
TaskStatuszTaskStatus[None]None)selfreturnc                 C  s   d S N r   r   r   O/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/anyio/abc/_tasks.pystarted   s    zTaskStatus.startedr   )valuer   c                 C  s   d S r   r   r   r   r   r   r   r      s    NzT_contra | Nonec                 C  s   dS )zx
        Signal that the task has started.

        :param value: object passed back to the starter of the task
        Nr   r   r   r   r   r      s    )N)__name__
__module____qualname__r   r   r   r   r   r   r      s
   r   c                   @  s   e Zd ZU dZded< ddddddd	d
dZeddddddd	ddZeddddddd	ddZed dddZ	edddddddZ
dS )	TaskGroupz
    Groups several asynchronous tasks together.

    :ivar cancel_scope: the cancel scope inherited by all child tasks
    :vartype cancel_scope: CancelScope
    r   Zcancel_scopeN)namezCallable[..., Awaitable[Any]]objectr   )funcargsr#   r   c                  s$   t dt | j|f|d|i dS )a  
        Start a new task in this task group.

        :param func: a coroutine function
        :param args: positional arguments to call the function with
        :param name: name of the task, for the purposes of introspection and debugging

        .. deprecated:: 3.0
           Use :meth:`start_soon` instead. If your code needs AnyIO 2 compatibility, you
           can keep using this until AnyIO 4.

        zGspawn() is deprecated -- use start_soon() (without the "await") insteadr#   N)r   DeprecationWarning
start_soonr   r%   r#   r&   r   r   r   spawn0   s
    zTaskGroup.spawnc                G  s   dS )a  
        Start a new task in this task group.

        :param func: a coroutine function
        :param args: positional arguments to call the function with
        :param name: name of the task, for the purposes of introspection and debugging

        .. versionadded:: 3.0
        Nr   r)   r   r   r   r(   H   s    zTaskGroup.start_soonr   c                  s   dS )a  
        Start a new task and wait until it signals for readiness.

        :param func: a coroutine function
        :param args: positional arguments to call the function with
        :param name: name of the task, for the purposes of introspection and debugging
        :return: the value passed to ``task_status.started()``
        :raises RuntimeError: if the task finishes without calling ``task_status.started()``

        .. versionadded:: 3.0
        Nr   r)   r   r   r   startY   s    zTaskGroup.start)r   c                   s   dS )z:Enter the task group context and allow starting new tasks.Nr   r   r   r   r   
__aenter__l   s    zTaskGroup.__aenter__ztype[BaseException] | NonezBaseException | NonezTracebackType | Nonezbool | None)exc_typeexc_valexc_tbr   c                   s   dS )z<Exit the task group context waiting for all tasks to finish.Nr   )r   r-   r.   r/   r   r   r   	__aexit__p   s    zTaskGroup.__aexit__)r   r    r!   __doc____annotations__r*   r   r(   r+   r,   r0   r   r   r   r   r"   &   s   
r"   )	metaclass)
__future__r   sysabcr   r   typesr   typingr   r   r   r	   r
   r   warningsr   version_infor   Ztyping_extensionsZanyio._core._tasksr   r   r   r   r"   r   r   r   r   <module>   s    
