AlkantarClanX12

Your IP : 3.137.175.80


Current Path : /usr/lib/python3.6/site-packages/dnf/cli/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/cli/__pycache__/progress.cpython-36.pyc

3

�ft`��@spddlmZddlmZmZddlmZddlmZddl	m	Z	ddl
Z
ddlZddl
ZGdd�dejj�ZdS)	�)�unicode_literals)�
format_number�format_time)�_term_width)�unicode)�timeNc@sreZdZdZejjdejjdejjdejj	diZ
ejdddfd	d
�Z
dd�Zddd�Zdd�Zdd�Zdd�ZdS)�MultiFileProgressMeterz"Multi-file download progress meterZFAILEDZSKIPPEDZMIRRORZDRPMg333333�?g�?g@cCsp||_||_||_||_d|_d|_tjj�|_d|_	d|_
d|_g|_i|_
d|_d|_d|_d|_d|_dS)z�Creates a new progress meter instance

        update_period -- how often to update the progress bar
        tick_period -- how fast to cycle through concurrent downloads
        rate_average -- time constant for average speed calculation
        rN)�fo�
update_period�tick_period�rate_average�unknown_progres�
total_drpm�sys�stdout�isatty�	done_drpm�
done_files�	done_size�active�state�	last_time�	last_size�rate�total_files�
total_size)�selfr	r
rr�r�/usr/lib/python3.6/progress.py�__init__&s"zMultiFileProgressMeter.__init__cCstjjd||j�dS)NZwrite_flush)�dnf�utilZ_terminal_messengerr	)r�msgrrr�message?szMultiFileProgressMeter.messagercCsF||_||_||_d|_d|_d|_g|_i|_d|_d|_	d|_
dS)Nr)rrrrrrrrrrr)rrrZtotal_drpmsrrr�startBszMultiFileProgressMeter.startcCs�t�}t|�}t|j�}t|�}||jkrD|df|j|<|jj|�|j|\}}||f|j|<|j||7_||j|j	kr�||j
kr�||_
|j|�dS)Nr)rr�int�
download_sizerr�appendrrr
r�_update)r�payload�done�now�textZtotalr$�oldrrr�progressSs


zMultiFileProgressMeter.progresscCsJ|jrj||j}|j|j}|dkrj|dkrj||}|jdk	rdt||jd�}|||jd|}||_||_|j|_|js�dS|jt||j	�t
|j�}|jdkr�d|jd}t
|j�dkr�|d|jt
|j�7}d||j|f}|jo�|j
�rt|j
|j|j�}nd}d|j�r,t|j�ndt|j�|f}	t�t
|	�}
|
d	d
}|dk�r0|j
�r�|jd|j
}t|j|d
|j
d
�\}}
d
|d|
}d||||	f}	|
|d	8}
nj|jd}d}
|dk�r�dn|}d|d
|
}d|||	f}	|
|d	8}
|jd|k�r*|jdnd|_|jd|
|
||	f�dS)Nr�z%dz-%dz(%s/%d): %sz--:--z %5sB/s | %5sB %9s ETA
z---  ����d�=�-z%3d%% [%-*s]%s�� z
     [%-*s]%sz%-*.*s%s)rrrr�minrrrr%r�lenrrrrrr�divmodr
r#)rr+Z
delta_timeZ
delta_sizerZweightr,�nZtime_etar"�leftZblZpct�pZbarrrrr(gsX




zMultiFileProgressMeter._updatecCs�t�}}t|�}t|j�}d}|tjjkr.n�|tjjkrJ|jd7_nt||j	kr�|j	j
|�\}}|jj|�||8}|j
d7_
|j|7_n(|tjjkr�|j
d7_
|j|7_|�r*|tjjkr�|jdkr�d|j||j|j|f}	nd|j||f}	t�t|	�d}
d|	|
|f}	nl|jdk�rHd|j
|j|f}t||d�}dtt|�|�t|�t|�f}	t�t|	�}
d	|
|
||	f}	|j|	�|j�r�|j|�dS)
Nrr/z[%s %d/%d] %s: z	[%s] %s: z%s%-*s
z(%d/%d): %sg����MbP?z %5sB/s | %5sB %9s    
z%-*.*s%s)rrr%r&r �callback�
STATUS_MIRROR�STATUS_DRPMrr�popr�removerr�STATUS_ALREADY_EXISTSr�STATUS_2_STRrr9r�maxr�floatrr#r()rr)ZstatusZerr_msgr$r+r,�sizer*r"r<Ztmrrr�end�sH



zMultiFileProgressMeter.endN)r)�__name__�
__module__�__qualname__�__doc__r r>Z
STATUS_FAILEDrCr?r@rDr�stderrrr#r$r.r(rHrrrrrs
5r)Z
__future__rZdnf.cli.formatrrZdnf.cli.termrZ
dnf.pycomprrrZdnf.callbackr Zdnf.utilr>ZDownloadProgressrrrrr�<module>s