
    +j                     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	   zr
    tqdm multi-thread/-process errors which may cause incorrect nesting
    but otherwise no adverse effects
    N)__name__
__module____qualname____doc__     Q/home/wildlama/visual-decline/.venv/lib/python3.11/site-packages/tqdm/_monitor.pyr	   r	   	   s           r   c                   :    e Zd ZdZi Zd 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                 h   t          j        | d           d| _        d| _        || _        || _        | j                            dt                    | _	         | j                            dt                                | _        t          j        | j                   |                                  d S )Ntqdm_monitor)nameTr   r   r   )r   __init__daemonwokentqdm_clssleep_interval_testgetr   _timer   
was_killedatexitregister_atexit_signalstart)selfr   r   s      r   r   zTMonitor.__init__   s    >2222
 ,Z^^FD11
8$*..%88::+,,,

r   c                 8    | j                                          dS )z
        Non-joining shutdown signal.
        Avoids deadlocks at interpreter exit from other threads, dead forks, etc.
        This daemon thread is auto-reaped on shutdown without needing a join.
        N)r   setr#   s    r   r!   zTMonitor._atexit_signal*   s     	r   c                     | j                                          | t                      ur|                                  |                                 S N)r   r%   r   joinreportr&   s    r   exitzTMonitor.exit2   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>:   s6     * * *a1i((* * * *r   )r   
_instancescopyr&   s    r   get_instanceszTMonitor.get_instances8   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_lockr5   miniterslast_print_tmaxintervalrefreshr   r	   )r#   cur_t	instancesinstances       r   runzTMonitor.run>   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   r<   r&   s    r   r*   zTMonitor.reportg   s    ?))++++r   N)r   r   r   r   r   r   r!   r+   r5   rE   r*   r   r   r   r   r      s          E	 	 	    * * *' ' 'R, , , , ,r   )r   	threadingr   r   r   r   warningsr   __all__RuntimeWarningr	   r   r   r   r   <module>rK      s     3 3 3 3 3 3 3 3 3 3            3
4       X, X, X, X, X,v X, X, X, X, X,r   