JFIF$        dd7 

Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/__pycache__/_queue.cpython-311.pyc

�

��-������dZddlZddlmZddlmZddlmZerddlmZgd�Z	Gd�d	e
��ZGd
�de
��ZGd�d
e
��ZdS)a�
A fork of Python 3.6's stdlib queue with Lock swapped out for RLock to avoid a
deadlock while garbage collecting.

See
https://codewithoutrules.com/2017/08/16/concurrency-python/
https://bugs.python.org/issue14976
https://github.com/sqlalchemy/sqlalchemy/blob/4eb747b61f0c1b1c25bdee3856d7195d10a0c227/lib/sqlalchemy/queue.py#L1

We also vendor the code to evade eventlet's broken monkeypatching, see
https://github.com/getsentry/sentry-python/pull/484
�N)�deque)�time)�MYPY)�Any)�Empty�Full�Queuec��eZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N��__name__�
__module__�__qualname__�__doc__���q/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/_queue.pyrr�������:�:��Drrc��eZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().Nrrrrrr rrrc�l�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
dd�Zd
�Zd�Z
d�Zd�Zd�Zd�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�RLock�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)rr �
ValueError�
notify_all)r"�
unfinisheds  r�	task_donezQueue.task_doneBs����
 �	/�	/��.��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)rr �wait�r"s r�joinz
Queue.joinXs����
 �	+�	+��'�
+��#�(�(�*�*�*��'�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�(=�A�Ac�l�|j5|���cddd��S#1swxYwYdS)z9Return the approximate size of the queue (not reliable!).N�r�_qsizer,s r�qsizezQueue.qsizeesy��
�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.
        Nr/r,s r�emptyzQueue.emptyjs~���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)rrr0r,s r�fullz
Queue.fullxs����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%)rrr0rr+r&r�_putr r�notify)r"�item�block�timeout�endtime�	remainings      r�putz	Queue.put�s����]�	$�	$��|�a����6��{�{�}�}���4�4�"�f�f��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'E<�<F�Fc��|j5|s#|���st���n�|�B|���s-|j���|����-n�|dkrt	d���t��|z}|���sS|t��z
}|dkrt���|j�|��|����S|���}|j���|cddd��S#1swxYwYdS)aRemove 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).
        Nrr7r8)	rr0rr+r&r�_getrr:)r"r<r=r>r?r;s      r�getz	Queue.get�sx���^�	�	��
3��{�{�}�}�"��'�'�M�"����+�+�-�-�*��N�'�'�)�)�)��+�+�-�-�*���1��� �!J�K�K�K��&�&�7�*���+�+�-�-�3� '�$�&�&� 0�I� �C�'�'�#�g�g�
��N�'�'�	�2�2�2�	�+�+�-�-�3�
�9�9�;�;�D��M� � �"�"�"��%	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�D%D:�:D>�D>c�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�r<)r@�r"r;s  r�
put_nowaitzQueue.put_nowait�s���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.
        FrE)rCr,s r�
get_nowaitzQueue.get_nowait�s���x�x�e�x�$�$�$rc�,�t��|_dS�N)r�queuer!s  rrzQueue._init�s���W�W��
�
�
rc�*�t|j��SrK)�lenrLr,s rr0zQueue._qsize�s���4�:���rc�:�|j�|��dSrK)rL�appendrFs  rr9z
Queue._put�s���
���$�����rc�4�|j���SrK)rL�popleftr,s rrBz
Queue._get�s���z�!�!�#�#�#r)r)TN)rr
rrr#r)r-r1r3r5r@rCrGrIrr0r9rBrrrr	r	%s��������
"�"�"�"�./�/�/�,+�+�+�!�!�!�
%�%�%�	5�	5�	5�$�$�$�$�@����>+�+�+�%�%�%������� � � �$�$�$�$�$rr	)rr�collectionsrr�sentry_sdk._typesr�typingr�__all__�	Exceptionrr�objectr	rrr�<module>rYs
��������������������"�"�"�"�"�"���������
$�
$�
$��	�	�	�	�	�I�	�	�	�
	�	�	�	�	�9�	�	�	�
~$�~$�~$�~$�~$�F�~$�~$�~$�~$�~$r
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0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