CasperSecurity

Current Path : /lib/python3/dist-packages/apt/progress/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/apt/progress/__pycache__/text.cpython-310.pyc

o

4��f�(�@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.�apt)�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��self�outfilerrr�__init__0s
zTextProgress.__init__TFcCsz|j�d�|j�|�|jt|�kr!|j�|jt|�d�n|r,t|jt|��|_|r6|j�d�dS|j��dS)z8Write the message on the terminal, fill remaining space.�
� �
N)r�writer�len�max�flush)rr
�newline�maximizerrr�_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	�update�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�rrrrr0\s
zOpProgress.doner%)r&r'r(r)rr,r0rrrrr	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.
        r3N)rr�start�signal�SIGWINCH�_winchr4r5r1rrrr6ps
zAcquireProgress.startcGspt|jd�r4t�|j���r6ddl}ddl}ddl}|�|j|j	d�}|�
d|�\}}}}|d|_dSdSdS)z)Signal handler for window resize signals.�filenorNs        �hhhhr3)�hasattrr�os�isattyr:�fcntl�termios�struct�ioctl�
TIOCGWINSZ�unpackr)r�dummyr?r@rA�buf�colrrrr9}s�zAcquireProgress._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�linerrrrI�s
zAcquireProgress.ims_hitcCs`tj�||�|jj|jjkr|�td�|j�dS|�td�|j�|�d|jj	�dS)zCalled when an item is failed.zIgn zErr z  %sN)
rr�failrK�status�	STAT_DONEr$rrJ�
error_text)rrOrrrrQ�s
zAcquireProgress.failcCsxtj�||�|jjr
dS|j|j_|jd7_td�d|jj|jf}|jj	r5|dt
�|jj	�7}|�|�dS)z/Called when some of the item's data is fetched.Nr3zGet:z%s %srH)
rr�fetchrK�completer5�idrrJrLrrMr$rNrrrrU�s
zAcquireProgress.fetchc	Cstj�||�t|jd�rt�|j���sdS|j|j	dt
|j|j�}d}d|}d}|j
rLtt
|j|j�|j
�}dt�|j
�t�|�f}|jD]�}d}|jsv|jrud|j}t|�t|�t|�|jkronp||7}d}qOd}|jjjr�|d	|jjj|jjf7}n|d
|jj7}|jjjr�|d|jjj7}|dt�|j�7}|jr�|jjjs�|d
t�|j�|jd|jf7}|d7}t|�t|�t|�|jkr�n||7}qO|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.r:TgY@Fz%i%%r*z	 %sB/s %sz [%s]z [%i %sz [%sz %sz %sBz	/%sB %i%%�]z
 [Working]r)!rr�pulser<rr=r>r:�
current_bytes�
current_items�float�total_bytes�total_items�current_cps�intrrM�time_to_str�workers�current_itemrRrrrKrW�	shortdescrJ�active_subprocess�current_size�
total_sizerVrr$)	rrKr/�shown�tval�end�eta�worker�valrrrrY�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)r�medium�driverrrrp�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$rrrM�
fetched_bytesra�elapsed_timer_�rstripr7r8r4)rr7rrrrt�s



��zAcquireProgress.stopr%)
r&r'r(r)rr6r9rIrQrUrYrprtrrrrres

	
E	rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzText CD-ROM progress.cCs@tj�|�|�td�d�zttd��WStyYdSw)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�strrq�KeyboardInterruptr1rrrry
s
��zCdromProgress.ask_cdrom_namecCs(tj�|||�|r|�|d�dSdS)zSet the current progress.FN)rrr,r$)r�text�currentrrrr,s�zCdromProgress.updatecCsBtj�|�|�td�d�ztt�dk�WSty YdSw)z"Ask the user to change the CD-ROM.z4Please insert an installation medium and press enterFr*)rr�change_cdromr$r�boolrqr{r1rrrr~s
��zCdromProgress.change_cdromN)r&r'r(r)ryr,r~rrrrrs
r)r)�
__future__r�ior=r7r�types�typingrrrr�apt.progressr�__all__r�objectrr	rrrrrr�<module>s"	#
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY