U
    RhF                     @  st   d dl mZ d dlmZmZ d dlmZmZ ddlm	Z	 G dd dZ
ddd	d
ZddddZddddZdS )    )annotations)	Awaitable	Generator)Anycast   )get_async_backendc                   @  sb   e Zd ZdZdZddddddd	Zd
ddddZddddZddddZddddZ	dS )TaskInfoaI  
    Represents an asynchronous task.

    :ivar int id: the unique identifier of the task
    :ivar parent_id: the identifier of the parent task, if any
    :vartype parent_id: Optional[int]
    :ivar str name: the description of the task (if any)
    :ivar ~collections.abc.Coroutine coro: the coroutine object of the task
    )_nameid	parent_idnamecorointz
int | Nonez
str | Nonez)Generator[Any, Any, Any] | Awaitable[Any])r   r   r   r   c                 C  s4   t }|j d|j | _|| _|| _|| _|| _d S )N.)get_current_task
__module____qualname__r
   r   r   r   r   )selfr   r   r   r   func r   :./venv/lib/python3.8/site-packages/anyio/_core/_testing.py__init__   s    zTaskInfo.__init__objectbool)otherreturnc                 C  s   t |tr| j|jkS tS N)
isinstancer	   r   NotImplemented)r   r   r   r   r   __eq__$   s    
zTaskInfo.__eq__r   c                 C  s
   t | jS r   )hashr   r   r   r   r   __hash__*   s    zTaskInfo.__hash__strc                 C  s   | j j d| jd| jdS )Nz(id=z, name=))	__class____name__r   r   r#   r   r   r   __repr__-   s    zTaskInfo.__repr__c                 C  s   dS )z_
        Return ``True`` if the task has a cancellation pending, ``False`` otherwise.

        Fr   r#   r   r   r   has_pending_cancellation0   s    z!TaskInfo.has_pending_cancellationN)
r(   r   r   __doc__	__slots__r   r    r$   r)   r*   r   r   r   r   r	   	   s   
r	   r!   c                   C  s
   t   S )zV
    Return the current task.

    :return: a representation of the current task

    )r   r   r   r   r   r   r   8   s    r   list[TaskInfo]c                   C  s   t dt  S )zn
    Return a list of running tasks in the current event loop.

    :return: a list of task info objects

    r-   )r   r   get_running_tasksr   r   r   r   r.   B   s    r.   Nonec                     s   t   I dH  dS )z5Wait until all other tasks are waiting for something.N)r   wait_all_tasks_blockedr   r   r   r   r0   L   s    r0   N)Z
__future__r   Zcollections.abcr   r   typingr   r   Z
_eventloopr   r	   r   r.   r0   r   r   r   r   <module>   s   /

