
    LMhs                     z    d dl Z d dlmZmZmZ d dlmZ d dlmZ ddgZ G d de	          Z
 G d de          ZdS )	    N)EventThreadcurrent_thread)time)warnTMonitorTqdmSynchronisationWarningc                       e Zd ZdZdS )r	   zhtqdm multi-thread/-process errors which may cause incorrect nesting
    but otherwise no adverse effectsN)__name__
__module____qualname____doc__     M/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/tqdm/_monitor.pyr	   r	   	   s        ( (Dr   c                   4    e Zd ZdZi Zd Zd Zd Zd Zd Z	dS )r   a^  
    Monitoring thread for tqdm bars.
    Monitors if tqdm bars are taking too much time to display
    and readjusts miniters automatically if necessary.

    Parameters
    ----------
    tqdm_cls  : class
        tqdm class to use (can be core tqdm or a submodule).
    sleep_interval  : float
        Time to sleep between monitoring checks.
    c                 d   t          j        |            d| _        d| _        || _        || _        | j                            dt                    | _	         | j                            dt                                | _        t          j        | j                   |                                  d S )NTr   r   r   )r   __init__daemonwokentqdm_clssleep_interval_testgetr   _timer   
was_killedatexitregisterexitstart)selfr   r   s      r   r   zTMonitor.__init__   s    
 ,Z^^FD11
8$*..%88::	"""

r   c                     | j                                          | t                      ur|                                  |                                 S N)r   setr   joinreportr!   s    r   r   zTMonitor.exit)   sB    ~''''IIKKK{{}}r   c                 R    d | j         j                                        D             S )Nc                 2    g | ]}t          |d           |S )start_t)hasattr).0is     r   
<listcomp>z*TMonitor.get_instances.<locals>.<listcomp>1   s6     * * *a1i((* * * *r   )r   
_instancescopyr'   s    r   get_instanceszTMonitor.get_instances/   s3    * *4=388:: * * * 	*r   c                    |                                  }	 || _        | j                            | j                   | j                                        rd S | j                                        5  |                                  }|                                 }|D ]e}| j                                        r d d d            d S |j	        dk    r0||j
        z
  |j        k    rd|_	        |                    d           ~f||                                 k    rt          dt          d           ~d d d            n# 1 swxY w Y   4)NT   )nolockzOSet changed size during iteration (see https://github.com/tqdm/tqdm/issues/481)   )
stacklevel)r   r   r   waitr   is_setr   get_lockr1   miniterslast_print_tmaxintervalrefreshr   r	   )r!   cur_t	instancesinstances       r   runzTMonitor.run5   s   

%	 DJO  !4555%%''  ''))  

 ..00	 ) ! !H--//         !)A--"X%::x?SSS -.) (((555  2 2 4 444 J3C C C C 5              %	s   0AD=A-D==EEc                 6    | j                                          S r#   )r   r8   r'   s    r   r&   zTMonitor.report^   s    ?))++++r   N)
r   r   r   r   r   r   r   r1   rA   r&   r   r   r   r   r      sq          E	 	 	  * * *' ' 'R, , , , ,r   )r   	threadingr   r   r   r   warningsr   __all__RuntimeWarningr	   r   r   r   r   <module>rG      s     3 3 3 3 3 3 3 3 3 3            3
4	 	 	 	 	 	 	 	P, P, P, P, P,v P, P, P, P, P,r   