403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/sos/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/sos/progressbar.pyo
Ñò
Í?Jc@sÄdZdZdZdZdZddkZddkZddklZy ddkl	Z	ddk
Z
Wnej
onXddkZd	e
fd
„ƒYZde
fd„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZeƒdeƒgZde
fd„ƒYZedjoPddkZd„Zd„Zd„Zd „ZeƒeƒeƒeƒndS(!sFText progressbar library for python.

This library provides a text mode progressbar. This is tipically used
to display the progress of a long running operation, providing a
visual clue that processing is underway.

The ProgressBar class manages the progress, and the format of the line
is given by a number of widgets. A widget is an object that may
display diferently depending on the state of the progress. There are
three types of widget:
- a string, which always shows itself;
- a ProgressBarWidget, which may return a diferent value every time
it's update method is called; and
- a ProgressBarWidgetHFill, which is like ProgressBarWidget, except it
expands to fill the remaining width of the line.

The progressbar module is very easy to use, yet very powerful. And
automatically supports features like auto-resizing when available.
sNilton Volpatos$first-name dot last-name @ gmail.coms
2006-05-07s2.2iÿÿÿÿN(tarray(tioctltProgressBarWidgetcBseZdZd„ZRS(sThis is an element of ProgressBar formatting.

    The ProgressBar object will call it's update value when an update
    is needed. It's size may change between call, but the results will
    not be good if the size changes drastically and repeatedly.
    cCsdS(sReturns the string representing the widget.

        The parameter pbar is a reference to the calling ProgressBar,
        where one can access attributes of the class for knowing how
        the update must be made.

        At least this function must be overriden.N((tselftpbar((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytupdateIs(t__name__t
__module__t__doc__R(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRBstProgressBarWidgetHFillcBseZdZd„ZRS(sfThis is a variable width element of ProgressBar formatting.

    The ProgressBar object will call it's update value, informing the
    width this object must the made. This is like TeX \hfill, it will
    expand to fill the line. You can use more than one in the same
    line, and they will all have the same width, and together will
    fill the line.
    cCsdS(s[Returns the string representing the widget.

        The parameter pbar is a reference to the calling ProgressBar,
        where one can access attributes of the class for knowing how
        the update must be made. The parameter width is the total
        horizontal width the widget must have.

        At least this function must be overriden.N((RRtwidth((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR\s	(RRRR(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR	SstETAcBs eZdZd„Zd„ZRS(s(Widget for the Estimated Time of ArrivalcCstidti|ƒƒS(Ns%H:%M:%S(ttimetstrftimetgmtime(Rtseconds((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytformat_timejscCsj|idjodS|iod|i|iƒS|i}||i|i|}d|i|ƒSdS(NisETA:  --:--:--sTime: %ssETA:  %s(tcurrvaltfinishedRtseconds_elapsedtmaxval(RRtelapsedteta((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRls
	(RRRRR(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRhs	tFileTransferSpeedcBs eZdZd„Zd„ZRS(sBWidget for showing the transfer speed (useful for file transfers).cCs(d|_ddddddg|_dS(Ns%6.2f %stBtKtMtGtTtP(tfmttunits(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt__init__xs	cCs{|idjo
d}nt|iƒ|i}|}x-|iD]"}|djoPn|d:}q@W|i||dfS(Ngíµ ÷ÆÀ>giès/s(RtfloatRRR(RRtbpstspdtu((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR{s


(RRRR R(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRvs	tRotatingMarkercBs#eZdZdd„Zd„ZRS(s2A rotating marker for filling the bar of progress.s|/-\cCs||_d|_dS(Niÿÿÿÿ(tmarkerstcurmark(RR&((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR ‰s	cCsA|io|idS|idt|iƒ|_|i|iS(Nii(RR&R'tlen(RR((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRŒs
(RRRR R(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR%‡st
PercentagecBseZdZd„ZRS(sJust the percentage done.cCsd|iƒS(Ns%3d%%(t
percentage(RR((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR”s(RRRR(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR)’stBarcBs2eZdZdddd„Zd„Zd„ZRS(s5The bar of progress. It will strech to fill the line.t#t|cCs||_||_||_dS(N(tmarkertlefttright(RR.R/R0((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR ™s		cCs5t|ittfƒo|iS|ii|ƒSdS(N(t
isinstanceR.tstrtunicodeR(RR((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt_format_markerscCst|iƒ}|t|iƒt|iƒ}t||dƒ}|i|ƒ}|i||i|ƒ|i}|S(Nid(R*R(R/R0tintR4tljust(RRR
tpercenttcwidthtmarked_widthtmtbar((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR¢s !(RRRR R4R(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR+—s	t
ReverseBarcBseZdZd„ZRS(s2The reverse bar of progress, or bar of regress. :)cCst|iƒ}|t|iƒt|iƒ}t||dƒ}|i|ƒ}|i||i|ƒ|i}|S(Nid(R*R(R/R0R5R4trjust(RRR
R7R8R9R:R;((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR¬s !(RRRR(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR<ªst tProgressBarcBsneZdZdedeid„Zd„Zd„Z	d„Z
d„Zd„Zd„Z
d	„Zd
„ZRS(sóThis is the ProgressBar class, it updates and prints the bar.

    The term_width parameter may be an integer. Or None, in which case
    it will try to guess it, if it fails it will default to 80 columns.

    The simple use is like this:
    >>> pbar = ProgressBar().start()
    >>> for i in xrange(100):
    ...    # do something
    ...    pbar.update(i+1)
    ...
    >>> pbar.finish()

    But anything you want to do is possible (well, almost anything).
    You can supply different widgets of any type in any order. And you
    can even write your own widgets! There are many widgets already
    shipped and you should experiment with them.

    When implementing a widget update method you may access any
    attribute or function of the ProgressBar object calling the
    widget's update method. The most important attributes you would
    like to access are:
    - currval: current value of the progress, 0 <= currval <= maxval
    - maxval: maximum (and final) value of the progress
    - finished: True if the bar is have finished (reached 100%), False o/w
    - start_time: first time update() method of ProgressBar was called
    - seconds_elapsed: seconds elapsed since start_time
    - percentage(): percentage of the progress (this is a method)
    idcCsµ||_||_||_t|_|djoJy3|iddƒtiti|iƒt	|_Wq„d|_
q„Xn
||_
d|_t|_d|_
d|_d|_dS(NiOiiÿÿÿÿ(RtwidgetstfdtFalset
signal_settNonet
handle_resizetsignaltSIGWINCHtTruet
term_widthRRtprev_percentaget
start_timeR(RRR@RIRA((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR Ós"				

					cCs8tdt|itidƒƒd \}}||_dS(Nthtiit(RRRAttermiost
TIOCGWINSZRI(RtsignumtframeRLtw((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyREês+cCs|id|iS(s'Returns the percentage of the progress.gY@(RR(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR*îsc	Cs
g}g}d}d}x¸t|iƒD]§\}}t|tƒo(|i|ƒ|i|ƒ|d7}q(t|ttfƒo!|i|ƒ|t|ƒ7}q(|i|ƒ}|t|ƒ7}|i|ƒq(Wx3|D]+}||i||i	||ƒ||<qÚW|S(Nii(
t	enumerateR@R1R	tappendR2R3R(RRI(	Rtrt
hfill_indst	num_hfillt	currwidthtiRStwevaltiw((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt_format_widgetsòs(


)cCsdi|iƒƒi|iƒS(Nt(tjoinR]R6RI(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt_format_linescCst|iƒƒt|iƒjS(N(R5R*RJ(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt_need_update
scCs½||_|iƒp
|iodS|iptiƒ|_ntiƒ|i|_|iƒ|_||ijo|i	i
|iƒdƒn$t|_|i	i
|iƒdƒdS(s(Updates the progress bar to a new value.Ns
s
(
RRaRRKRRR*RJRRAtwriteR`RH(Rtvalue((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR
s	
	cCs|idƒ|S(sStart measuring time, and prints the bar at 0%.

        It returns self so you can use it like this:
        >>> pbar = ProgressBar().start()
        >>> for i in xrange(100):
        ...    # do something
        ...    pbar.update(i+1)
        ...
        >>> pbar.finish()
        i(R(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytstarts
cCs8|i|iƒ|iotititiƒndS(s&Used to tell the progress is finished.N(RRRCRFRGtSIG_DFL(R((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytfinish+s
N(RRRtdefault_widgetsRDtsyststderrR RER*R]R`RaRRdRf(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyR?µs								t__main__cCs‰dtƒdtdtƒƒdtƒdtƒg}td|ddƒiƒ}x)tdƒD]}|id|d	ƒq[W|i	ƒHdS(
NsTest: R>R.R@Ri€–˜i@Bi
i(
R)R+R%RRR?RdtrangeRRf(R@RRZ((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytexample19s

cCs—dtfd„ƒY}|ƒdtƒdtƒdtƒg}td|ddƒ}|iƒx)td	ƒD]}|id
|dƒqiW|iƒHdS(NtCrazyFileTransferSpeedcBseZdZd„ZRS(s%It's bigger between 45 and 80 percentcSsMd|iƒjo
djnodti||ƒSti||ƒSdS(Ni-iPsBigger Now (R*RR(RR((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRFs$(RRRR(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyRmDss <<<s>>> R>R@Ri€–˜i€„ii(	RR+R)RR?RdRkRRf(RmR@RRZ((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytexample2Cs'


cCsztdƒdtƒdtdƒg}td|ddƒiƒ}x)tdƒD]}|id|d	ƒqLW|iƒHdS(
Nt>R>t<R@Ri€–˜i@Bi
i(R+RR<R?RdRkRRf(R@RRZ((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytexample3Vs$

c
Cs¡dtƒdtddddddƒdtƒdtƒg}td	|d
dƒ}|iƒx4tdddƒD] }tidƒ|i	|ƒqnW|i
ƒHdS(NsTest: R>R.t0R/t[R0t]R@Riôidii2gš™™™™™É?iõ(R)R+RRR?RdRkRtsleepRRf(R@RRZ((s3/usr/lib/python2.6/site-packages/sos/progressbar.pytexample4_s


(Rt
__author__t__author_email__t__date__t__version__RhRRtfcntlRROtImportErrorRFtobjectRR	RRR%R)R+R<RgR?RtosRlRnRqRv(((s3/usr/lib/python2.6/site-packages/sos/progressbar.pyt<module>(s@

	
				


Youez - 2016 - github.com/yon3zu
LinuXploit