관리-도구
편집 파일: locks.cpython-311.pyc
� �܋fp � �D � d dl Z d dlZd dlmZmZmZ G d� d� � ZdS )� N)�Any�Deque�Optionalc �^ � e Zd ZdZdej ddfd�Zd dee ddfd�Z de fd�Zdd �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 � � || _ d | _ t j � � | _ t j � � | _ d S �N)�_loop�_exc�asyncio�Event�_event�collections�deque�_waiters)�selfr s �D/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/locks.py�__init__zEventResultOrError.__init__ s1 � ��� �-1�� ��m�o�o���4?�4E�4G�4G�� � � � �excc �F � || _ | j � � � d S r )r r �set)r r s r r zEventResultOrError.set s! � ��� ���������r c � �B K � | j � | j � � � � � }| j � |� � |� d {V ��}| j � |� � n# | j � |� � w xY w| j �| j �|S r )r �create_taskr �waitr �append�remover )r �waiter�vals r r zEventResultOrError.wait s� � � � ���'�'���(8�(8�(:�(:�;�;��� ���V�$�$�$� )��,�,�,�,�,�,�C��M� � ��(�(�(�(��D�M� � ��(�(�(�(�����9� ��)�O�� s �A2 �2Bc �B � | j D ]}|� � � �dS )zCancel all waitersN)r �cancel)r r s r r# zEventResultOrError.cancel&