File: //opt/saltstack/salt/lib/python3.10/site-packages/tornado/__pycache__/queues.cpython-310.pyc
o
;j�0 � @ s$ d Z ddlZddlZddlZddlmZmZ ddlmZm Z ddl
mZ ddlm
Z
mZmZmZmZ ddlZejrCddlmZmZmZ ed�Zg d �ZG d
d� de�ZG dd
� d
e�Zdede
deejf ddfdd�ZG dd� dee �ZG dd� dee �ZG dd� de�Z G dd� de�Z!dS )a� Asynchronous queues for coroutines. These classes are very similar
to those provided in the standard library's `asyncio package
<https://docs.python.org/3/library/asyncio-queue.html>`_.
.. warning::
Unlike the standard library's `queue` module, the classes defined here
are *not* thread-safe. To use these queues from another thread,
use `.IOLoop.add_callback` to transfer control to the `.IOLoop` thread
before calling any queue methods.
� N)�gen�ioloop)�Future�"future_set_result_unless_cancelled)�Event)�Union�TypeVar�Generic� Awaitable�Optional)�Deque�Tuple�Any�_T)�Queue�
PriorityQueue� LifoQueue� QueueFull�
QueueEmptyc @ � e Zd ZdZdS )r z:Raised by `.Queue.get_nowait` when the queue has no items.N��__name__�
__module__�__qualname__�__doc__� r r �B/opt/saltstack/salt/lib/python3.10/site-packages/tornado/queues.pyr / � r c @ r )r zBRaised by `.Queue.put_nowait` when a queue is at its maximum size.Nr r r r r r 5 r r �future�timeout�returnc sD |r d� fdd�}t j�� ���||��� ���fdd�� d S d S )Nr c s � � � s
� �t�� � d S d S �N)�doneZ
set_exceptionr �TimeoutErrorr )r r r �
on_timeout@ s �z _set_timeout.<locals>.on_timeoutc s
� � ��S r! )Zremove_timeout)�_)�io_loop�timeout_handler r �<lambda>F s
z_set_timeout.<locals>.<lambda>�r N)r ZIOLoop�currentZadd_timeoutZadd_done_callback)r r r$ r )r r&