B
ka @ s6 d dl Z d dlZd dlmZmZmZ G dd dZdS ) N)AnyDequeOptionalc @ sT e Zd ZdZejddddZdee ddddZ e
d d
dZdd dd
ZdS )EventResultOrErrorzEvent 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.
N)loopreturnc C s$ || _ d | _t | _t | _d S )N)_loop_excasyncioZEvent_eventcollectionsdeque_waiters)selfr r @/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/locks.py__init__ s
zEventResultOrError.__init__)excr c C s || _ | j d S )N)r r set)r r r r r r s zEventResultOrError.set)r c sP | j | j }| j| z|I d H }W d | j| X | jd k rL| j|S )N)r Zcreate_taskr waitr appendremover )r waitervalr r r r s
zEventResultOrError.waitc C s x| j D ]}| qW dS )zCancel all waitersN)r cancel)r r r r r r &