ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/queue.cpython-311.pyc

�

�f�,��J�dZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZn
#e$rdZYnwxYwgd�Z
	ddl
mZn#e$rGd	�d
e��ZYnwxYwGd�de��ZGd
�d��ZGd�de��ZGd�de��ZGd�d��Ze�eZdSdS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic)�SimpleQueue)�Empty�Full�Queue�
PriorityQueue�	LifoQueuer)rc��eZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N��__name__�
__module__�__qualname__�__doc__���,/opt/alt/python311/lib64/python3.11/queue.pyrrs������>�>��rrc��eZdZdZdS)r	z4Exception raised by Queue.put(block=0)/put_nowait().Nrrrrr	r	s������:�:��Drr	c��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
dd�Zd
�Zd�Z
d�Zd�Zd�Zd�Zeej��Zd
S)r
zjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rc�0�||_|�|��tj��|_tj|j��|_tj|j��|_tj|j��|_d|_	dS�Nr)
�maxsize�_init�	threading�Lock�mutex�	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks��selfrs  r�__init__zQueue.__init__"s}������
�
�7�����^�%�%��
�#�,�T�Z�8�8���"�+�D�J�7�7��
�(�1�$�*�=�=��� !����rc���|j5|jdz
}|dkr.|dkrtd���|j���||_ddd��dS#1swxYwYdS)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  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 a ValueError if called more times than there were items
        placed in the queue.
        �rz!task_done() called too many timesN)r"r#�
ValueError�
notify_all)r%�
unfinisheds  r�	task_donezQueue.task_done9s����
 �	/�	/��.��2�J��Q�����>�>�$�%H�I�I�I��#�.�.�0�0�0�$.�D�!�
	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s�AA�A�"Ac��|j5|jr |j���|j� ddd��dS#1swxYwYdS)a�Blocks 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 thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)r"r#�wait�r%s r�joinz
Queue.joinOs����
 �	+�	+��'�
+��#�(�(�*�*�*��'�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�(=�A�Ac�l�|j5|���cddd��S#1swxYwYdS)�9Return the approximate size of the queue (not reliable!).N�r�_qsizer/s r�qsizezQueue.qsize\sy��
�Z�	!�	!��;�;�=�=�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s�)�-�-c�n�|j5|���cddd��S#1swxYwYdS)a�Return True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        Nr3r/s r�emptyzQueue.emptyas~���Z�	%�	%��{�{�}�}�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s�*�.�.c��|j5d|jcxko|���knccddd��S#1swxYwYdS)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr4r/s r�fullz
Queue.fullos����Z�	5�	5��t�|�4�4�4�4�t�{�{�}�}�4�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�'<�A�ATNc��|j5|jdk�r|s%|���|jkrt�n�|�T|���|jkr6|j���|���|jk�6n�|dkrtd���t
��|z}|���|jkrU|t
��z
}|dkrt�|j�|��|���|jk�U|�|��|xjdz
c_|j	�
��ddd��dS#1swxYwYdS)aPut an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).
        rN�''timeout' must be a non-negative number�r()r!rr4r	r.r)�time�_putr#r �notify)r%�item�block�timeout�endtime�	remainings      r�putz	Queue.putzs����]�	$�	$��|�a����6��{�{�}�}���4�4�"�
�5��_��+�+�-�-�4�<�7�7��
�*�*�,�,�,��+�+�-�-�4�<�7�7���q�[�[�$�%N�O�O�O�"�f�f�w�.�G��+�+�-�-�4�<�7�7�$+�d�f�f�$4�	�$��+�+�"&�J��
�*�*�9�5�5�5�	�+�+�-�-�4�<�7�7�

�I�I�d�O�O�O��!�!�Q�&�!�!��N�!�!�#�#�#�'	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�E E5�5E9�<E9c�r�|j5|s|���st�n�|�B|���s-|j���|����-n�|dkrt	d���t��|z}|���sL|t��z
}|dkrt�|j�|��|����L|���}|j���|cddd��S#1swxYwYdS)�Remove and return an item from the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until an item is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Empty exception if no item was available within that time.
        Otherwise ('block' is false), return an item if one is immediately
        available, else raise the Empty exception ('timeout' is ignored
        in that case).
        Nrr;r<)	r r4rr.r)r=�_getr!r?)r%rArBrCrDr@s      r�getz	Queue.get�sp���^�	�	��
