MINI MINI MANI MO

Path : /lib/python2.7/site-packages/yum/
File Upload :
Current File : //lib/python2.7/site-packages/yum/callbacks.pyc

ó
µ¢ß[c@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(sHandle 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.pyRs$	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



OHA YOOOO