%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/apt/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/apt/__pycache__/cache.cpython-312.pyc

�

\�e����ddlmZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZddl
Z
ddlZddlmZmZddlmZmZmZGd�de�ZGd	�d
e�ZGd�de�ZGd
�de�ZGd�de�ZGd�d�ZGd�d�ZGd�d�Z Gd�d�Z!Gd�de!�Z"Gd�de!�Z#Gd�d�Z$Gd�d �Z%d%d!�Z&d%d"�Z'd&d#�Z(e)d$k(re(�yy)'�)�annotationsN)�Callable�Iterator�KeysView)�Any�cast)�Package�Version)�AcquireProgress�InstallProgress�
OpProgressc��eZdZdZy)�FetchCancelledExceptionzAException that is thrown when the user cancels a fetch operation.N��__name__�
__module__�__qualname__�__doc__���+/usr/lib/python3/dist-packages/apt/cache.pyrr&s��Krrc��eZdZdZy)�FetchFailedExceptionz-Exception that is thrown when fetching fails.Nrrrrrr*s��7rrc��eZdZdZy)�UntrustedExceptionz>Exception that is thrown when fetching fails for trust reasonsNrrrrrr.���Hrrc��eZdZdZy)�LockFailedExceptionz,Exception that is thrown when locking fails.Nrrrrrr2s��6rrc��eZdZdZy)�CacheClosedExceptionz>Exception that is thrown when the cache is used after close().Nrrrrr r 6rrr c�(�eZdZdZdd�Zdd�Zdd�Zy)	�_WrappedLockz`Wraps an apt_pkg.FileLock to raise LockFailedException.

    Initialized using a directory path.c��||_tjtjj|d��|_y)N�lock)�_path�apt_pkg�FileLock�os�path�join�_lock)�selfr)s  r�__init__z_WrappedLock.__init__?s*����
��%�%�b�g�g�l�l�4��&@�A��
rc��	|jj�S#tj$r }t	d|j
�d|����d}~wwxYw)NzFailed to lock directory z: )r+�	__enter__r&�Errorrr%)r,�es  rr/z_WrappedLock.__enter__CsG��	��:�:�'�'�)�)���}�}�	�%�7;�z�z�1�E��
��	�s��A�A
�
Ac�<�|jj|||�S�N)r+�__exit__)r,�typ�value�	tracebacks    rr4z_WrappedLock.__exit__Ks���z�z�"�"�3��y�9�9rN)r)�str�return�None�r9r:)r5�objectr6r<r7r<r9r:)rrrrr-r/r4rrrr"r":s��+�B��:rr"c�n�eZdZdZ			d.							d/d�Zd0d�Zd0d�Zd1d�Zd2d�Zd3d4d�Z	d0d	�Z
d0d
�Zd5d�Zd6d�Z
d7d
�Zd3d8d�Zd9d�Zd:d�Zd;d�Zd<d�Zd<d�Zd=d�Zd>d�Zd?d�Zd@dAd�Zed=d��Zed=d��ZedBd��Z						dCd�Z	d3							dDd�Z			dE							dFd�ZdGd�Z 		dH							dId�Z!				dJ									dKd �Z"						dLd!�Z#			dE							dMd"�Z$d0d#�Z%d0d$�Z&d0d%�Z'dNd&�Z(										dOd'�Z)dPd(�Z*edQd)��Z+ed=d*��Z,ed=d+��Z-ed=d,��Z.ed=d-��Z/y)R�Cachea�Dictionary-like package cache.

    The APT cache file contains a hash table mapping names of binary
    packages to their metadata. A Cache object is the in-core
    representation of the same. It provides access to APTs idea of the
    list of available packages.

    The cache can be used like a mapping from package names to Package
    objects (although only getting items is supported).

    Keyword arguments:
    progress -- a OpProgress object,
    rootdir  -- an alternative root directory. if that is given the system
    sources.list and system lists/files are not read, only file relative
    to the given rootdir,
    memonly  -- build the cache in memory only.


    .. versionchanged:: 1.0

        The cache now supports package names with special architecture
        qualifiers such as :all and :native. It does not export them
        in :meth:`keys()`, though, to keep :meth:`keys()` a unique set.
    Nc	�\�ttjd�|_ttjd�|_ttjd�|_ttjd�|_	i|_
i|_tj�|_tj�|_d|_d|_|j'dd�|j'dd�|r tj(j+dd�|�rYt,j.j1|�}t,j.j3|dz�r'tj4tj(|dz�t,j.j7|dz�r'tj8tj(|dz�tj(j+d	|�tj(j+d
|dz�tj(j+dt,j.j;|d
dd��|j=|�tj>�tj(jAd�}tC|�|_"|jG|�y)N����cache_post_open�_inc_changes_count�cache_post_changezDir::Cache::pkgcache�z/etc/apt/apt.confz/etc/apt/apt.conf.d�Dir�Dir::State::status�/var/lib/dpkg/statuszDir::bin::dpkg�usr�bin�dpkg�Dir::Cache::Archives)$rr&r>�_cache�DepCache�	_depcache�PackageRecords�_records�
SourceList�_list�
_callbacks�_callbacks2�weakref�WeakValueDictionary�_weakref�WeakSet�
_weakversions�_changes_count�_sorted_set�connect�config�setr(r)�abspath�exists�read_config_file�isdir�read_config_dirr*�_check_and_create_required_dirs�init_system�find_dirr"�
_archive_lock�open)r,�progress�rootdir�memonly�archive_dirs     rr-zCache.__init__is���&*�'�-�-��%>���+/��0@�0@�$�+G���04��"�"�D�1
��
�*.�g�.@�.@�$�)G��
�FH���
�	
��

�'�'�)�	
�
�8?���7H��� ���-1������&�(<�=����(�*>�?���N�N���5�r�:���g�g�o�o�g�.�G��w�w�~�~�g�(;�;�<��(�(�����CV�9V�W��w�w�}�}�W�'<�<�=��'�'�����BW�8W�X��N�N���u�g�.��N�N���3�W�?U�5U�V�
�N�N��� �"�'�'�,�,�w��u�f�"M�
�

�0�0��9�
���!��n�n�-�-�.D�E��)�+�6����	�	�(�rc�8�|jj�y)zFix broken packages.N)rN�
fix_broken�r,s rrnzCache.fix_broken�s�����!�!�#rc�.�|xjdz
c_y)zIncrease the number of changes�N)rZros rrBzCache._inc_changes_count�s�����q� �rc�&�ddg}gd�}|D]=}tjj||z�r�&tj||z��?|D]B}tjj||z�r�&t	||zd�j��Dy)zf
        check if the required apt directories/files are there and if
        not create them
        rGz/etc/apt/sources.list)z
/var/lib/dpkgz	/etc/apt/z/var/cache/apt/archives/partialz/var/lib/apt/lists/partial�wN)r(r)r`�makedirsrh�close)r,rj�files�dirs�d�fs      rrdz%Cache._check_and_create_required_dirs�s���
#�#�
��
���	)�A��7�7�>�>�'�A�+�.����G�a�K�(�	)��	/�A��7�7�>�>�'�A�+�.��W�q�[�#�&�,�,�.�	/rc���||jvr1|j|D]}|dk(r|j��|��!||jvr%|j|D]\}}}||g|��i|���yy)z!internal helper to run a callbackrBN)rSrBrT�r,�name�callback�args�kwdss     r�_run_callbackszCache._run_callbacks�s����4�?�?�"� �O�O�D�1�
���3�3��+�+�-��J�	
��4�#�#�#�(,�(8�(8��(>�
.�$��$����-��-��-�
.�$rc��|�(tjjj�}|j	�||_|j
d�tj|�|_	tj|j�|_tj|j�|_
tj�|_|jj!�d|_|j%�t'tj(��dkD|_|j-�|j
d�y)zTOpen the package cache, after that it can be used like
        a dictionary
        N�cache_pre_openrqrA)�aptri�baser
