403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/tornado/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/tornado/__pycache__/queues.cpython-311.pyc
�

��b�0���dZddlZddlZddlZddlmZmZddlmZm	Z	ddl
mZddlm
Z
mZmZmZmZddlZejr
ddlmZmZmZed��Zgd	�ZGd
�de��ZGd�d
e��Zdede
deejfddfd�ZGd�dee��ZGd�dee��ZGd�de��Z Gd�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��eZdZdZdS)rz:Raised by `.Queue.get_nowait` when the queue has no items.N��__name__�
__module__�__qualname__�__doc__���0/usr/lib/python3/dist-packages/tornado/queues.pyrr/s������D�D��Drrc��eZdZdZdS)rzBRaised by `.Queue.put_nowait` when a queue is at its maximum size.Nrrrrrr5s������L�L��Drr�future�timeout�returnc�����|rUd�fd�}tj������||�������fd���dSdS)Nr"c�������s(��tj����dSdS�N)�done�
set_exceptionr�TimeoutError)r s�r�
on_timeoutz _set_timeout.<locals>.on_timeout@s@����;�;�=�=�
9��$�$�S�%5�%7�%7�8�8�8�8�8�
9�
9rc�.�������Sr%)�remove_timeout)�_�io_loop�timeout_handles ��r�<lambda>z_set_timeout.<locals>.<lambda>Fs���7�+A�+A�.�+Q�+Q�r�r"N)r�IOLoop�current�add_timeout�add_done_callback)r r!r)r-r.s`  @@r�_set_timeoutr5;s�������S�	9�	9�	9�	9�	9�	9��-�'�'�)�)�� �,�,�W�j�A�A��� � �!Q�!Q�!Q�!Q�!Q�R�R�R�R�R�S�Src�.�eZdZdd�Zdeefd�ZdS)�_QueueIterator�q�	Queue[_T]r"Nc��||_dSr%)r8)�selfr8s  r�__init__z_QueueIterator.__init__Js
������rc�4�|j���Sr%)r8�get�r;s r�	__anext__z_QueueIterator.__anext__Ms���v�z�z�|�|�r)r8r9r"N)rrrr<rrr@rrrr7r7IsG�����������9�R�=������rr7c���eZdZdZdZddeddfd�Zedefd���Zdefd�Z	de
fd	�Zde
fd
�Z	dde
deeeejfdd
fd�Zde
ddfd�Z	ddeeeejfdee
fd�Zde
fd�Zdd�Z	ddeeeejfdedfd�Zdee
fd�Zdd�Zde
fd�Zde
ddfd�Zde
ddfd�Zdd�Z de!fd�Z"de!fd�Z#de!fd�Z$dS) ra�Coordinate producer and consumer coroutines.

    If maxsize is 0 (the default) the queue size is unbounded.

    .. testcode::

        import asyncio
        from tornado.ioloop import IOLoop
        from tornado.queues import Queue

        q = Queue(maxsize=2)

        async def consumer():
            async for item in q:
                try:
                    print('Doing work on %s' % item)
                    await asyncio.sleep(0.01)
                finally:
                    q.task_done()

        async def producer():
            for item in range(5):
                await q.put(item)
                print('Put %s' % item)

        async def main():
            # Start consumer without waiting (since it never finishes).
            IOLoop.current().spawn_callback(consumer)
            await producer()     # Wait for producer to put all tasks.
            await q.join()       # Wait for consumer to finish all tasks.
            print('Done')

        asyncio.run(main())

    .. testoutput::

        Put 0
        Put 1
        Doing work on 0
        Put 2
        Doing work on 1
        Put 3
        Doing work on 2
        Put 4
        Doing work on 3
        Doing work on 4
        Done


    In versions of Python without native coroutines (before 3.5),
    ``consumer()`` could be written as::

        @gen.coroutine
        def consumer():
            while True:
                item = yield q.get()
                try:
                    print('Doing work on %s' % item)
                    yield gen.sleep(0.01)
                finally:
                    q.task_done()

    .. versionchanged:: 4.3
       Added ``async for`` support in Python 3.5.

    Nr�maxsizer"c�R�|�td���|dkrtd���||_|���t	jg��|_t	jg��|_d|_t��|_
|j
���dS)Nzmaxsize can't be Nonerzmaxsize can't be negative)�	TypeError�
ValueError�_maxsize�_init�collections�deque�_getters�_putters�_unfinished_tasksr�	_finished�set)r;rBs  rr<zQueue.__init__�s����?��3�4�4�4��Q�;�;��8�9�9�9���
��
�
����#�)�"�-�-��
�#�)�"�-�-��
�!"����������������rc��|jS)z%Number of items allowed in the queue.)rFr?s rrBz
Queue.maxsize�s���}�rc�*�t|j��S)zNumber of items in the queue.)�len�_queuer?s r�qsizezQueue.qsize�s���4�;���rc��|jSr%�rRr?s r�emptyzQueue.empty�s���;��rc�V�|jdkrdS|���|jkS)NrF)rBrSr?s r�fullz
Queue.full�s)���<�1����5��:�:�<�<�4�<�/�/r�itemr!zFuture[None]c���t��}	|�|��|�d��n<#t$r/|j�||f��t
||��YnwxYw|S)a�Put an item into the queue, perhaps waiting until there is room.

        Returns a Future, which raises `tornado.util.TimeoutError` after a
        timeout.

        ``timeout`` may be a number denoting a time (on the same
        scale as `tornado.ioloop.IOLoop.time`, normally `time.time`), or a
        `datetime.timedelta` object for a deadline relative to the
        current time.
        N)r�
