o
    :ήc                     @   st   d dl mZmZmZmZmZ ddlmZmZ ddl	m
Z
 G dd dZdefdd	Zdee fd
dZdddZdS )    )Any	Awaitable	GeneratorOptionalUnion   )DeprecatedAwaitableList_warn_deprecation)get_asynclibc                   @   s   e Zd ZdZdZdedee dee dee	e
e f fddZd	ed
efddZd
efddZd
efddZd
e	d fddZ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coror   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   ;/tmp/pip-target-vg8gfxp4/lib/python/anyio/_core/_testing.py__init__   s   
zTaskInfo.__init__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__c                 C   s
   t | jS r   )hashr   r   r   r   r   __hash__(   s   
zTaskInfo.__hash__c                 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__)NNr   c                 c   s    t |  	 | S r   )r	   r!   r   r   r   	__await__.   s   zTaskInfo.__await__c                 C   s   | S r   r   r!   r   r   r   _unwrap5   s   zTaskInfo._unwrapN)r   r   )r%   r   r   __doc__	__slots__intr   strr   r   r   r   r   objectboolr   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   9   s   
r   c                  C   s   t   } t| tdS )zn
    Return a list of running tasks in the current event loop.

    :return: a list of task info objects

    )r   )r
   get_running_tasksr   )tasksr   r   r   r/   C   s   
r/   Nc                      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   r1   N   s   r1   )r   N)typingr   r   r   r   r   _compatr   r	   
_eventloopr
   r   r   r/   r1   r   r   r   r   <module>   s    2
