o
    Ph                     @   s8   d dl mZ d dlmZ d dlmZ G dd deZdS )    )Queue)Thread)Listc                       sP   e Zd Zddeddf fddZdee fdd	Zg fdee fd
dZ  Z	S )r   r   maxsizereturnNc                    s   t  j|d d S )N)r   )super__init__)selfr   	__class__ R/var/www/html/env_mimamsha/lib/python3.10/site-packages/translatepy/utils/queue.pyr      s   zQueue.__init__threadsc                 C   s   |D ]	}|  r dS qdS )NTF)is_alive)r	   r   threadr   r   r   _threads_are_alive
   s
   zQueue._threads_are_alivec                 C   s~   | j 2 |  s| |r| j   |  s| |s|  s#td|  }| j  |W  d   S 1 s8w   Y  dS )zrRemove and return an item from the queue.

        It waits for a value or the termination of all threads
        zNo thread returned a valueN)	not_empty_qsizer   wait
ValueError_getnot_fullnotify)r	   r   itemr   r   r   get   s   

$z	Queue.get)r   )
__name__
__module____qualname__intr   r   r   r   r   __classcell__r   r   r
   r   r      s    r   N)queuer   _Queue	threadingr   translatepy.utils.annotationsr   r   r   r   r   <module>   s    