HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/apt/progress/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/apt/progress/__pycache__/base.cpython-311.pyc
�

�xkd�1����dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZddl
Z
gd�ZGd�de��ZGd�d	e��ZGd
�de��ZGd�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�b�eZdZdZdxZxZxZxZZdxZ	xZ
Zd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�ZdS)
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.
    �rc��dS)z<Invoked when an item is successfully and completely fetched.N���self�items  �3/usr/lib/python3/dist-packages/apt/progress/base.py�donezAcquireProgress.done4�����c��dS)z*Invoked when an item could not be fetched.Nr
rs  r�failzAcquireProgress.fail8rrc��dS)z0Invoked when some of the item's data is fetched.Nr
rs  r�fetchzAcquireProgress.fetch<rrc��dS)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.
        Nr
rs  r�ims_hitzAcquireProgress.ims_hit@rrc��dS)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�drives   r�media_changezAcquireProgress.media_changeIs	���urc��dS)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�owners  r�pulsezAcquireProgress.pulseWs	���trc�v�d|_d|_d|_d|_d|_d|_d|_d|_dS)z0Invoked when the Acquire process starts running.rrN)�
current_bytes�current_cps�
current_items�elapsed_time�
fetched_bytes�
last_bytes�total_bytes�total_items�rs r�startzAcquireProgress.startdsI��!������������ �������������rc��dS)z/Invoked when the Acquire process stops running.Nr
r+s r�stopzAcquireProgress.stopqrrN)�__name__�
__module__�__qualname__�__doc__r#r$r'r(r)r%r&r*rrrrrr!r,r.r
rrrr*s���������NQ�P�M�P�K�P�-�P�*�{�12�2�M�2�L�;�K�K�K�9�9�9�?�?�?�������������>�>�>�>�>rrc�(�eZdZdZdZd�Zd�Zd�ZdS)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.
    rc��dS)z�Ask for the name of the cdrom.

        If a name has been provided, return it. Otherwise, return None to
        cancel the operation.
        Nr
r+s r�ask_cdrom_namezCdromProgress.ask_cdrom_name�rrc��dS)z�Ask for the CD-ROM to be changed.

        Return True once the cdrom has been changed or False to cancel the
        operation.
        Fr