3��{�{�}�}� ��K� ����+�+�-�-�*��N�'�'�)�)�)��+�+�-�-�*���1��� �!J�K�K�K��&�&�7�*���+�+�-�-�3� '�$�&�&� 0�I� �C�'�'�#���N�'�'�	�2�2�2�	�+�+�-�-�3�
�9�9�;�;�D��M� � �"�"�"��%	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�DD,�,D0�3D0c�0�|�|d���S)z�Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        F�rA�rE�r%r@s  r�
put_nowaitzQueue.put_nowait�����x�x��E�x�*�*�*rc�.�|�d���S�z�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        FrK�rIr/s r�
get_nowaitzQueue.get_nowait�����x�x�e�x�$�$�$rc�,�t��|_dS�N)r�queuer$s  rrzQueue._init�s���W�W��
�
�
rc�*�t|j��SrV��lenrWr/s rr4zQueue._qsize�����4�:���rc�:�|j�|��dSrV�rW�appendrMs  rr>z
Queue._put�����
���$�����rc�4�|j���SrV)rW�popleftr/s rrHz
Queue._get�s���z�!�!�#�#�#r)r�TN)rrrrr&r,r0r5r7r9rErIrNrSrr4r>rH�classmethod�types�GenericAlias�__class_getitem__rrrr
r
s��������
"�"�"�"�./�/�/�,+�+�+�!�!�!�
%�%�%�	5�	5�	5�$�$�$�$�@����>+�+�+�%�%�%������� � � �$�$�$�$��E�$6�7�7���rr
c�*�eZdZdZd�Zd�Zd�Zd�ZdS)rz�Variant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    c��g|_dSrV�rWr$s  rrzPriorityQueue._init��
����
�
�
rc�*�t|j��SrVrYr/s rr4zPriorityQueue._qsize�r[rc�0�t|j|��dSrV)rrWrMs  rr>zPriorityQueue._put�s�����T�"�"�"�"�"rc�*�t|j��SrV)rrWr/s rrHzPriorityQueue._get�s���t�z�"�"�"rN�rrrrrr4r>rHrrrrr�sZ��������
������#�#�#�#�#�#�#�#rrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)rzBVariant of Queue that retrieves most recently added entries first.c��g|_dSrVrir$s  rrzLifoQueue._init�rjrc�*�t|j��SrVrYr/s rr4zLifoQueue._qsize�r[rc�:�|j�|��dSrVr]rMs  rr>zLifoQueue._put�r_rc�4�|j���SrV)rW�popr/s rrHzLifoQueue._get�s���z�~�~���rNrnrrrrr�sV������L�L������� � � � � � � � rrc�`�eZdZdZd�Zdd�Zdd�Zd�Zd�Zd	�Z	d
�Z
eej
��ZdS)�_PySimpleQueuezYSimple, unbounded FIFO queue.

    This pure Python implementation is not reentrant.
    c�^�t��|_tjd��|_dSr)r�_queuer�	Semaphore�_countr/s rr&z_PySimpleQueue.__init__s#���g�g����)�!�,�,����rTNc�l�|j�|��|j���dS)z�Put the item on the queue.

        The optional 'block' and 'timeout' arguments are ignored, as this method
        never blocks.  They are provided for compatibility with the Queue class.
        N)rxr^rz�release)r%r@rArBs    rrEz_PySimpleQueue.puts4��	
����4� � � ���������rc��|�|dkrtd���|j�||��st�|j���S)rGNrr;)r)rz�acquirerrxra)r%rArBs   rrIz_PySimpleQueue.getsT����7�Q�;�;��F�G�G�G��{�"�"�5�'�2�2�	��K��{�"�"�$�$�$rc�0�|�|d���S)z�Put an item into the queue without blocking.

        This is exactly equivalent to `put(item, block=False)` and is only provided
        for compatibility with the Queue class.
        FrKrLrMs  rrNz_PySimpleQueue.put_nowait*rOrc�.�|�d���SrQrRr/s rrSz_PySimpleQueue.get_nowait2rTrc�2�t|j��dkS)zCReturn True if the queue is empty, False otherwise (not reliable!).r�rZrxr/s rr7z_PySimpleQueue.empty:s���4�;���1�$�$rc�*�t|j��S)r2r�r/s rr5z_PySimpleQueue.qsize>s���4�;���rrb)rrrrr&rErIrNrSr7r5rcrdrerfrrrrvrvs���������-�-�-�����%�%�%�%�"+�+�+�%�%�%�%�%�%� � � �$��E�$6�7�7���rrv)rrrd�collectionsr�heapqrrr=rrxr�ImportError�__all__r�	Exceptionr	r
rrrvrrr�<module>r�s
��-�-���������������#�#�#�#�#�#�#�#�"�"�"�"�"�"��"�"�"�"�"�"�"�������K�K�K�����R�
Q�
Q��
����������
�
�
�
�
�
�
�
�	�
�
�
�
�
�
����
	�	�	�	�	�9�	�	�	�
@8�@8�@8�@8�@8�@8�@8�@8�F#�#�#�#�#�E�#�#�#�&
 �
 �
 �
 �
 ��
 �
 �
 � @8�@8�@8�@8�@8�@8�@8�@8�F�� �K�K�K��s�'�1�1�A�A�A

Zerion Mini Shell 1.0