ru�op_progressr�r&r>rLrMrNrOrPrQrR�read_main_listr[�
_Cache__remap�len�get_architectures�_have_multi_arch�done)r,ris  rrhz
Cache.open�s������|�|�(�(�3�3�5�H��
�
��#������,�-��m�m�H�-��� �)�)�$�+�+�6����.�.�t�{�{�;��
��'�'�)��
��
�
�!�!�#�������� #�G�$=�$=�$?� @�1� D����
�
�����-�.rc��t|jj��D]Q}	|j|}	|j|j
j|j
jf|_�St|j�D�]}|jj
jD]�}|j|jjk(s�'|jdk(s=|jjdk(s$|j|jjk(s�s|j|jjk(s��|j |jj k(s��||_
��|jj#|���y#t$rY��}wxYw#t$r|j|=Y���wxYw)z�Called after cache reopen() to relocate to new cache.

        Relocate objects like packages and versions from the old
        underlying cache to the new one.
        rN)�listrW�keys�KeyErrorrL�_pkgr|�architecture�LookupErrorrY�package�version_list�hash�_cand�size�
multi_arch�ver_str�remove)r,�key�pkg�ver�vs     r�__remapz
Cache.__remap�s^����
�
�*�*�,�-�		'�C�
��m�m�C�(��
'��;�;�s�x�x�}�}�c�h�h�6K�6K�'K�L���		'���*�*�+�
	/�C��[�[�%�%�2�2�
/���F�F�c�i�i�n�n�,����1���	�	���!�(;�q�v�v������?W�����	�	�(<�(<�<��	�	�S�Y�Y�%6�%6�6� !�C�I��
/��"�"�)�)�#�.�
	/���
��
��
�
'��M�M�#�&�
'�s"�F�>F%�	F"�!F"�%F?�>F?c�F�|`ttjd�|_y)zClose the package cacheN)rPrr&rOros rruzCache.closes��
�M��W�3�3�T�:��
rc��|S)zEnter the with statementrros rr/zCache.__enter__	s���rc�$�|j�y)zExit the with statementN)ru)r,�exc_type�	exc_valuer7s    rr4zCache.__exit__
s���
�
�rc���	t|�}|j|}|j|�std|z��|j	|�}|S#t$rtd|z��wxYw)z look like a dictionary (get key)z!The cache has no package named %r)r8rLr��_Cache__is_real_pkg�_rawpkg_to_pkg)r,r��rawpkgr�s    r�__getitem__zCache.__getitem__sy��	F��c�(�C��[�[��%�F�
�!�!�&�)��>��D�E�E��!�!�&�)���
���	F��>��D�E�E�	F�s�A�A&c�0�	||S#t$r|cYSwxYw)zaReturn *self*[*key*] or *default* if *key* not in *self*.

        .. versionadded:: 1.1
        )r�)r,r��defaults   r�getz	Cache.get!s%��
	���9����	��N�	�s���c�r�|jd��}|jj|t||��S)zgReturns the apt.Package object for an apt_pkg.Package object.

        .. versionadded:: 1.0.0
        T��pretty)�get_fullnamerW�
