Your IP : 3.145.92.213


Current Path : /opt/alt/python311/lib64/python3.11/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/asyncio/__pycache__/queues.cpython-311.opt-1.pyc

�

c��f&����dZddlZddlZddlmZddlmZddlmZGd�de��Z	Gd	�d
e��Z
Gd�dej��ZGd
�de��Z
Gd�de��ZdS))�Queue�
PriorityQueue�	LifoQueue�	QueueFull�
QueueEmpty�N)�GenericAlias�)�locks)�mixinsc��eZdZdZdS)rz;Raised when Queue.get_nowait() is called on an empty Queue.N��__name__�
__module__�__qualname__�__doc__���5/opt/alt/python311/lib64/python3.11/asyncio/queues.pyrrs������E�E��Drrc��eZdZdZdS)rzDRaised when the Queue.put_nowait() method is called on a full Queue.Nr
rrrrrs������N�N��Drrc��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
ee��Z
d
�Zd�Zed���Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)raA queue, useful for coordinating producer and consumer coroutines.

    If maxsize is less than or equal to zero, the queue size is infinite. If it
    is an integer greater than 0, then "await put()" will block when the
    queue reaches maxsize, until an item is removed by get().

    Unlike the standard library Queue, you can reliably know this Queue's size
    with qsize(), since your single-threaded asyncio application won't be
    interrupted between calling qsize() and doing an operation on the Queue.
    rc��||_tj��|_tj��|_d|_t
j��|_|j�	��|�
|��dS)Nr)�_maxsize�collections�deque�_getters�_putters�_unfinished_tasksr
�Event�	_finished�set�_init��self�maxsizes  r�__init__zQueue.__init__!sl����
�$�)�+�+��
�#�)�+�+��
�!"�����������������
�
�7�����rc�6�tj��|_dS�N)rr�_queuer"s  rr!zQueue._init/s��!�'�)�)����rc�4�|j���Sr')r(�popleft�r#s r�_getz
Queue._get2s���{�"�"�$�$�$rc�:�|j�|��dSr'�r(�append�r#�items  r�_putz
Queue._put5�������4� � � � � rc��|rC|���}|���s|�d��dS|�AdSdSr')r*�done�
set_result)r#�waiters�waiters   r�_wakeup_nextzQueue._wakeup_next:s`���	��_�_�&�&�F��;�;�=�=�
��!�!�$�'�'�'���	�	�	�	�	�	rc�~�dt|��j�dt|��d�d|����d�S)N�<z at z#x� �>)�typer�id�_formatr+s r�__repr__zQueue.__repr__Bs=��K�4��:�:�&�K�K�B�t�H�H�K�K�K�$�,�,�.�.�K�K�K�Krc�\�dt|��j�d|����d�S)Nr;r<r=)r>rr@r+s r�__str__z
Queue.__str__Es,��:�4��:�:�&�:�:������:�:�:�:rc� �d|j��}t|dd��r|dt|j����z
}|jr|dt|j���d�z
}|jr|dt|j���d�z
}|jr
|d|j��z
}|S)Nzmaxsize=r(z _queue=z
 _getters[�]z
 _putters[z tasks=)r�getattr�listr(r�lenrr)r#�results  rr@z
Queue._formatJs���-�D�M�-�-���4��4�(�(�	7��6��d�k�!2�!2�6�6�6�F��=�	9��8�3�t�}�#5�#5�8�8�8�8�F��=�	9��8�3�t�}�#5�#5�8�8�8�8�F��!�	9��8�� 6�8�8�8�F��
rc�*�t|j��S)zNumber of items in the queue.)rHr(r+s r�qsizezQueue.qsizeVs���4�;���rc��|jS)z%Number of items allowed in the queue.)rr+s rr$z
Queue.maxsizeZs���}�rc��|jS)z3Return True if the queue is empty, False otherwise.�r(r+s r�emptyzQueue.empty_s���;��rc�V�|jdkrdS|���|jkS)z�Return True if there are maxsize items in the queue.

        Note: if the Queue was initialized with maxsize=0 (the default),
        then full() is never True.
        rF)rrKr+s r�fullz
Queue.fullcs+���=�A����5��:�:�<�<�4�=�0�0rc��$K�|���r�|������}|j�|��	|�d{V��n�#|���	|j�|��n#t$rYnwxYw|���s.|���s|�	|j���xYw|�����|�
|��S)z�Put an item into the queue.

        Put an item into the queue. If the queue is full, wait until a free
        slot is available before adding item.
        N)rQ�	_get_loop�
create_futurerr/�cancel�remove�
ValueError�	cancelledr9�
put_nowait)r#r1�putters   r�putz	Queue.putns�����i�i�k�k�	��^�^�%�%�3�3�5�5�F��M� � ��(�(�(�
�����������

