o
    ;'hF  ã                   @  sh   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
„Zddd„Zddd„ZdS )é    )Úannotations)Ú	AwaitableÚ	Generator)ÚAnyÚcasté   )Úget_async_backendc                   @  sF   e Zd ZdZdZddd„Zddd„Zddd„Zd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   Úintr   ú
int | Noner   ú
str | Noner   ú)Generator[Any, Any, Any] | Awaitable[Any]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   úJC:\Users\shubh\Videos\agent\nova\Lib\site-packages\anyio/_core/_testing.pyÚ__init__   s   
zTaskInfo.__init__ÚotherÚobjectÚreturnÚboolc                 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__Ú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   r   r   r   r   r   )r   r   r   r   )r   r   )r   r'   )r   r   )
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   r0   B   s   r0   Ú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   r2   L   s   €r2   N)r   r	   )r   r/   )r   r1   )Ú
__future__r   Úcollections.abcr   r   Útypingr   r   Z
_eventloopr   r	   r   r0   r2   r   r   r   r   Ú<module>   s    
/