put_nowait�
set_resultrrK�appendr5)r;rYr!r s    r�putz	Queue.put�s�������	$��O�O�D�!�!�!�

���d�#�#�#�#��	�	*�	*�	*��M� � �$���0�0�0����)�)�)�)�)�	*����
�
s�;�6A4�3A4c�|�|���|jrp|���s
Jd���|j���}|�|��t||�����dS|���rt�|�|��dS)z{Put an item into the queue without blocking.

        If no free slot is immediately available, raise `QueueFull`.
        z)queue non-empty, why are getters waiting?N)	�_consume_expiredrJrV�popleft�_Queue__put_internalr�_getrXr)r;rY�getters   rr[zQueue.put_nowait�s���
	
�������=�	&��:�:�<�<�L�L�!L�L�L�L��]�*�*�,�,�F�����%�%�%�.�v�t�y�y�{�{�C�C�C�C�C�
�Y�Y�[�[�	&��O�����%�%�%�%�%rc���t��}	|�|�����n:#t$r-|j�|��t
||��YnwxYw|S)a.Remove and return an item from the queue.

        Returns an awaitable which resolves once an item is available, or raises
        `tornado.util.TimeoutError` after a timeout.

        ``timeout`` may be a number denoting a time (on the same
        scale as `tornado.ioloop.IOLoop.time`, normally `time.time`), or a
        `datetime.timedelta` object for a deadline relative to the
        current time.

        .. note::

           The ``timeout`` argument of this method differs from that
           of the standard library's `queue.Queue.get`. That method
           interprets numeric values as relative timeouts; this one
           interprets them as absolute deadlines and requires
           ``timedelta`` objects for relative timeouts (consistent
           with other timeouts in Tornado).

        )rr\�
get_nowaitrrJr]r5)r;r!r s   rr>z	Queue.get�s���.����	*����d�o�o�/�/�0�0�0�0���	*�	*�	*��M� � ��(�(�(����)�)�)�)�)�	*�����
s�'8�4A/�.A/c�|�|���|jrs|���s
Jd���|j���\}}|�|��t|d��|���S|���r|���St�)z�Remove and return an item from the queue without blocking.

        Return an item if one is immediately available, else raise
        `QueueEmpty`.
        z(queue not full, why are putters waiting?N)	r`rKrXrarbrrcrSr)r;rY�putters   rrfzQueue.get_nowaits���	
�������=�		��9�9�;�;�J�J� J�J�J�J��=�0�0�2�2�L�D�&�����%�%�%�.�v�t�<�<�<��9�9�;�;��
�Z�Z�\�\�	��9�9�;�;���rc��|jdkrtd���|xjdzc_|jdkr|j���dSdS)a�Indicate that a formerly enqueued task is complete.

        Used by queue consumers. For each `.get` used to fetch a task, a
        subsequent call to `.task_done` tells the queue that the processing
        on the task is complete.

        If a `.join` is blocking, it resumes when all items have been
        processed; that is, when every `.put` is matched by a `.task_done`.

        Raises `ValueError` if called more times than `.put`.
        rz!task_done() called too many times�N)rLrErMrNr?s r�	task_donezQueue.task_donese���!�Q�&�&��@�A�A�A����!�#����!�Q�&�&��N��� � � � � �'�&rc�6�|j�|��S)z�Block until all items in the queue are processed.

        Returns an awaitable, which raises `tornado.util.TimeoutError` after a
        timeout.
        )rM�wait)r;r!s  r�joinz
Queue.join$s���~�"�"�7�+�+�+rc� �t|��Sr%)r7r?s r�	__aiter__zQueue.__aiter__.s���d�#�#�#rc�6�tj��|_dSr%)rHrIrRr?s rrGzQueue._init2s��!�'�)�)����rc�4�|j���Sr%)rRrar?s rrcz
Queue._get5s���{�"�"�$�$�$rc�:�|j�|��dSr%�rRr]�r;rYs  r�_putz
Queue._put8�������4� � � � � rc��|xjdz
c_|j���|�|��dS)Nrj)rLrM�clearrvrus  r�__put_internalzQueue.__put_internal=s=�����!�#�����������	�	�$�����rc��|jrj|jdd���rE|j���|jr%|jdd����E|jr`|jd���rE|j���|jr#|jd����?dSdSdSdS)Nrrj)rKr&rarJr?s rr`zQueue._consume_expiredBs����m�	$��
�a� 0�� 3� 8� 8� :� :�	$��M�!�!�#�#�#��m�	$��
�a� 0�� 3� 8� 8� :� :�	$��m�	$��
�a� 0� 5� 5� 7� 7�	$��M�!�!�#�#�#��m�	$��
�a� 0� 5� 5� 7� 7�	$�	$�	$�	$�	$�	$�	$�	$�	$rc��dt|��j�dtt|�����d|����d�S)N�<z at � �>)�typer�hex�id�_formatr?s r�__repr__zQueue.__repr__Js<���"&�t�*�*�"5�"5�"5�s�2�d�8�8�}�}�}�}�d�l�l�n�n�n�n�U�Urc�\�dt|��j�d|����d�S)Nr}r~r)r�rr�r?s r�__str__z
Queue.__str__Ms*��� ��J�J�/�/�/��������@�@rc��d|j��}t|dd��r
|d|jzz
}|jr|dt	|j��zz
}|jr|dt	|j��zz
}|jr
|d|jzz
}|S)Nzmaxsize=rRz	 queue=%rz getters[%s]z putters[%s]z	 tasks=%s)rB�getattrrRrJrQrKrL)r;�results  rr�z
Queue._formatPs����!%���/���4��4�(�(�	0��k�D�K�/�/�F��=�	:��n�s�4�=�'9�'9�9�9�F��=�	:��n�s�4�=�'9�'9�9�9�F��!�	;��k�D�$:�:�:�F��
r)rr%r0)%rrrrrR�intr<�propertyrBrS�boolrVrXrrr�float�datetime�	timedeltar^r[rr>rfrkrnr7rprGrcrvrbr`�strr�r�r�rrrrrQs�������A�A�J�F�
�
��
�D�
�
�
�
��������X�� �s� � � � ��t�����0�d�0�0�0�0�OS�����!)�%��x�7I�0I�*J�!K��	�����.&�r�&�d�&�&�&�&�"EI�����e�X�-?�&?� @�A��	�2������>�B�����$!�!�!�!�&EI�,�,���e�X�-?�&?� @�A�,�	�4��,�,�,�,�$�>�"�-�$�$�$�$�*�*�*�*�%�b�%�%�%�%�!��!��!�!�!�!�
�2��$�����
$�$�$�$�V�#�V�V�V�V�A��A�A�A�A�
��
�
�
�
�
�
rrc�6�eZdZdZdd�Zdeddfd�Zdefd�ZdS)	ra�A `.Queue` that retrieves entries in priority order, lowest first.

    Entries are typically tuples like ``(priority number, data)``.

    .. testcode::

        import asyncio
        from tornado.queues import PriorityQueue

        async def main():
            q = PriorityQueue()
            q.put((1, 'medium-priority item'))
            q.put((0, 'high-priority item'))
            q.put((10, 'low-priority item'))

            print(await q.get())
            print(await q.get())
            print(await q.get())

        asyncio.run(main())

    .. testoutput::

        (0, 'high-priority item')
        (1, 'medium-priority item')
        (10, 'low-priority item')
    r"Nc��g|_dSr%rUr?s rrGzPriorityQueue._initz�
������rrYc�:�tj|j|��dSr%)�heapq�heappushrRrus  rrvzPriorityQueue._put}s��
��t�{�D�)�)�)�)�)rc�4�tj|j��Sr%)r��heappoprRr?s rrczPriorityQueue._get�s���}�T�[�)�)�)rr0�rrrrrGrrvrcrrrrr]so��������8����*��*��*�*�*�*�*�b�*�*�*�*�*�*rrc�6�eZdZdZdd�Zdeddfd�Zdefd�ZdS)	ra�A `.Queue` that retrieves the most recently put items first.

    .. testcode::

        import asyncio
        from tornado.queues import LifoQueue

        async def main():
            q = LifoQueue()
            q.put(3)
            q.put(2)
            q.put(1)

            print(await q.get())
            print(await q.get())
            print(await q.get())

        asyncio.run(main())

    .. testoutput::

        1
        2
        3
    r"Nc��g|_dSr%rUr?s rrGzLifoQueue._init�r�rrYc�:�|j�|��dSr%rtrus  rrvzLifoQueue._put�rwrc�4�|j���Sr%)rR�popr?s rrczLifoQueue._get�s���{��� � � rr0r�rrrrr�so��������4����!��!��!�!�!�!�!�b�!�!�!�!�!�!rr)"rrHr�r��tornadorr�tornado.concurrentrr�
tornado.locksr�typingrr	r
rr�
TYPE_CHECKINGr
rrr�__all__�	Exceptionrrr�r�r5r7rrrrrr�<module>r�s?������������������������I�I�I�I�I�I�I�I�������?�?�?�?�?�?�?�?�?�?�?�?�?�?�
�
�
�
�	��)�(�(�(�(�(�(�(�(�(�(��W�T�]�]��
L�
L�
L��	�	�	�	�	��	�	�	�	�	�	�	�	�	�	�	�	�S��S�"�4���0B�#B�C�S�	�S�S�S�S������W�R�[����I�I�I�I�I�G�B�K�I�I�I�X$*�$*�$*�$*�$*�E�$*�$*�$*�N"!�"!�"!�"!�"!��"!�"!�"!�"!�"!r

Youez - 2016 - github.com/yon3zu
LinuXploit