File: //lib/python3/dist-packages/tqdm/__pycache__/_monitor.cpython-38.pyc
U
�{2\\ � @ s` d dl mZmZmZ d dlmZ d dlmZ d dlZddgZG dd� de �Z
G dd� de�ZdS ) � )�Event�Thread�current_thread)�time)�warnN�TMonitor�TqdmSynchronisationWarningc @ s e Zd ZdZdS )r zhtqdm multi-thread/-process errors which may cause incorrect nesting
but otherwise no adverse effectsN)�__name__�
__module__�__qualname__�__doc__� r
r
�//usr/lib/python3/dist-packages/tqdm/_monitor.pyr s c @ s@ e Zd ZdZdZdZdd� Zdd� Zdd� Zd d
� Z dd� Z
dS )
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 : fload
Time to sleep between monitoring checks.
Nc C sv t �| � d| _t� | _d| _|| _|| _tj d k r>tj | _ nt
| _ tjd k rXtj| _nt| _t�
| j� | �� d S )NTr )r �__init__Zdaemonr �
was_killed�woken�tqdm_cls�sleep_intervalr �_timer �_event�atexit�register�exit�start)�selfr r r
r
r r s
zTMonitor.__init__c C s$ | j �� | t� k r| �� | �� S �N)r �setr �join�report�r r
r
r r 2 s
z
TMonitor.exitc C s dd� | j j�� D �S )Nc S s g | ]}t |d �r|�qS )Zstart_t)�hasattr)�.0�ir
r
r �
<listcomp>: s
�z*TMonitor.get_instances.<locals>.<listcomp>)r Z
_instances�copyr r
r
r �
get_instances8 s zTMonitor.get_instancesc C s� | � � }|| _| j�| j� | j�� r*d S | j�� �| | � � }| �� }|D ]J}| j�� rh W 5 Q R � d S |j dkrJ||j
|jkrJd|_ |jdd� qJ|| �� kr�t
dt� W 5 Q R X qd S )N� T)ZnolockzOSet changed size during iteration (see https://github.com/tqdm/tqdm/issues/481))r r r �waitr �is_setr Zget_lockr% ZminitersZlast_print_tZmaxintervalZrefreshr r )r Zcur_tZ instances�instancer
r
r �run>