setdefaultr	)r,r��fullnames   rr�zCache._rawpkg_to_pkg+s5��
�&�&�d�&�3���}�}�'�'��'�$��2G�H�Hrc#�K�|j�D]9}t||j|�}|jj	||����;y�wr3)r�r	rLrWr��r,�pkgnamer�s   r�__iter__zCache.__iter__4sI�����y�y�{�	9�G��$����G� 4�5�C��-�-�*�*�7�C�8�8�	9�s�AAc��|jS)z8Check if the apt_pkg.Package provided is a real package.)�has_versions)r,r�s  r�
__is_real_pkgzCache.__is_real_pkg>s���"�"�"rc�
�||vSr3r�r,r�s  r�has_keyz
Cache.has_keyB����d�{�rc�p�	|j|jt|��S#t$rYywxYw�NF)r�rLr8r�r�s  r�__contains__zCache.__contains__Es7��	��%�%�d�k�k�#�c�(�&;�<�<���	��	�s�&)�	5�5c�4�t|j��Sr3)r�r�ros r�__len__z
Cache.__len__Ks���4�9�9�;��rc����j�-t�fd��jjD���_t	�j�S)Nc3�d�K�|]'}�j|�r|jd�����)y�w)Tr�N)r�r�)�.0�pr,s  �r�	<genexpr>zCache.keys.<locals>.<genexpr>Ps2�����&���%�%�a�(����d��+�&�s�-0)r[�sortedrL�packagesr�ros`rr�z
Cache.keysNsF������#�%�&����-�-�&� �D��
�D�$�$�%�%rc��g}|jj}|jjD]+}||�r�|j	|j|���-|S)zGet the marked changes)rN�marked_keeprLr��appendr�)r,�changesr�r�s    r�get_changeszCache.get_changesWsU�����n�n�0�0���k�k�*�*�	<�F��v�&����t�2�2�6�:�;�	<��rc�z�|j�|jj|�|j�y)z�Upgrade all packages.

        If the parameter *dist_upgrade* is True, new dependencies will be
        installed as well (and conflicting packages may be removed). The
        default value is False.
        N)�cache_pre_changerN�upgraderC)r,�dist_upgrades  rr�z
