HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/apt/progress/__pycache__/text.cpython-38.pyc
U

&��c�)�@sdZddlmZddlZddlZddlZddlZz0ddlZddlm	Z	m
Z
mZee	e
eWnek
rtYnXddl
Z
ddlmZedddgZejjd	kr�eZneZd
d�ZGdd
�d
e�ZGdd�deje�ZGdd�deje�ZGdd�deje�ZdS)z'Progress reporting for text interfaces.�)�print_functionN)�Callable�Optional�Union)�base�AcquireProgress�
CdromProgress�
OpProgress�cCs"t�|�}||krt�|d�}|S)z>Translate the message, also try apt if translation is missing.Zapt)�apt_pkg�gettext)�msg�res�r�3/usr/lib/python3/dist-packages/apt/progress/text.py�_2s
rc@s$eZdZdZd	dd�Zd
dd�ZdS)�TextProgressz.Internal Base class for text progress classes.NcCs|ptj|_d|_dS)Nr)�sys�stdout�_file�_width��selfZoutfilerrr�__init__>szTextProgress.__init__TFcCsx|j�d�|j�|�|jt|�krB|j�|jt|�d�n|rXt|jt|��|_|rj|j�d�n
|j��dS)z8Write the message on the terminal, fill remaining space.�
� �
N)r�writer�len�max�flush)rr
�newlineZmaximizerrr�_writeCszTextProgress._write)N)TF)�__name__�
__module__�__qualname__�__doc__rr"rrrrr;s
rc@s,eZdZdZd	dd�Zd
dd�Zdd�ZdS)r	z\Operation progress reporting.

    This closely resembles OpTextProgress in libapt-pkg.
    NcCs"t�||�tj�|�d|_dS)N�)rrrr	�old_oprrrrr[szOpProgress.__init__cCsLtj�||�|jr&|jr&|�|j�|�d|j|jfdd�|j|_dS)z1Called periodically to update the user interface.z%s... %i%%
FTN)rr	�updateZmajor_changer(r"�op�percent)rr+rrrr)as
zOpProgress.updatecCs8tj�|�|jr.|�td�d|jfdd�d|_dS)z,Called once an operation has been completed.z%c%s... DonerTr'N)rr	�doner(r"r�rrrrr,jszOpProgress.done)N)N)r#r$r%r&rr)r,rrrrr	Us

	c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)rz'AcquireProgress for the text interface.NcCs2t�||�tj�|�d|_d|_td�|_dS)N�P�)rrrr�_signalr�long�_idrrrrrvs
zAcquireProgress.__init__cCs4tj�|�t�tj|j�|_|��td�|_dS)z�Start 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.
        r/N)	rr�start�signal�SIGWINCH�_winchr0r1r2r-rrrr3~szAcquireProgress.startcGsht|jd�rdt�|j���rdddl}ddl}ddl}|�|j|j	d�}|�
d|�\}}}}|d|_dS)z)Signal handler for window resize signals.�filenorNs        Zhhhhr/)�hasattrr�os�isattyr7�fcntl�termios�structZioctlZ
TIOCGWINSZZunpackr)rZdummyr;r<r=Zbuf�colrrrr6�szAcquireProgress._winchcCsHtj�||�td�|j}|jjr:|dt�|jj�7}|�	|�dS)z@Called when an item is update (e.g. not modified on the server).zHit � [%sB]N)
rr�ims_hitr�description�owner�filesizer�size_to_strr"�r�item�linerrrr@�s
zAcquireProgress.ims_hitcCs^tj�||�|jj|jjkr4|�td�|j�n&|�td�|j�|�d|jj	�dS)zCalled when an item is failed.zIgn zErr z  %sN)
rr�failrB�statusZ	STAT_DONEr"rrAZ
error_text)rrFrrrrH�s
zAcquireProgress.failcCsxtj�||�|jjrdS|j|j_|jd7_td�d|jj|jf}|jj	rj|dt
�|jj	�7}|�|�dS)z/Called when some of the item's data is fetched.Nr/zGet:z%s %sr?)
rr�fetchrB�completer2�idrrArCrrDr"rErrrrJ�s
zAcquireProgress.fetchc	Cstj�||�t|jd�r.t�|j���s.dS|j|j	dt
|j|j�}d}d|}d}|j
r�tt
|j|j�|j
�}dt�|j
�t�|�f}|jD�].}d}|js�|jr�d|j}t|�t|�t|�|jkr��q�||7}d}q�d}|jjj�r|d	|jjj|jjf7}n|d
|jj7}|jjj�rJ|d|jjj7}|dt�|j�7}|j�r�|jjj�s�|d
t�|j�|jd|jf7}|d7}t|�t|�t|�|jk�r��q�q�||7}q�|�s�|td�7}|j
�r||jt|�t|�d|7}|� |d�dS)z�Periodically invoked while the Acquire process is underway.

        Return False if the user asked to cancel the whole Acquire process.r7TgY@Fz%i%%r'z	 %sB/s %sz [%s]z [%i %sz [%sz %sz %sBz	/%sB %i%%�]z
 [Working]r)!rr�pulser8rr9r:r7Z
current_bytesZ
current_items�floatZtotal_bytesZtotal_items�current_cpsr1rrD�time_to_strZworkersZcurrent_itemrIrrrBrLZ	shortdescrAZactive_subprocessZcurrent_sizeZ
total_sizerKrr")	rrBr+ZshownZtval�endZetaZworker�valrrrrN�sh����
�

� 
"zAcquireProgress.pulsecCs0tj�|||�|�td�||f�t�dkS)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)rr�media_changer"r�input)rZmediumZdriverrrrV�s

�zAcquireProgress.media_changecCs^tj�|�|�td�t�|j�t�|j	�t�|j
�f�d��ddl}|�|j
|j�dS)z/Invoked when the Acquire process stops running.zFetched %sB in %s (%sB/s)
rrN)rr�stopr"rrrDZ
fetched_bytesrQZelapsed_timerP�rstripr4r5r0)rr4rrrrXs



��zAcquireProgress.stop)N)
r#r$r%r&rr3r6r@rHrJrNrVrXrrrrrss

	
E	c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzText CD-ROM progress.cCsFtj�|�|�td�d�zttd��WStk
r@YdSXdS)z,Ask the user to provide a name for the disc.zBPlease provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'F�:N)rr�ask_cdrom_namer"r�strrW�KeyboardInterruptr-rrrr[s
�zCdromProgress.ask_cdrom_namecCs$tj�|||�|r |�|d�dS)zSet the current progress.FN)rrr)r")r�textZcurrentrrrr)#szCdromProgress.updatecCsHtj�|�|�td�d�ztt�dk�WStk
rBYdSXdS)z"Ask the user to change the CD-ROM.z1Please insert a Disc in the drive and press enterFr'N)rr�change_cdromr"r�boolrWr]r-rrrr_*s
�zCdromProgress.change_cdromN)r#r$r%r&r[r)r_rrrrrs)r&Z
__future__r�ior9r4r�types�typingrrr�ImportErrorrZapt.progressr�__all__�version_info�majorZ	raw_inputrW�intr1r�objectrr	rrrrrr�<module>s6
	#