+
    S^i"(                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RI	H
t
 . ROtR R lt ! R	 R
4      t ! R R]
P                  ]4      t ! R R]
P                  ]4      t ! R R]
P                   ]4      tR# )z'Progress reporting for text interfaces.N)Callable)baseAcquireProgressCdromProgress
OpProgressc                0    V ^8  d   QhR\         R\         /# )   msgreturnstr)formats   "3/usr/lib/python3/dist-packages/apt/progress/text.py__annotate__r       s      3 3     c                l    \         P                  ! V 4      pW8X  d   \         P                  ! V R4      pV# )z>Translate the message, also try apt if translation is missing.apt)apt_pkggettext)r	   ress   & r   _r       s*    
//#
C
zooc5)Jr   c                   P   a  ] tR t^(t o RtRV 3R lR lltR	V 3R lR lltRtV tR# )
TextProgressz.Internal Base class for text progress classes.Nc                F   < V ^8  d   QhRS[ P                  R,          RR/# r   outfileNr
   io
TextIOBase)r   __classdict__s   "r   r   TextProgress.__annotate__+   s$       4  r   c                R    T;'       g    \         P                  V n        ^ V n        R# )    N)sysstdout_file_widthselfr   s   &&r   __init__TextProgress.__init__+   s    **


r   c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r   r	   newlinemaximizer
   Nr   bool)r   r   s   "r   r   r    /   s*      #  t PT r   c                   V P                   P                  R4       V P                   P                  V4       V P                  \        V4      8  d>   V P                   P                  V P                  \        V4      ,
          R,          4       M,V'       d%   \	        V P                  \        V4      4      V n        V'       d   V P                   P                  R4       R# V P                   P                  4        R# )z8Write the message on the terminal, fill remaining space. 
N)r%   writer&   lenmaxflush)r(   r	   r,   r-   s   &&&&r   _writeTextProgress._write/   s    



 ;;S!JJdkkCH4;<dkk3s84DKJJT" JJr   )r%   r&   N)TF)	__name__
__module____qualname____firstlineno____doc__r)   r8   __static_attributes____classdictcell__r   s   @r   r   r   (   s!     8   r   r   c                   b   a  ] tR t^@t o RtR
V 3R lR lltR
V 3R lR lltV 3R lR ltR	tV t	R# )r   zTOperation progress reporting.

This closely resembles OpTextProgress in libapt-pkg.
Nc                F   < V ^8  d   QhRS[ P                  R,          RR/# r   r   )r   r   s   "r   r   OpProgress.__annotate__F   s$       4  r   c                |    \         P                  W4       \        P                  P                  V 4       R V n        R# ) N)r   r)   r   r   old_opr'   s   &&r   r)   OpProgress.__init__F   s)    d,  &r   c                2   < V ^8  d   QhRS[ R,          RR/# )r   percentNr
   )float)r   r   s   "r   r   rE   K   s      edl d r   c                D   \         P                  P                  W4       V P                  '       d.   V P                  '       d   V P                  V P                  4       V P                  RV P                  V P                  3,          RR4       V P                  V n        R# )z1Called periodically to update the user interface.z%s... %i%%FTN)r   r   updatemajor_changerH   r8   oprK   )r(   rK   s   &&r   rN   OpProgress.updateK   se    t-KK$Ndggt||%<<eTJggr   c                   < V ^8  d   QhRR/# r   r
   N )r   r   s   "r   r   rE   S   s      d r   c                    \         P                  P                  V 4       V P                  '       d0   V P	                  \        R4      RV P                  3,          RR4       RV n        R# )z,Called once an operation has been completed.z%c%s... Doner1   TrG   N)r   r   donerH   r8   r   r(   s   &r   rV   OpProgress.doneS   sG    T";;;KK.)T4;;,??tLr   )rH   r:   )
r;   r<   r=   r>   r?   r)   rN   rV   r@   rA   rB   s   @r   r   r   @   s(     
 
  r   c                      a  ] tR t^[t o RtRV 3R lR lltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )r   z'AcquireProgress for the text interface.Nc                F   < V ^8  d   QhRS[ P                  R,          RR/# r   r   )r   r   s   "r   r   AcquireProgress.__annotate__^   s$       4  r   c                    \         P                  W4       \        P                  P                  V 4       R V n        ^PV n        ^V n        R # r:   )r   r)   r   r   _signalr&   _idr'   s   &&r   r)   AcquireProgress.__init__^   s@    d,%%d+  	 r   c                   < V ^8  d   QhRR/# rS   rT   )r   r   s   "r   r   r[   g   s     
 
t 
r   c                    \         P                  P                  V 4       \        P                  ! \        P                  V P
                  4      V n        V P                  4        ^V n        R# )zStart an Acquire progress.