Cache.upgrade`s.��	
���������|�,���� rc��|j�td��tj|j�}tj
�}|j
||j|j�|jS)z;Get the size of the packages that are required to download.�&Cache object used after close() called)	rPr r&�PackageManagerrN�Acquire�get_archivesrR�fetch_needed)r,�pm�fetchers   r�required_downloadzCache.required_downloadks^���=�=� �&�'O�P�P�
�
#�
#�D�N�N�
3���/�/�#��
�������T�]�]�;��#�#�#rc�.�|jjS)z8Get the size of the additional required space on the fs.)rN�usr_sizeros r�required_spacezCache.required_spaceus���~�~�&�&�&rc�^�t�}|jj}ttj
tjf�}|jjD]J}||�}|s�|jr�|j|vs�*|j|jd����L|S)zAReturn the packages not downloadable packages in reqreinst state.Tr�)
r^rN�get_candidate_ver�	frozensetr&�INSTSTATE_REINSTREQ�INSTSTATE_HOLD_REINSTREQrLr��downloadable�
inst_state�addr�)r,�	reqreinstr��statesr��cands      r�req_reinstall_pkgszCache.req_reinstall_pkgszs����E�	� �N�N�<�<���
�
(�
(�'�*J�*J�K�
���;�;�'�'�	=�C�$�S�)�D��D�-�-�#�.�.�F�2J��
�
�c�.�.�d�.�;�<�	=��rc��|� tjjdd�}|jD�cgc]}|jr�|��}}|r&|s$tddj
d�|D��z��|j�}d}d}|jD]K}|j|jk(r�|jr�*|d|j�d|j�d�z
}d	}�M||jk(rt|��|rt|��|Scc}w)
NzAPT::Get::AllowUnauthenticatedFzUntrusted packages:
%s�
c3�4K�|]}|j���y�wr3)�desc_uri)r��is  rr�z%Cache._run_fetcher.<locals>.<genexpr>�s����5T�Q�a�j�j�5T�s�rDzFailed to fetch � T)r&r]�find_b�items�
is_trustedrr*�run�status�	STAT_DONE�	STAT_IDLEr��
error_text�RESULT_CANCELLEDrr)r,r��allow_unauthenticated�item�	untrusted�res�failed�err_msgs        r�_run_fetcherzCache._run_fetcher�s��!�(�$+�N�N�$9�$9�3�U�%�!�'.�m�m�K�d�4�?�?�T�K�	�K��2�$�)�D�I�I�5T�)�5T�,T�T��
�
�k�k�m�������M�M�	�D��{�{�d�n�n�,���~�~���)�$�-�-���$�/�/�9J�"�M�M�G��F�
	��'�*�*�*�)�'�2�2�
�&�w�/�/��
��3Ls�D�Dc��|j�td��|j||j|j�sy|j	||�S)zfetch the needed archivesr�F)rPr r�rRr)r,r�r�r�s    r�_fetch_archiveszCache._fetch_archives�sM���=�=� �&�'O�P�P����w��
�
�D�M�M�B��� � ��*?�@�@rc�F�|�
|�td��|�(tjjj	�}|�tj|�}|j5|j|tj|j�|�cddd�S#1swYyxYw)a�Fetch the archives for all packages marked for install/upgrade.

        You can specify either an :class:`apt.progress.base.AcquireProgress()`
        object for the parameter *progress*, or specify an already
        existing :class:`apt_pkg.Acquire` object for the parameter *fetcher*.

        The return value of the function is undefined. If an error occurred,
        an exception of type :class:`FetchFailedException` or
        :class:`FetchCancelledException` is raised.

        The keyword-only parameter *allow_unauthenticated* specifies whether
        to allow unauthenticated downloads. If not specified, it defaults to
        the configuration option `APT::Get::AllowUnauthenticated`.

        .. versionadded:: 0.8.0
        Nz'Takes a progress or a an Acquire object)�
ValueErrorr�ri�textrr&r�rgrr�rN)r,rir�r�s    r�fetch_archiveszCache.fetch_archives�s���,��G�$7��F�G�G����|�|�(�(�8�8�:�H��?��o�o�h�/�G�
�
�
�	��'�'���/�/����?�AV��	�	�	�s�0B�B c��	|j|}t|jxr
|j�S#t$rYywxYw)z0Return whether the package is a virtual package.F)rL�bool�has_providesr�r�r�s   r�is_virtual_packagezCache.is_virtual_package�sK��	C��+�+�g�&�C���(�(�A��1A�1A�-A�B�B���	��	�s�5�	A�Ac�|�t�}|jj}	|j|}|jr
|st|�S|jD]@\}}}	|	j}
|r|	||
�k(s�!|j|j|
���Bt|�S#t$rt|�cYSwxYw)a)Return a list of all packages providing a package.

        Return a list of packages which provide the virtual package of the
        specified name.

        If 'candidate_only' is False, return all packages with at
        least one version providing the virtual package. Otherwise,
        return only those packages where the candidate version
        provides the virtual package.

        If 'include_nonvirtual' is True then it will search for all
        packages providing pkgname, even if pkgname is not itself
        a virtual pkg.
        )r^rNr�rLr�r�r��
provides_list�
parent_pkgr�r�)r,r��candidate_only�include_nonvirtual�	providersr��vp�provides�providesver�versionr�s           r�get_providing_packageszCache.get_providing_packages�s���*#&�%�	� �N�N�<�<��	#����W�%�B����'9��I��&�/1�.>�.>�	;�*�H�k�7��'�'�F�!�g�1B�6�1J�&J��
�
�d�1�1�&�9�:�	;��I�����	#��	�?�"�	#�s�'B$�$B;�:B;c��ttjjd��5|r�tjj	d�}tjj	d�}tjj	d�}tjjdtjj|��tjjdd�tjjdd�tj�}|j�n|j}	|�(tjjj�}	|j j#|||�}	|	s|r
t'��|	|r`tjjd�tjjd�tjjd�cddd�S#t$$r}
t'|
��d}
~
wwxYw#|ratjjd�tjjd�tjjd�wwxYw#1swYyxYw)aRun the equivalent of apt-get update.

        You probably want to call open() afterwards, in order to utilise the
        new cache. Otherwise, the old cache will be used which can lead to
        strange bugs.

        The first parameter *fetch_progress* may be set to an instance of
        apt.progress.FetchProgress, the default is apt.progress.FetchProgress()
        .
        sources_list -- Update a alternative sources.list than the default.
        Note that the sources.list.d directory is ignored in this case
        zDir::State::ListszDir::Etc::sourcelistzDir::Etc::sourcepartszAPT::List-Cleanup�xxx�0N)r"r&r]rf�findr^r(r)r_rQr�rRr�rir�rrL�update�SystemErrorr)r,�fetch_progress�pulse_interval�raise_on_error�sources_list�old_sources_list�old_sources_list_d�old_cleanup�slistr�r1s           rrzCache.updates���&�'�.�.�1�1�2E�F�
