ok

Mini Shell

Direktori : /proc/self/root/lib/python2.7/site-packages/yum/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/yum/callbacks.pyc

�
8M�bc@s�dZddlZddlmZmZmZdZdZdZdZ	dZ
id	e6d
e6de	6de
6Zd
dd��YZddd��YZ
defd��YZdS(s'Classes for handling various callbacks.i����N(t	BaseMetertformat_timet
format_numberi
iiii(sDownloading PackagessCheck Package SignaturessRunning Test TransactionsRunning TransactiontProcessTransBaseCallbackcBs#eZdZd�Zdd�ZRS(sMA class to handle callbacks from
    :func:`YumBase.processTransaction`.
    cCstjd�|_dS(Ns)yum.verbose.ProcessTrasactionBaseCallback(tloggingt	getLoggertlogger(tself((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyt__init__+scCs-|tj�kr)|jjt|�ndS(s�Handle an event by logging it.

        :param state: a number indicating the type of callback
        :param data: data associated with the callback
        N(tPT_MESSAGEStkeysRtinfo(Rtstatetdata((s1/usr/lib/python2.7/site-packages/yum/callbacks.pytevent.sN(t__name__t
__module__t__doc__RtNoneR(((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR's	tProcessTransNoOutputCallbackcBs#eZdZd�Zdd�ZRS(scA class to handle callbacks from
    :func:`YumBase.processTransaction`, without logging them.
    cCsdS(N((R((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR;scCsdS(s�Handle an event.

        :param state: a number indicating the type of callback
        :param data: data associated with the callback
        N((RRR
((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR>sN(RRRRRR(((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR7s	tDownloadBaseCallbackcBsYeZdZd�Zdd�Zdd�Zdd�Zdd�Zd�Z	d�Z
RS(	s�This is a base class that can be extended to implement a custom
    download progress handler to be used with
    :func:`YumBase.repos.setProgressBar`.
    
    Example::
    
       from yum.callbacks import DownloadBaseCallback
       
       class MyDownloadCallback(  DownloadBaseCallback ):
   
           def updateProgress(self,name,frac,fread,ftime):
               '''
               Update the progressbar
               @param name: filename
               @param frac: Progress fracment (0 -> 1)
               @param fread: formated string containing BytesRead
               @param ftime : formated string containing remaining or elapsed time
               '''
               pct = int( frac*100 )
               print " %s : %s " % (name,pct)
   
   
       if __name__ == '__main__':
           my = YumBase()
           my.doConfigSetup()
           dnlcb = MyDownloadCallback()
           my.repos.setProgressBar( dnlcb )
           for pkg in my.pkgSack:
               print pkg.name
       cCstj|�d|_dS(Nt(RRttotSize(R((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyRes
cCstj|||�dS(sUpdate the status bar.

        :param amount_read: the amount of data, in bytes, that has been read
        :param now: the current time in seconds since the epoch.  If
           *now* is not given, the output of :func:`time.time()` will
           be used.
        N(Rtupdate(Rtamount_readtnow((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyRiscCsJ|j�}|j|ddd�|jdk	rFt|j�|_ndS(NgR(t_getNametupdateProgresstsizeRRR(RRtname((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyt	_do_startssc
Cs�t|�}|j�}|jdkra|jj�}t|�}d}|j||||�n@|jj�}t|�}	|jj	�}|j||||	�dS(Ng(
RRRRtretelapsed_timeRRtremaining_timet
fraction_read(
RRRtfreadRtetimetfetimetfractrtimetfrtime((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyt
_do_updateyscCsGt|jj��}t|�}|j�}|j|d||�dS(Ng�?(RRR RRR(RRRt
total_timet
total_sizeR((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyt_do_end�scCs=|jr0t|j�td�kr0|j}n	|j}|S(s>
        Get the name of the package being downloaded
        R(ttextttypetbasename(RR((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR�s$	cCsdS(s�Update the progressbar.  This method should be overridden
        by subclasses to implement the handler.

        :param name: the name of the filed being downloaded
        :param frac: number between 0 and 1 representing the fraction
            fraction of the file that has been downloaded
        :param fread: formatted string containing the number of bytes read
        :param ftime: formatted string containing remaining or elapsed time

        N((RRR&R#tftime((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyR�sN(RRRRRRRR)R,RR(((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyRFs	
	
(((RRturlgrabber.progressRRRtPT_DOWNLOADtPT_DOWNLOAD_PKGStPT_GPGCHECKt
PT_TEST_TRANStPT_TRANSACTIONR	RRR(((s1/usr/lib/python2.7/site-packages/yum/callbacks.pyt<module>s



Zerion Mini Shell 1.0