��
�
������M�(�(��0�0�0�0��!�����D������y�y�{�{�5�6�+;�+;�+=�+=�5��%�%�d�m�4�4�4�����%�i�i�k�k�	�&���t�$�$�$�1�A!�!C&�8B�C&�
B �C&�B � AC&c���|���rt�|�|��|xjdz
c_|j���|�|j��dS)zyPut an item into the queue without blocking.

        If no free slot is immediately available, raise QueueFull.
        r	N)rQrr2rr�clearr9rr0s  rrYzQueue.put_nowait�sl��
�9�9�;�;�	��O��	�	�$�������!�#�������������$�-�(�(�(�(�(rc��"K�|���r�|������}|j�|��	|�d{V��n�#|���	|j�|��n#t$rYnwxYw|���s.|���s|�	|j���xYw|�����|�
��S)zoRemove and return an item from the queue.

        If queue is empty, wait until an item is available.
        N)rOrSrTrr/rUrVrWrXr9�
get_nowait)r#�getters  r�getz	Queue.get�s����
�j�j�l�l�	��^�^�%�%�3�3�5�5�F��M� � ��(�(�(�
�����������

��
�
������M�(�(��0�0�0�0��!�����D������z�z�|�|�5�F�,<�,<�,>�,>�5��%�%�d�m�4�4�4�����%�j�j�l�l�	�&��� � � r\c��|���rt�|���}|�|j��|S)z�Remove and return an item from the queue.

        Return an item if one is immediately available, else raise QueueEmpty.
        )rOrr,r9rr0s  rr`zQueue.get_nowait�sB��
�:�:�<�<�	����y�y�{�{�����$�-�(�(�(��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 currently blocking, it will resume when all items have
        been processed (meaning that a task_done() call was received for every
        item that had been put() into the queue).

        Raises ValueError if called more times than there were items placed in
        the queue.
        rz!task_done() called too many timesr	N)rrWrr r+s r�	task_donezQueue.task_done�se���!�Q�&�&��@�A�A�A����!�#����!�Q�&�&��N��� � � � � �'�&rc��bK�|jdkr!|j����d{V��dSdS)aBlock until all items in the queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer calls task_done() to
        indicate that the item was retrieved and all work on it is complete.
        When the count of unfinished tasks drops to zero, join() unblocks.
        rN)rr�waitr+s r�joinz
Queue.join�sJ�����!�A�%�%��.�%�%�'�'�'�'�'�'�'�'�'�'�'�&�%rN)r)rrrrr%r!r,r2r9rArC�classmethodr�__class_getitem__r@rK�propertyr$rOrQr[rYrbr`rerhrrrrrsR������	�	�
�
�
�
�*�*�*�%�%�%�!�!�!�
���L�L�L�;�;�;�$��L�1�1��
�
�
� � � �����X�����	1�	1�	1�%�%�%�6
)�
)�
)�!�!�!�4	�	�	�!�!�!�(	(�	(�	(�	(�	(rrc�@�eZdZdZd�Zejfd�Zejfd�Z	dS)rz�A subclass of Queue; retrieves entries in priority order (lowest first).

    Entries are typically tuples of the form: (priority number, data).
    c��g|_dSr'rNr"s  rr!zPriorityQueue._init��
������rc�(�||j|��dSr'rN)r#r1�heappushs   rr2zPriorityQueue._put�s������d�#�#�#�#�#rc�"�||j��Sr'rN)r#�heappops  rr,zPriorityQueue._get�s���w�t�{�#�#�#rN)
rrrrr!�heapqrpr2rrr,rrrrr�sc��������
���#(�.�$�$�$�$�!�=�$�$�$�$�$�$rrc�$�eZdZdZd�Zd�Zd�ZdS)rzEA subclass of Queue that retrieves most recently added entries first.c��g|_dSr'rNr"s  rr!zLifoQueue._init�rnrc�:�|j�|��dSr'r.r0s  rr2zLifoQueue._put�r3rc�4�|j���Sr')r(�popr+s rr,zLifoQueue._get�s���{��� � � rN)rrrrr!r2r,rrrrr�sG������O�O����!�!�!�!�!�!�!�!rr)�__all__rrs�typesr�r
r�	Exceptionrr�_LoopBoundMixinrrrrrr�<module>r~s=��
L����������������������������	�	�	�	�	��	�	�	�
	�	�	�	�	�	�	�	�	�
B(�B(�B(�B(�B(�F�"�B(�B(�B(�J
$�
$�
$�
$�
$�E�
$�
$�
$� 
!�
!�
!�
!�
!��
!�
!�
!�
!�
!r

?>