G�	I��#*�>�>�#6�#6�7M�#N� �%,�^�^�%8�%8�9P�%Q�"�%�n�n�1�1�2E�F�����"�"�*�B�G�G�O�O�L�,I�����"�"�#:�E�B����"�"�#6��<��*�*�,���$�$�&��
�
��
I�!�)�%(�\�\�%6�%6�%F�%F�%H�N�2��+�+�,�,�^�U�N�S�C��~�.�0�0����N�N�&�&�'=�?O�P��N�N�&�&�'>�@R�S��N�N�&�&�':�K�H�=	I�	I��(#�2�.�q�1�1��2�� ��N�N�&�&�'=�?O�P��N�N�&�&�'>�@R�S��N�N�&�&�':�K�H� ��7	I�	I�sJ�DI?�8*H�#G;�H�A"I?�;	H�H�H�H�A%I<�<I?�?Jc��	|j�tj�}|rtj
�	|j
|�}|rtj�		|j�|S#t$r|j�Y��wxYw#|rtj�wwxYw#t$r|j�Y|SwxYw)aY
        The first parameter *pm* refers to an object returned by
        apt_pkg.PackageManager().

        The second parameter *install_progress* refers to an InstallProgress()
        object of the module apt.progress.

        This releases a system lock in newer versions, if there is any,
        and reestablishes it afterwards.
        )
�startUpdate�AttributeError�start_updater&�pkgsystem_is_locked�pkgsystem_unlock_innerr��pkgsystem_lock_inner�finishUpdate�
finish_update)r,r��install_progress�
did_unlockr�s     r�install_archiveszCache.install_archives?s���	,��(�(�*��0�0�2�
���*�*�,�	/�"�&�&�r�*�C���,�,�.�	-��)�)�+��
��#�	,��)�)�+�	,����,�,�.���
�	-��*�*�,��
�	-�s.�A8�B�&B3�8B�B�B0�3C�Cc���|�(tjjj�}|�(tjjj	�}|�J�tj�5tj|j�}tj|�}|j5	|j|||�}|j||�}||jk(rnI||jk(rtd��||j k(rntd|z��|j#��~	ddd�ddd�jk(S#1swY� xYw#1swY�$xYw)a!Apply the marked changes to the cache.

        The first parameter, *fetch_progress*, refers to a FetchProgress()
        object as found in apt.progress, the default being
        apt.progress.FetchProgress().

        The second parameter, *install_progress*, is a
        apt.progress.InstallProgress() object.

        The keyword-only parameter *allow_unauthenticated* specifies whether
        to allow unauthenticated downloads. If not specified, it defaults to
        the configuration option `APT::Get::AllowUnauthenticated`.
        NzinstallArchives() failedz<internal-error: unknown result code from InstallArchives: %s)r�rir�rrr&�
SystemLockr�rNr�rgrr/�RESULT_COMPLETED�
RESULT_FAILEDr�RESULT_INCOMPLETE�shutdown)r,rr-r�r�r�r�s       r�commitzCache.commitbs]��4�!� �\�\�.�.�>�>�@�N��#�"�|�|�0�0�@�@�B���+�+�+�
�
�
�
!�	'��'�'����7�B��o�o�n�5�G��#�#�
'���.�.�w��<Q�R�C��/�/��4D�E�C��b�1�1�1���� 0� 0�0�)�*D�E�E��� 4� 4�4��)�<�>A�B���
�$�$�&�%��
'�	'�.�b�)�)�)�)�)
'�
'��	'�	'�s&�-AE�.BE�/E�E	�E�E#c�8�|jj�y)zUnmark all changesN)rN�initros r�clearzCache.clear�s�������rc�&�|jd�y)z>called internally if the cache has changed, emit a signal thenrCN�r�ros rrCzCache.cache_post_change�s�����/�0rc�&�|jd�y)zMcalled internally if the cache is about to change, emit
        a signal thenr�Nr;ros rr�zCache.cache_pre_change�s��	
