HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/apt/progress/__pycache__/text.cpython-39.pyc
a

�?i�(�@s�dZddlmZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlZddl
mZgd�Zdd�ZGd	d
�d
e�ZGdd�deje�ZGd
d�deje�ZGdd�deje�ZdS)z'Progress reporting for text interfaces.�)�print_functionN)�Callable�Optional�Union)�base)�AcquireProgress�
CdromProgress�
OpProgresscCs"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�_$s
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__0s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�_write5s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_oprrrrrMs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(Ss
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+\szOpProgress.done)N)N)r"r#r$r%rr(r+rrrrr	Gs

	r	c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)rz'AcquireProgress for the text interface.NcCs.t�||�tj�|�d|_d|_d|_dS)N�P�)rrrr�_signalr�_idrrrrrhs
zAcquireProgress.__init__cCs0tj�|�t�tj|j�|_|��d|_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�_winchr/r0r,rrrr1ps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�isattyr5�fcntl�termios�structZioctlZ
TIOCGWINSZZunpackr)rZdummyr9r:r;Zbuf�colrrrr4}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�failr@�statusZ	STAT_DONEr!rr?Z
error_text)rrDrrrrF�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�fetchr@�completer0�idrr?rAr
rBr!rCrrrrH�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.r5TgY@Fz%i%%r&z	 %sB/s %sz [%s]z [%i %sz [%sz %sz %sBz	/%sB %i%%�]z
 [Working]r)!rr�pulser6rr7r8r5Z
current_bytesZ
current_items�floatZtotal_bytesZtotal_items�current_cps�intr
rB�time_to_strZworkersZcurrent_itemrGrrr@rJZ	shortdescr?Zactive_subprocessZcurrent_sizeZ
total_sizerIrr!)	rr@r*ZshownZtval�endZetaZworker�valrrrrL�sh����
�

� 
"zAcquireProgress.pulsecCs0tj�|||�|�td�||f�t�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
)�c�C)rr�media_changer!r�input)rZmediumZdriverrrrU�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!rr
rBZ
fetched_bytesrPZelapsed_timerN�rstripr2r3r/)rr2rrrrW�s



��zAcquireProgress.stop)N)
r"r#r$r%rr1r4r>rFrHrLrUrWrrrrres

	
E	rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzText CD-ROM progress.cCsDtj�|�|�td�d�zttd��WSty>YdS0dS)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)rr�ask_cdrom_namer!r�strrV�KeyboardInterruptr,rrrrZ
s
�zCdromProgress.ask_cdrom_namecCs$tj�|||�|r |�|d�dS)zSet the current progress.FN)rrr(r!)r�textZcurrentrrrr(szCdromProgress.updatecCsFtj�|�|�td�d�ztt�dk�WSty@YdS0dS)z"Ask the user to change the CD-ROM.z4Please insert an installation medium and press enterFr&N)rr�change_cdromr!r�boolrVr\r,rrrr^s
�zCdromProgress.change_cdromN)r"r#r$r%rZr(r^rrrrrsr)r%Z
__future__r�ior7r2r�types�typingrrrr
Zapt.progressr�__all__r�objectrr	rrrrrr�<module>s 	#