\e"(dZddlZddlZddlZddlZddlZddlmZddlZddl m Z gdZ de de fdZ Gd d ZGd d e jeZGd de j eZGdde j"eZy)z'Progress reporting for text interfaces.N)Callable)base)AcquireProgress CdromProgress OpProgressmsgreturncftj|}||k(rtj|d}|S)z>Translate the message, also try apt if translation is missing.apt)apt_pkggettext)rress 3/usr/lib/python3/dist-packages/apt/progress/text.py_r s, //# C czooc5) Jc VeZdZdZd dej dzddfdZd dedededdfd Z y) TextProgressz.Internal Base class for text progress classes.Noutfiler cD|xstj|_d|_y)Nr)sysstdout_file_widthselfrs r__init__zTextProgress.__init__+s*   rrnewlinemaximizec|jjd|jj||jt|kDr5|jj|jt|z dzn&|r$t |jt||_|r|jjdy|jj y)z8Write the message on the terminal, fill remaining space.   N)rwriterlenmaxflush)rrrrs r_writezTextProgress._write/s   ;;S ! JJ  dkkCH4; < dkk3s84DK  JJ  T " JJ   rN)TF) __name__ __module__ __qualname____doc__io TextIOBaserstrboolr'rrrr(sC8  4#tPTrrc\eZdZdZd dej dzddfdZd dedzddfdZd dZ y) rz\Operation progress reporting. This closely resembles OpTextProgress in libapt-pkg. Nrr c|tj||tjj|d|_y)N)rrrrold_oprs rrzOpProgress.__init__Fs+dG,   & rpercentc$tjj|||jr'|jr|j |j|j d|j |jfzdd|j |_y)z1Called periodically to update the user interface.z %s... %i%% FTN)rrupdate major_changer5r'opr6)rr6s rr8zOpProgress.updateKsb tW-    KK $ Ndggt||%<.>-?@@ ::   Hw224::3F3FGG GD Drr_c*tjj||t|jdr.t j |jjsy|j|jzdzt|j|jzz }d}d|z}d}|jrztt|j|jz |jz }djt!j"|jt!j$|}|j&D]}d}|j(sV|j*rId|j*z}t-|t-|zt-|z|j.k\rn||z }d}hd}|j(j0j2r=|d |j(j0j2|j(j4fzz }n|d |j(j6zz }|j(j0j8r&|d |j(j0j8zz }|d t!j"|j:zz }|j<ra|j(j0j>sA|d t!j"|j<|j:dz|j<z fzz }|dz }t-|t-|zt-|z|j.k\rn||z }|s|tAdz }|jr-||j.t-|z t-|z dz|zz }|jC|dy)zPeriodically invoked while the Acquire process is underway. Return False if the user asked to cancel the whole Acquire process.rMTgY@Fz%i%%r4z {}B/s {}z [%s]z [%i %sz [%sz %sz %sBz /%sB %i%%]z [Working]r!)"rrpulserOrrPrQrM current_bytes current_itemsr? total_bytes total_items current_cpsintformatr ra time_to_strworkers current_itemrfr$rr_rl shortdescr^active_subprocess current_size total_sizerkrr') rr_r6showntvalendetaworkervals rrozAcquireProgress.pulses& ""4/ 4::x (4::;L;L;N1O&&););;uD   t// /I     eD,,t/A/AABTEUEUUVC$$##D$4$45##C(C mm% FC&&==!FMM1C4y3s8+c#h6$++ECKD EE""((++y''--00''11$ v 3 3 ? ???""((::uv2288JJJJ 6G//0C0CDD DC  )<)<)B)B)K)K{''(9(9:''%/&2C2CC& 3JC4y3s8#c#h.$++= K% N AlO #D    T[[3s8+c$i73>D DD D% rmediumdrivectjj||||jt d||fzt dvS)z7Prompt the user to change the inserted removable media.zUMedia change: please insert the disc labeled '%s' in the drive '%s' and press enter )cC)rr media_changer'rinput)rrrs rrzAcquireProgress.media_changesP ))$> 6  uo   wj((rctjj||jt dt j |jt j|jt j |jfzjdddl }|j|j|jy)z/Invoked when the Acquire process stops running.zFetched %sB in %s (%sB/s) r"rN)rrstopr'rr ra fetched_bytesrw elapsed_timertrstriprHrIrD)rrHs rrzAcquireProgress.stops !!$' /0''(:(:;''(9(9:''(8(89 fTl   foot||4rr(r>)r)r*r+r,r-r.rrGobjectrJr AcquireItemDescr]rerjAcquirer0ror/rrr1rrrr[s1  4  "V " "G338008T8 '11 d F7??FtFP )3 )s )t )5rrcBeZdZdZdedzfdZdededdfdZdefdZ y) rzText CD-ROM progress.r Nctjj||jt dd t t dS#t$rYywxYw)z,Ask the user to provide a name for the disc.zDPlease provide a name for this medium, such as 'Debian 2.1r1 Disk 1'F:N)rrask_cdrom_namer'rr/rKeyboardInterruptr=s rrzCdromProgress.ask_cdrom_name sY ))$/ (     uSz? "   sA AAtextcurrentcptjj||||r|j|dyy)zSet the current progress.FN)rrr8r')rrrs rr8zCdromProgress.updates0 !!$g6  KKe $ rctjj||jt dd t t dk(S#t$rYywxYw)z"Ask the user to change the CD-ROM.z4Please insert an installation medium and press enterFr4)rr change_cdromr'rr0rrr=s rrzCdromProgress.change_cdromsR ''- ALMuU 2 & &   sA AA) r)r*r+r,r/rrur8r0rr1rrrrs; d %3%%% drr)r,r-rPrHrtypescollections.abcrr apt.progressr__all__r/rrrrrr1rrrs". $ <330,6i5d**Li5XD&& r