���.�/rc��|dk7rtjdtd�||jvrg|j|<|j|j	|�y)z�Connect to a signal.

        .. deprecated:: 1.0

            Please use connect2() instead, as this function is very
            likely to cause a memory leak.
        rBzAconnect() likely causes a reference cycle, use connect2() instead�N)�warnings�warn�RuntimeWarningrSr�)r,r|r}s   rr\z
Cache.connect�sU���+�+��M�M�V���
�
�t���&�$&�D�O�O�D�!������$�$�X�.rc��||jvrg|j|<|j|j|||f�y)a;Connect to a signal.

        The callback will be passed the cache as an argument, and
        any arguments passed to this function. Make sure that, if you
        pass a method of a class as your callback, your class does not
        contain a reference to the cache.

        Cyclic references to the cache can cause issues if the Cache object
        is replaced by a new one, because the cache keeps a lot of objects and
        tens of open file descriptors.

        currently only used for cache_{post,pre}_{changed,open}.

        .. versionadded:: 1.0
        N)rTr�r{s     r�connect2zCache.connect2�sB��$�t�'�'�'�%'�D���T�"������%�%�x��t�&<�=rc�@�tj|j�S)a�Return an `ActionGroup` object for the current cache.

        Action groups can be used to speedup actions. The action group is
        active as soon as it is created, and disabled when the object is
        deleted or when release() is called.

        You can use the action group as a context manager, this is the
        recommended way::

            with cache.actiongroup():
                for package in my_selected_packages:
                    package.mark_install()

        This way, the action group is automatically released as soon as the
        with statement block is left. It also has the benefit of making it
        clear which parts of the code run with a action group and which
        don't.
        )r&�ActionGrouprNros r�actiongroupzCache.actiongroup�s��&�"�"�4�>�>�2�2rc��tjjtjjd��}tjtjj|d��D]}tj|d�s�yy)z�Return True if the dpkg was interrupted

        All dpkg operations will fail until this is fixed, the action to
        fix the system if dpkg got interrupted is to run
        'dpkg --configure -a' as root.
        rF�updatesz[0-9]*TF)	r(r)�dirnamer&r]�	find_file�listdirr*�fnmatch)r,�dpkg_status_dirrys   r�dpkg_journal_dirtyzCache.dpkg_journal_dirty�sh���'�'�/�/��N�N�$�$�%9�:�
�����B�G�G�L�L��)�D�E�	�A����q�(�+��	�rc�.�|jjS)z7Return the number of packages with broken dependencies.)rN�broken_countros rrPzCache.broken_count�s���~�~�*�*�*rc�.�|jjS)z2Return the number of packages marked for deletion.)rN�	del_countros r�delete_countzCache.delete_count�s���~�~�'�'�'rc�.�|jjS)z6Return the number of packages marked for installation.)rN�
inst_countros r�
install_countzCache.install_count����~�~�(�(�(rc�.�|jjS)z-Return the number of packages marked as keep.)rN�
keep_countros rrYzCache.keep_countrWr)NNF)ri�OpProgress | Nonerj�
str | Nonerkrr9r:r;)rjr8r9r:)r|r8r9r:r3)rirZr9r:)r9r>)r�r<r�r<r7r<r9r:)r�r<r9r	)r�r<r�r<r9r)r��apt_pkg.Packager9r	�r9zIterator[Package])r�r\r9r�r�r<r9r�r9�int)r9z	list[str])r9�
list[Package])F)r�rr9r:)r9zset[str])r��apt_pkg.Acquirer��bool | Noner9r`)r�rbr��apt_pkg.PackageManagerr�rcr9r`)NNN)ri�AcquireProgress | Noner�zapt_pkg.Acquire | Noner�rcr9r`)r�r8r9r)TF)r�r8rrrrr9ra)NrTN)
rrerr`rrrr[r9r`)r�rdr-rr9r`)rrer-zInstallProgress | Noner�rcr9r)r|r8r}zCallable[..., None] | strr9r:)
r|r8r}zCallable[..., Any]r~r<rr<r9r:)r9zapt_pkg.ActionGroup)r9r)0rrrrr-rnrBrdr�rhr�rur/r4r�r�r�r�r�r�r�r�r�r�r��propertyr�r�r�rrrr
rrr/r6r9rCr�r\rCrFrNrPrSrVrYrrrr>r>Os����6'+�"��	4�#�4��4��	4�

�4�l$�!�/�..�/�0/�@;���� �I�9�#��� �&��	!��$��$��'��'�����!�&�!�?J�!�	�!�N.2�	A� �A�
#�A� +�	A�


�A�(,0�*.�-1�	 �(� �(� � +�	 �


� �DC� $�#(�	"��"��"�!�	"�

�"�L26��#�#'�1I�.�1I��1I��	1I�
!�1I�

�
1I�f!�(�!�<K�!�	�!�J26�37�-1�	8*�.�8*�1�8*� +�	8*�

�8*�t�1�0�
/�$>��>�#5�>�>D�>�NT�>�	
�>�,3�*�
��
��+��+��(��(��)��)��)��)rr>c�H�eZdZdZd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
y	)
�ProblemResolverzuResolve problems due to dependencies and conflicts.

    The first argument 'cache' is an instance of apt.Cache.
    c�Z�tj|j�|_||_yr3)r&rhrN�	_resolverrL�r,�caches  rr-zProblemResolver.__init__s�� �0�0����A�����rc�N�|jj|j�y)z'Reset the package to the default state.N)rjr9r��r,r�s  rr9zProblemResolver.clears�������W�\�\�*rc�N�|jj|j�y)z)Protect a package so it won't be removed.N)rj�protectr�rns  rrpzProblemResolver.protects�������w�|�|�,rc�N�|jj|j�y)zMark a package for removal.N)rjr�r�rns  rr�zProblemResolver.removes�������g�l�l�+rc��|jj�|jj�|jj	�y)z:Resolve dependencies, try to remove packages where needed.N)rLr�rj�resolverCros rrszProblemResolver.resolve#s2�����$�$�&������ ����%�%�'rc��|jj�|jj�|jj	�y)z4Resolve dependencies, do not try to remove packages.N)rLr�rj�resolve_by_keeprCros rruzProblemResolver.resolve_by_keep)s2�����$�$�&����&�&�(����%�%�'rc��|jj�|jj�|jj	�y)zKeep back phased updates.N)rLr�rj�keep_phased_updatesrCros rrwz#ProblemResolver.keep_phased_updates/s2�����$�$�&����*�*�,����%�%�'rN�rlr>r9r:)r�r	r9r:r;)rrrrr-r9rpr�rsrurwrrrrhrh
s*���
�+�-�,�(�(�(rrhc��eZdZdZdd�Zy)�FilterzFilter base classc��y)ziFilter function, return True if the package matchs a
        filter criteria and False otherwise
        Tr�r,r�s  r�applyzFilter.apply<s��rN�r�r	r9r�rrrrr}rrrrzrz9s
���rrzc��eZdZdZdd�Zy)�MarkedChangesFilterz&Filter that returns all marked changesc�N�|js|js|jryy)NTF)�marked_install�
marked_delete�marked_upgrader|s  rr}zMarkedChangesFilter.applyFs!������!2�!2�c�6H�6H��rNr~rrrrr�r�Cs
��0�rr�c��eZdZdZdd�Zy)�InstalledFilterzMFilter that returns all installed packages.

    .. versionadded:: 1.0.0
    c��|jSr3)�is_installedr|s  rr}zInstalledFilter.applySs�����rNr~rrrrr�r�Ms���
 rr�c�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)	�_FilteredCacheHelperz:Helper class for FilteredCache to break a reference cycle.c��i|_g|_|jd|j�|jd|j�y)NrCrA)�	_filtered�_filtersrC�filter_cache_post_changerks  rr-z_FilteredCacheHelper.__init__Zs<��+-���&(��
�
���*�D�,I�,I�J�
���(�$�*G�*G�Hrc��i|_|D]?}|jD].}|j|�s�d|j|j<�?�Ay)zinternal helper to refilterTN)r�r�r}r|)r,rlr�rys    r�_reapply_filterz$_FilteredCacheHelper._reapply_filterbsM������	�C��]�]�
���7�7�3�<�/3�D�N�N�3�8�8�,��
�	rc�H�g|_|jj|�y�zSet the current active filter.N)r�r��r,�filters  r�
set_filterz_FilteredCacheHelper.set_filterls����
��
�
���V�$rc�&�|j|�y�z;Called internally if the cache changes, emit a signal then.N)r�rks  rr�z-_FilteredCacheHelper.filter_cache_post_changeqs��	
���U�#rNrx�r�rzr9r:)rrrrr-r�r�r�rrrr�r�Ws��D�I��%�
$rr�c�n�eZdZdZ	d
					dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd	�Z
