File: //opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/locks.cpython-38.opt-1.pyc
U
'�7`� � @ sd d dl Z d dlZd dlmZmZ zd dlmZ W n ek
rP d dlmZ Y nX G dd� d�ZdS )� N)�Any�Optional)�Dequec @ sT e Zd ZdZejdd�dd�Zdee dd�dd�Z e
d �d
d�Zdd �dd
�ZdS )�EventResultOrErrorz�
This class wrappers the Event asyncio lock allowing either awake the
locked Tasks without any error or raising an exception.
thanks to @vorpalsmith for the simple design.
N)�loop�returnc C s$ || _ d | _t�� | _t�� | _d S �N)�_loop�_exc�asyncio�Event�_event�collections�deque�_waiters)�selfr � r �@/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/locks.py�__init__ s
zEventResultOrError.__init__)�excr c C s || _ | j�� d S r )r
r
�set)r r r r r r s zEventResultOrError.set)r c � sP | j �| j�� �}| j�|� z|I d H }W 5 | j�|� X | jd k rL| j�|S r )r Zcreate_taskr
�waitr �append�remover
)r �waiter�valr r r r s
zEventResultOrError.waitc C s | j D ]}|�� qdS )z Cancel all waiters N)r �cancel)r r r r r r * s
zEventResultOrError.cancel)N)
�__name__�
__module__�__qualname__�__doc__r ZAbstractEventLoopr r �
BaseExceptionr r r r r r r r r s
r ) r r �typingr r r �ImportErrorZtyping_extensionsr r r r r �<module> s