File: //home/arjun/projects/env/lib64/python3.10/site-packages/aiohttp/__pycache__/locks.cpython-310.pyc
o
+wep � @ s6 d dl Z d dlZd dlmZmZmZ G dd� d�ZdS )� N)�Any�Deque�Optionalc @ sT e Zd ZdZdejddfdd�Zddee ddfdd �Z de
fd
d�Zddd
�ZdS )�EventResultOrErrorz�Event asyncio lock helper class.
Wraps the Event asyncio lock allowing either to awake the
locked Tasks without any error or raising an exception.
thanks to @vorpalsmith for the simple design.
�loop�returnNc C s$ || _ d | _t�� | _t�� | _d S �N)�_loop�_exc�asyncio�Event�_event�collections�deque�_waiters)�selfr � r �F/home/arjun/projects/env/lib/python3.10/site-packages/aiohttp/locks.py�__init__ s
zEventResultOrError.__init__�excc C s || _ | j�� d S r )r
r
�set)r r r r r r s zEventResultOrError.setc � s^ �| j �| j�� �}| j�|� z
|I d H }W | j�|� n| j�|� w | jd ur-| j�|S r )r �create_taskr
�waitr �append�remover
)r �waiter�valr r r r s �
zEventResultOrError.waitc C s | j D ]}|�� qdS )zCancel all waitersN)r �cancel)r r r r r r &