In this case, the function sets up a signal handler for SIGWINCH, i.e.
window resize signals. And it also sets id to 1.
N)r   r   startsignalSIGWINCH_winchr]   r^   rW   s   &r   rb   AcquireProgress.startg   sB     	""4(}}V__dkkBr   c                $   < V ^8  d   QhRS[ RR/# )r   dummyr
   N)object)r   r   s   "r   r   r[   s   s     	" 	"V 	" 	"r   c                \   \        V P                  R4      '       d   \        P                  ! V P                  P	                  4       4      '       dZ   ^ RIp^ RIp^ RIpVP                  V P                  VP                  R4      pVP                  RV4      w  r pV^,
          V n        R# R# R# )z)Signal handler for window resize signals.filenoNhhhhs           )hasattrr%   osisattyrk   fcntlstructtermiosioctl
TIOCGWINSZunpackr&   )r(   rh   rp   rq   rr   bufcols   &*     r   re   AcquireProgress._winchs   s~    4::x((RYYtzz7H7H7J-K-K++djj'*<*<hGC'-}}VS'A$Eu'DK .L(r   c                8   < V ^8  d   QhRS[ P                  RR/# r   itemr
   Nr   AcquireItemDesc)r   r   s   "r   r   r[   ~   s!      G33  r   c                F   \         P                  P                  W4       \        R4      VP                  ,           pVP
                  P                  '       d9   VR\        P                  ! VP
                  P                  4      ,          ,          pV P                  V4       R# )z@Called when an item is update (e.g. not modified on the server).zHit  [%sB]N)
r   r   ims_hitr   descriptionownerfilesizer   size_to_strr8   r(   r{   lines   && r   r   AcquireProgress.ims_hit~   sj    $$T0y4+++::Hw224::3F3FGGGDDr   c                8   < V ^8  d   QhRS[ P                  RR/# rz   r|   )r   r   s   "r   r   r[      s!     8 800 8T 8r   c                   \         P                  P                  W4       VP                  P                  VP                  P
                  8X  d.   V P                  \        R4      VP                  ,           4       R# V P                  \        R4      VP                  ,           4       V P                  RVP                  P                  ,          4       R# )zCalled when an item is failed.zIgn zErr z  %sN)
r   r   failr   status	STAT_DONEr8   r   r   
error_text)r(   r{   s   &&r   r   AcquireProgress.fail   s    !!$-::

 4 44KK&	D$4$445KK&	D$4$445KK!6!667r   c                8   < V ^8  d   QhRS[ P                  RR/# rz   r|   )r   r   s   "r   r   r[      s!      '11 d r   c                   \         P                  P                  W4       VP                  P                  '       d   R# V P
                  VP                  n        V ;P
                  ^,          un        \        R4      VP                  P                   RVP                   2,           pVP                  P                  '       d9   VR\        P                  ! VP                  P                  4      ,          ,          pV P                  V4       R# )z/Called when some of the item's data is fetched.NzGet:r2   r   )r   r   fetchr   completer^   idr   r   r   r   r   r8   r   s   && r   r   AcquireProgress.fetch   s    ""4.::

Aydjjmm_Ad.>.>-?@@::Hw224::3F3FGGGDDr   c                :   < V ^8  d   QhRS[ P                  RS[/# )r   r   r
   )r   Acquirer/   )r   r   s   "r   r   r[      s#     F F7?? Ft Fr   c                   \         P                  P                  W4       \        V P                  R4      '       d7   \
        P                  ! V P                  P                  4       4      '       g   R# V P                  V P                  ,           R,          \        V P                  V P                  ,           4      ,          pRpRV,          pRpV P                  '       d   \        \        V P                  V P                  ,
          4      V P                  ,          4      pRP                  \         P"                  ! V P                  4      \         P$                  ! V4      4      pVP&                   EFp  pRpVP(                  '       go   VP*                  '       d[   RVP*                  ,          p\-        V4      \-        V4      ,           \-        V4      ,           V P.                  8  d    EMWH,          pRpK  RpVP(                  P0                  P2                  '       dF   VR	VP(                  P0                  P2                  VP(                  P4                  3,          ,          pM$VR
VP(                  P6                  ,          ,          pVP(                  P0                  P8                  '       d/   VRVP(                  P0                  P8                  ,          ,          pVR\         P"                  ! VP:                  4      ,          ,          pVP<                  '       dy   VP(                  P0                  P>                  '       gS   VR\         P"                  ! VP<                  4      VP:                  R,          VP<                  ,          3,          ,          pVR,          p\-        V4      \-        V4      ,           \-        V4      ,           V P.                  8  d    MWH,          pEKs  	  V'       g   V\A        R4      ,          pV P                  '       dA   W@P.                  \-        V4      ,
          \-        V4      ,
          R,          V,           ,          pV PC                  VR4       R# )zPeriodically invoked while the Acquire process is underway.

Return False if the user asked to cancel the whole Acquire process.rk   Tg      Y@Fz%i%%rG   z	 {}B/s {}z [%s]z [%i %sz [%sz %sz %sBz	/%sB %i%%]z
 [Working]r2   )"r   r   pulserm   r%   rn   ro   rk   current_bytescurrent_itemsrL   total_bytestotal_itemscurrent_cpsintr   r   r   time_to_strworkerscurrent_itemr   r5   r&   r   r   	shortdescr   active_subprocesscurrent_size
total_sizer   r   r8   )	r(   r   rK   showntvalendetaworkervals	   &&       r   r   AcquireProgress.pulse   s6    	""4/4::x((4::;L;L;N1O1O &&););;uDt///I
 
 eD,,t/A/AABTEUEUUVC$$##D$4$45##C(C
 mmFC&&&===!FMM1C4y3s8+c#h6$++EKD EE""((+++y''--00''11$  
 v 3 3 ? ???""((:::uv2288JJJJ6G//0C0CDDDC    )<)<)B)B)K)K)K{''(9(9:''%/&2C2CC&  
 3JC4y3s8#c#h.$++=K $N AlO#D[[3s8+c$i73>DDDD% r   c                ,   < V ^8  d   QhRS[ RS[ RS[/# )r   mediumdriver
   r.   )r   r   s   "r   r   r[      s"     ) )3 )s )t )r   c                    \         P                  P                  WV4       V P                  \	        R4      W3,          4       \        4       R9  # )z7Prompt the user to change the inserted removable media.zUMedia change: please insert the disc labeled
 '%s'
in the drive '%s' and press enter
)cC)r   r   media_changer8   r   input)r(   r   r   s   &&&r   r   AcquireProgress.media_change   sL    ))$>6
 o	
 wj((r   c                   < V ^8  d   QhRR/# rS   rT   )r   r   s   "r   r   r[      s     5 5d 5r   c                   \         P                  P                  V 4       V P                  \	        R4      \
        P                  ! V P                  4      \
        P                  ! V P                  4      \
        P                  ! V P                  4      3,          P                  R4      4       ^ RIpVP                  ! VP                  V P                  4       R# )z/Invoked when the Acquire process stops running.zFetched %sB in %s (%sB/s)
r3   N)r   r   stopr8   r   r   r   fetched_bytesr   elapsed_timer   rstriprc   rd   r]   )r(   rc   s   & r   r   AcquireProgress.stop   s    !!$'/0''(:(:;''(9(9:''(8(89 fTl		
 	foot||4r   )r^   r]   r&   r:   )r;   r<   r=   r>   r?   r)   rb   re   r   r   r   r   r   r   r@   rA   rB   s   @r   r   r   [   se     1 
 
	" 	" 8 8 F FP) )5 5r   c                   Z   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )r   i  zText CD-ROM progress.c                .   < V ^8  d   QhRS[ R,          /# rS   r   )r   r   s   "r   r   CdromProgress.__annotate__
  s      d
 r   c                    \         P                  P                  V 4       V P                  \	        R4      R4        \        \        R4      4      #   \         d     R# i ; i)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)r   r   ask_cdrom_namer8   r   r   r   KeyboardInterruptrW   s   &r   r   CdromProgress.ask_cdrom_name
  sY    ))$/( 	
	uSz?"  		s   A AAc                *   < V ^8  d   QhRS[ RS[RR/# )r   textcurrentr
   N)r   r   )r   r   s   "r   r   r     s"     % %3 % % %r   c                ~    \         P                  P                  WV4       V'       d   V P                  VR4       R# R# )zSet the current progress.FN)r   r   rN   r8   )r(   r   r   s   &&&r   rN   CdromProgress.update  s.    !!$g6KKe$ r   c                    < V ^8  d   QhRS[ /# )r   r
   )r/   )r   r   s   "r   r   r     s      d r   c                    \         P                  P                  V 4       V P                  \	        R4      R4        \        \        4       R8H  4      #   \         d     R# i ; i)z"Ask the user to change the CD-ROM.z4Please insert an installation medium and press enterFrG   )r   r   change_cdromr8   r   r/   r   r   rW   s   &r   r   CdromProgress.change_cdrom  sR    ''-ALMuU	2&&  		s   A A! A!rT   N)
r;   r<   r=   r>   r?   r   rN   r   r@   rA   rB   s   @r   r   r     s&      % % r   )r   r   r   )r?   r   rn   rc   r#   typescollections.abcr   r   apt.progressr   __all__r   r   r   r   r   rT   r   r   <module>r      ss   " . 	 	  
  $  
< 0, 6i5d**L i5XD&& r   