
    +hs                     l    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y)	    N)EventThreadcurrent_thread)time)warnTMonitorTqdmSynchronisationWarningc                       e Zd ZdZy)r	   zhtqdm multi-thread/-process errors which may cause incorrect nesting
    but otherwise no adverse effectsN)__name__
__module____qualname____doc__     @/var/www/html/venv/lib/python3.12/site-packages/tqdm/_monitor.pyr	   r	   	   s
    (r   c                   2    e Zd ZdZi Zd Zd Zd Zd Zd Z	y)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                 b   t        j                  |        d| _        d| _        || _        || _        | j                  j                  dt              | _	         | j                  j                  dt                     | _        t        j                  | j                         | j                          y )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__   su    
 ,ZZ^^FD1
8$**..%8:		"

r   c                     | j                   j                          | t               ur| j                          | j	                         S N)r   setr   joinreportr!   s    r   r   zTMonitor.exit)   s2    ~''IIK{{}r   c                     | j                   j                  j                         D cg c]  }t        |d      r| c}S c c}w )Nstart_t)r   
_instancescopyhasattr)r!   is     r   get_instanceszTMonitor.get_instances/   s>    ==3388: *a1i(  * 	* *s   ?c                    | j                         }	 || _        | j                  j                  | j                         | j                  j                         ry | j                  j                         5  | j                         }| j                         }|D ]k  }| j                  j                         r
 d d d        y |j                  dkD  r5||j                  z
  |j                  k\  rd|_	        |j                  d       ~m || j                         k7  rt        dt        d       ~d d d        "# 1 sw Y   xY w)NT   )nolockzOSet changed size during iteration (see https://github.com/tqdm/tqdm/issues/481)   )
stacklevel)r   r   r   waitr   is_setr   get_lockr.   miniterslast_print_tmaxintervalrefreshr   r	   )r!   cur_t	instancesinstances       r   runzTMonitor.run5   s(   

 DJOO  !4!45%%' '') 

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