r+s r�change_cdromzCdromProgress.change_cdrom�s	���urc��dS)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�currents   r�updatezCdromProgress.update�rrN)r/r0r1r2�total_stepsr5r7r;r
rrrrvsR���������K�����������rrc�t�eZdZdZd\ZZZZd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�ZdS)rz4Class to report the progress of installing packages.)rrg�������?�c� �tj��\|_|_tj|jd��|_tj|jd��|_tj|jtjtj	��dS)N�w�r)
�os�pipe�statusfd�writefd�fdopen�write_stream�
status_stream�fcntl�F_SETFL�
O_NONBLOCKr+s r�__init__zInstallProgress.__init__�sb��(*��	�	�%������I�d�l�C�8�8����Y�t�}�c�:�:���
��D�M�5�=�"�-�@�@�@�@�@rc��dS)z(Abstract) Start update.Nr
r+s r�start_updatezInstallProgress.start_update�rrc��dS)z+(Abstract) Called when update has finished.Nr
r+s r�
finish_updatezInstallProgress.finish_update�rrc��|S�Nr
r+s r�	__enter__zInstallProgress.__enter__�s���rc�j�|j���|j���dSrR)rG�closerH)r�type�value�	tracebacks    r�__exit__zInstallProgress.__exit__�s2������!�!�!��� � �"�"�"�"�"rc��dS)z>(Abstract) Called when a error is detected during the install.Nr
)r�pkg�errormsgs   r�errorzInstallProgress.error�rrc��dS)zA(Abstract) Called when a conffile question from dpkg is detected.Nr
)rr:�news   r�conffilezInstallProgress.conffile�rrc��dS)z.(Abstract) Called when the APT status changed.Nr
)rr[�percent�statuss    r�
status_changezInstallProgress.status_change�rrc��dS)z/(Abstract) Called when the dpkg status changed.Nr
)rr[rcs   r�dpkg_status_changez"InstallProgress.dpkg_status_change�rrc��dS)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
)rr[�stages   r�
processingzInstallProgress.processing�rrc
���|���}|dk�r-	tj|jd��n#t$rYnwxYw	tj|�|j�������n�#t$r]tjtj	tj
dddt|j�����d|����Yn[t$rO}tj�d|z��tjt jj��Yd}~nd}~wwxYw||_|���}tj|��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)�forkrB�set_inheritablerE�AttributeError�_exit�
do_installrG�fileno�spawnlp�P_WAIT�str�	Exception�sys�stderr�write�apt_pkg�PackageManager�
RESULT_FAILED�	child_pid�
wait_child�WEXITSTATUS)r�obj�pid�e�ress     r�runzInstallProgress.run�s����i�i�k�k���!�8�8�
��"�4�<��6�6�6�6��!�
�
�
���
����
?�������(9�(@�(@�(B�(B�C�C�D�D�D�D��!�
�
�
����J��	���%��D�-�4�4�6�6�7�7�����
�
�
�
�
��
?�
?�
?��
� � ��!��,�,�,����/�=�>�>�>�>�>�>�>�>�����
?��������o�o�����~�c�"�"�"s/�8�
A�A�	>B�A$E�.	E�7AE�Ec�(�tj��S)zFork.)rBrlr+s rrlzInstallProgress.forks���w�y�y�rc���	|j���}nV#t$rI}|jtjkr)|jtjkrt
|j��Yd}~dSd}~wwxYwdx}x}x}x}}|�d��r.	|�	dd��\}}}}n�#t$rYdSwxYw|�d��rG	|�	dd��\}}}}n�#t$r|�	dd��\}}}YnmwxYw|�d��rT|�	dd��\}}}|�|���|�����|���}|���}|���}|d	ks|d
kr|�
||��dS|dks|dkrWtjd
|��}|r>|�|�d��|�d����dSdS|dkr�t%|��|jks||jkre|�|t%|��|�����t%|��|_|���|_dSdS|dkr|�||��dSdS)zUpdate the interface.Nr>�pm�:�rc�ri�pmerrorr]zconffile-prompt�
pmconffilez\s*'(.*)'\s*'(.*)'.*��pmstatus)rH�readline�IOError�errno�EAGAIN�EWOULDBLOCK�print�strerror�
startswith�split�
ValueErrorri�stripr]�re�matchr`�group�floatrbrcrdrf)	r�line�err�pkgnamerc�
status_strrb�baser�s	         r�update_interfacez InstallProgress.update_interfaces,��	��%�.�.�0�0�D�D���	�	�	��y�E�L�(�(�S�Y�%�:K�-K�-K��c�l�#�#�#��F�F�F�F�F�����		����:<�;��;�&�;�:�;��$��?�?�4� � �
	A�
�9=���C��9K�9K�6���'�:�:���
�
�
����
�����_�_�X�
&�
&�	A�
=�6:�j�j��a�6H�6H�3��w��
�
���
=�
=�
=�*.�*�*�S�!�*<�*<�'��w����
=����
�_�_�\�
*�
*�	A�,0�J�J�s�A�,>�,>�)�V�Z���O�O�G�M�M�O�O�Z�-=�-=�-?�-?�@�@�@��-�-�/�/���%�%�'�'�
��������Y���&�G�"3�"3��J�J�w�
�+�+�+�+�+�
�(�
(�
(�F�l�,B�,B��H�5�z�B�B�E��
>��
�
�e�k�k�!�n�n�e�k�k�!�n�n�=�=�=�=�=�
>�
>�
�z�
!�
!��W�~�~���-�-��t�{�1J�1J��"�"�7�E�'�N�N�J�<L�<L�<N�<N�O�O�O�$�W�~�~���(�.�.�0�0�����2K�1J��X�
�
��#�#�G�V�4�4�4�4�4��
s8��
A/�>A*�*A/�B.�.
B<�;B<�C1�1$D�Dc���d\}}		tj|jggg|j��n7#tj$r%}|j\}}|t
jkr�Yd}~nd}~wwxYw|���	tj	|j
tj��\}}||j
krnInG#t$r:}|jt
j
krYd}~n$|jt
jkr�Yd}~nd}~wwxYw��|S)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)�selectrH�select_timeoutr]�argsr��EINTRr�rB�waitpidr|�WNOHANG�OSError�ECHILD)rr�r�r]�errno_�_errstrr�s       rr}zInstallProgress.wait_child7s6���
��c�	�
��
�t�1�2�B��D�<O�P�P�P�P���<�
�
�
�$)�J�!����U�[�(�(��)�(�(�(�(�����
����

�!�!�#�#�#�
��Z����
�C�C�
��c��$�.�(�(��)���
�
�
��9���,�,��E�E�E�E��9���+�+��,�+�+�+�+�����
����	�&�
s2�"+�A�A�A�72B+�+
C/�5C*�C*�*C/N)r/r0r1r2r|rbr�rcrLrNrPrSrYr]r`rdrfrir�rlr�r}r
rrrr�s������>�>�1@�.�I�w���A�A�A�'�'�'�:�:�:����#�#�#�
M�M�M�P�P�P�=�=�=�>�>�>����/#�/#�/#�b���
.5�.5�.5�`����rrc�.�eZdZdZd\ZZZZdd�Zd�Z	dS)r	zbMonitor objects for operations.

    Display the progress of operations such as opening the cache.)Fr>rr>Nc��|�	||_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)rb)rrbs  rr;zOpProgress.update]s����"�D�L�L�L��rc��dS)z,Called once an operation has been completed.Nr
r+s rrzOpProgress.donegrrrR)
r/r0r1r2�major_change�oprb�subopr;rr
rrr	r	VsS������E�E�(:�$�L�"�g�u�#�#�#�#�;�;�;�;�;rr	)r2�
__future__rr�rI�iorBr�r�rv�typingrrry�__all__�objectrrrr	r
rr�<module>r�sS��(��
&�%�%�%�%�%���������	�	�	�	�	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�"�"�"�"�"�"�"�"�����
O�
O�
O��I>�I>�I>�I>�I>�f�I>�I>�I>�X!�!�!�!�!�F�!�!�!�Hy�y�y�y�y�f�y�y�y�x;�;�;�;�;��;�;�;�;�;r