dd
�Zdd�Zdd�Z
y)�
FilteredCachez\A package cache that is filtered.

    Can work on a existing cache or create a new one
    Nc�l�|�t|�|_n||_t|j�|_yr3)r>rlr��_helper)r,rlris   rr-zFilteredCache.__init__}s+���=��x��D�J��D�J�+�D�J�J�7��rc�@�t|jj�Sr3)r�r�r�ros rr�zFilteredCache.__len__�s���4�<�<�)�)�*�*rc� �|j|Sr3�rlr�s  rr�zFilteredCache.__getitem__�s���z�z�#��rc#�dK�|jjD]}|j|���y�wr3)r�r�rl)r,r�s  rr�zFilteredCache.__iter__�s.�����|�|�-�-�	&�G��*�*�W�%�%�	&�s�.0c�J�|jjj�Sr3)r�r�r�ros rr�zFilteredCache.keys�s���|�|�%�%�*�*�,�,rc�
�||vSr3rr�s  rr�zFilteredCache.has_key�r�rc��	|j|j|jjvS#t$rYywxYwr�)rlr|r�r�r�r�s  rr�zFilteredCache.__contains__�s<��	��:�:�c�?�'�'�4�<�<�+A�+A�A�A���	��	�s�.1�	=�=c�n�|jj|�|jj�yr�)r�r�rlrCr�s  rr�zFilteredCache.set_filter�s$��������'��
�
�$�$�&rc�N�|jj|j�yr�)r�r�rlros rr�z&FilteredCache.filter_cache_post_change�s�����-�-�d�j�j�9rc�.�t|j|�S)z)we try to look exactly like a real cache.)�getattrrlr�s  r�__getattr__zFilteredCache.__getattr__�s���t�z�z�3�'�'r)NN)rlzCache | NonerirZr9r:r_)r�r8r9r	r])r9z
KeysView[str]r^r�r;)r�r8r9r)rrrrr-r�r�r�r�r�r�r�r�r�rrrr�r�wsX���IM�8�!�8�4E�8�	
�8�+��&�-���'�
:�(rr�c��td�y)Nzcache pre changed��printr�s r�cache_pre_changedr��s��	�
�rc��td�y)Nzcache post changedr�r�s r�cache_post_changedr��s��	�
�rc��td�tj�ttj
jj��}|jdt�|jdt�td|v�|d}t|j�tt|��|j�D]}||j|k(r�J�|j�|j�}tt|��|D]}|jr�J�dD]7}t j"j%|�r�#t!j&|��9tj(j+dd�tj,|j.�}tj0tj
jj3��}|j5||d�td	�t7|�}|j8jdt�|j8jdt�|j8j�|j;t=��tt|��|j�D]}|||jk(r�J�tt|��td
�t7tj
j>j���}|j8jdt�|j8jdt�|j8j�|j;t=��tt|��|j�D]}|||jk(r�J�tt|��y)zInternal test code.zCache self testr�rC�aptitude)�/tmp/pytestz/tmp/pytest/partialrKr�Nz.Testing filtered cache (argument is old cache)z$Testing filtered cache (no argument))ri) r�r&r8r>r�rirr
rCr�r�r|r�r�r�r�r(r)r`�mkdirr]r^r�rNr�rrr�rlr�r�r�)rlr�r�r�rIr�r��filtereds        r�_testr��s���	�
���L�L�N��#�,�,�#�#�.�.�0�1�E�	�N�N�%�'8�9�	�N�N�&�(:�;�	�*��
��
�
�
�C�	�#�(�(�O�	�#�e�*���:�:�<�.���W�~�"�"�g�-�-�-�.�
�M�M�O����!�G�	�#�g�,������x�x��x��:����w�w�~�~�g�&��H�H�W����N�N���-�}�=�	�	�	����	0�B��o�o�c�l�l�/�/�?�?�A�B�G�	���'�2�t�,�
�
:�;��U�#�H��N�N���.�0A�B��N�N���/�1C�D��N�N�������+�-�.�	�#�h�-���=�=�?�1���(�7�+�0�0�0�0�0�1�
�#�h�-��	�
0�1��c�l�l�&7�&7�&B�&B�&D�E�H��N�N���.�0A�B��N�N���/�1C�D��N�N�������+�-�.�	�#�h�-���=�=�?�1���(�7�+�0�0�0�0�0�1�
�#�h�-�r�__main__rxr;)*�
__future__rrLr(r?rU�collections.abcrrr�typingrrr&�apt.progress.textr��apt.packager	r
�apt.progress.baserrr
�IOErrorrrrr�	Exceptionr r"r>rhrzr�r�r�r�r�r�r�rrrr�<module>r�s���,#��	���8�8����(�J�J�L�g�L�8�7�8�I�-�I�7�'�7�I�9�I�:�:�*{
)�{
)�|&(�&(�X���&�� �f� �$�$�@1(�1(�h� �5�p�z��	�G�r

Zerion Mini Shell 1.0