Mini Shell
3
�$`�! � @ s� d dl Z d dlZd dlmZmZ d dlmZ d dlmZ d dl m
Z
d dlmZm
Z
mZ G dd� de�Zd d
� ZG dd� de
�ZdS )
� N)�_�YumBase)�DownloadBaseCallback)�YumBaseError)�DebugInfoDownload)�log1�log2�RETURN_FAILUREc @ s e Zd ZdZdd� Zdd� ZdS )�YumDownloadCallbackzR
This class serves as a download progress handler for yum's progress bar.
c C s t j| � || _dS )zx
Sets up instance variables
Arguments:
total_pkgs - number of packages to download
N)r �__init__�observer)�selfr � r �$/usr/lib64/python3.6/yumdebuginfo.pyr # s
zYumDownloadCallback.__init__c C s | j j|t|d �� dS )a
A method used to update the progress
Arguments:
name - filename
frac - progress fracment (0 -> 1)
fread - formated string containing BytesRead
ftime - formated string containing remaining or elapsed time
�d N)r �update�int)r
�nameZfracZfreadZftimer r r �updateProgress/ s z"YumDownloadCallback.updateProgressN)�__name__�
__module__�__qualname__�__doc__r r r r r r r
s r
c C s$ t td�jt| j�| j�� ddiS )z0
A callback function for mirror errors.
zOProblem '{0!s}' occured while downloading from mirror: '{1!s}'. Trying next oneZfailr )�printr �format�strZ exceptionZmirror)ZcallBackObjr r r �downloadErrorCallback= s
r c sF e Zd Zd� fdd� Zdd� Zd d
� Zdd� Zd
d� Zdd� Z� Z S )�YumDebugInfoDownload�*debug*FTNc s: t t| �j|||||� t� | _|d k r6|| jjjd<