HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/apt/__pycache__/cache.cpython-38.pyc
U

&��c���@s�ddlmZddlZddlZddlZddlZz`ddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZeee	e
eeee
eeWnek
r�dd�ZYnXddlZddlmZmZddlZddlmZmZmZeeeeGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z Gdd�de�Z!Gdd�de"�Z#Gdd�de$�Z%Gdd�de$�Z&Gdd�de$�Z'Gdd�de$�Z(Gdd�de(�Z)Gdd�de(�Z*Gdd�de$�Z+Gd d!�d!e$�Z,d"d#�Z-d$d%�Z.d&d'�Z/e0d(k�r�e/�dS))�)�print_functionN)�Any�Callable�Dict�Iterator�List�Optional�Set�Tuple�Union�cast�KeysViewcCs|S�N�)�typ�objrr�+/usr/lib/python3/dist-packages/apt/cache.pyr+sr)�Package�Version)�AcquireProgress�InstallProgress�
OpProgressc@seZdZdZdS)�FetchCancelledExceptionzAException that is thrown when the user cancels a fetch operation.N��__name__�
__module__�__qualname__�__doc__rrrrr9src@seZdZdZdS)�FetchFailedExceptionz-Exception that is thrown when fetching fails.Nrrrrrr=src@seZdZdZdS)�UntrustedExceptionz>Exception that is thrown when fetching fails for trust reasonsNrrrrrrAsrc@seZdZdZdS)�LockFailedExceptionz,Exception that is thrown when locking fails.Nrrrrrr Esr c@seZdZdZdS)�CacheClosedExceptionz>Exception that is thrown when the cache is used after close().Nrrrrrr!Isr!c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_WrappedLockz`Wraps an apt_pkg.FileLock to raise LockFailedException.

    Initialized using a directory path.cCs ||_t�tj�|d��|_dS)N�lock)�_path�apt_pkgZFileLock�os�path�join�_lock)�selfr'rrr�__init__Rsz_WrappedLock.__init__c
CsHz|j��WStjk
rB}ztd|j|f��W5d}~XYnXdS)NzFailed to lock directory %s: %s)r)�	__enter__r%�Errorr r$)r*�errrr,Ws�z_WrappedLock.__enter__cCs|j�|||�Sr)r)�__exit__)r*r�value�	tracebackrrrr/_sz_WrappedLock.__exit__N)rrrrr+r,r/rrrrr"Msr"c@s�eZdZdZd\dd�Zdd�Zdd	�Zd
d�Zdd
�Zd]dd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd^dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd_d,d-�Zed.d/��Zed0d1��Zed2d3��Zd4d5�Zd`d6d7�Zdad8d9�Zd:d;�Z dbd=d>�Z!dcd@dA�Z"dBdC�Z#dddDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(dNdO�Z)dPdQ�Z*edRdS��Z+edTdU��Z,edVdW��Z-edXdY��Z.edZd[��Z/dS)e�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.
    NFc	CsVttjd�|_ttjd�|_ttjd�|_ttjd�|_	i|_
i|_t�
�|_t��|_d|_d|_|�dd�|�dd�|r�tj�dd�|�r2tj�|�}tj�|d�r�t�tj|d�tj�|d�r�t�tj|d�tj�d	|�tj�d
|d�tj�dtj�|d
dd��|�|�t��tj� d�}t!|�|_"|�#|�dS)N����cache_post_open�_inc_changes_count�cache_post_changezDir::Cache::pkgcache�z/etc/apt/apt.confz/etc/apt/apt.conf.dZDir�Dir::State::status�/var/lib/dpkg/statuszDir::bin::dpkgZusr�binZdpkg�Dir::Cache::Archives)$rr%r2�_cache�DepCache�	_depcache�PackageRecords�_records�
SourceList�_list�
_callbacks�_callbacks2�weakref�WeakValueDictionary�_weakref�WeakSet�
_weakversions�_changes_count�_sorted_set�connect�config�setr&r'�abspath�existsZread_config_file�isdirZread_config_dirr(�_check_and_create_required_dirsZinit_system�find_dirr"�
_archive_lock�open)r*�progress�rootdirZmemonlyZarchive_dirrrrr+~sH

����

zCache.__init__cCs|j��dS)zFix broken packages.N)r>�
fix_broken�r*rrrrX�szCache.fix_brokencCs|jd7_dS)zIncrease the number of changes�N)rJrYrrrr5�szCache._inc_changes_countcCslddg}ddddg}|D]"}tj�||�st�||�q|D]&}tj�||�s@t||d���q@dS)	zf
        check if the required apt directories/files are there and if
        not create them
        r9z/etc/apt/sources.listz
/var/lib/dpkgz	/etc/apt/z/var/cache/apt/archives/partialz/var/lib/apt/lists/partial�wN)r&r'rP�makedirsrU�close)r*rW�files�dirs�d�frrrrR�s��z%Cache._check_and_create_required_dirscCsf||jkr2|j|D]}|dkr*|��q|�q||jkrb|j|D]\}}}||f|�|�qFdS)z# internal helper to run a callback r5N)rCr5rD�r*�name�callback�args�kwdsrrr�_run_callbacks�s


zCache._run_callbackscCs�|dkrtjj��}|��||_|�d�t�|�|_	t�
|j	�|_t�|j	�|_
t��|_|j��d|_|��tt���dk|_|��|�d�dS)zY Open the package cache, after that it can be used like
            a dictionary
        NZcache_pre_openrZr4)�aptrV�baserr]Zop_progressrgr%r2r<r=r>r?r@rArB�read_main_listrK�
_Cache__remap�lenZget_architecturesZ_have_multi_archZdone)r*rVrrrrU�s


z
Cache.openc	Cs�t|j���D]f}z|j|}Wntk
r8YqYnXz|j|jj|jjf|_Wqtk
rr|j|=YqXqt|j	�D]x}|j
jjD]\}|j|j
jkr�|jdks�|j
jdks�|j|j
jkr�|j|j
jkr�|j|j
jkr�||_
q�q�|j	�|�q�dS)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)�listrG�keys�KeyErrorr<�_pkgrcZarchitecture�LookupErrorrI�packageZversion_list�hashZ_cand�sizeZ
multi_archZver_str�remove)r*�key�pkgZver�vrrrZ__remap�s2
�
����z
Cache.__remapcCs|`ttjd�|_dS)z Close the package cache N)r@rr%r?rYrrrr]szCache.closecCs|S)z Enter the with statement rrYrrrr,szCache.__enter__cCs|��dS)z Exit the with statement N)r])r*�exc_type�	exc_valuer1rrrr/!szCache.__exit__cCs\zt|�}|j|}Wn tk
r6td|��YnX|�|�sNtd|��|�|�}|S)z" look like a dictionary (get key) z!The cache has no package named %r)�strr<ro�_Cache__is_real_pkg�_rawpkg_to_pkg)r*rv�rawpkgrwrrr�__getitem__&s

zCache.__getitem__cCs(z
||WStk
r"|YSXdS)zaReturn *self*[*key*] or *default* if *key* not in *self*.

        .. versionadded:: 1.1
        N)ro)r*rv�defaultrrr�get7s
z	Cache.getcCs |jdd�}|j�|t||��S)zgReturns the apt.Package object for an apt_pkg.Package object.

        .. versionadded:: 1.0.0
        T�Zpretty)�get_fullnamerG�
setdefaultr)r*r~�fullnamerrrr}BszCache._rawpkg_to_pkgccs2|��D]$}t||j|�}|j�||�VqdSr)rnrr<rGr��r*�pkgnamerwrrr�__iter__LszCache.__iter__cCs|jS)z8Check if the apt_pkg.Package provided is a real package.)�has_versions)r*r~rrrZ
__is_real_pkgWszCache.__is_real_pkgcCs||kSrr�r*rvrrr�has_key\sz
Cache.has_keycCs2z|�|jt|��WStk
r,YdSXdS�NF)r|r<r{ror�rrr�__contains__`szCache.__contains__cCst|���Sr)rlrnrYrrr�__len__gsz
Cache.__len__cs0�jdkr&t�fdd��jjD���_t�j�S)Nc3s$|]}��|�r|jdd�VqdS)Tr�N)r|r�)�.0�prYrr�	<genexpr>ns
�zCache.keys.<locals>.<genexpr>)rK�sortedr<�packagesrmrYrrYrrnks

�
z
Cache.keyscCs6g}|jj}|jjD]}||�s|�|�|��q|S)z Get the marked changes )r>�marked_keepr<r��appendr})r*�changesr�r~rrr�get_changessszCache.get_changescCs |��|j�|�|��dS)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_changer>�upgrader6)r*Zdist_upgraderrrr�}sz
Cache.upgradecCs>|jdkrtd��t�|j�}t��}|�||j|j�|jS)z;Get the size of the packages that are required to download.N�&Cache object used after close() called)	r@r!r%�PackageManagerr>�Acquire�get_archivesrBZfetch_needed)r*�pm�fetcherrrr�required_download�s
�zCache.required_downloadcCs|jjS)z8Get the size of the additional required space on the fs.)r>Zusr_sizerYrrr�required_space�szCache.required_spacecCs^t�}|jj}ttjtjf�}|jjD]2}||�}|r&|j	s&|j
|kr&|�|jdd��q&|S)zAReturn the packages not downloadable packages in reqreinst state.Tr�)
rNr>�get_candidate_ver�	frozensetr%ZINSTSTATE_REINSTREQZINSTSTATE_HOLD_REINSTREQr<r�ZdownloadableZ
inst_state�addr�)r*Z	reqreinstr�ZstatesrwZcandrrr�req_reinstall_pkgs�s�zCache.req_reinstall_pkgscCs�|dkrtj�dd�}dd�|jD�}|rJ|sJtdd�dd�|D����|��}d}d	}|jD]2}|j|jkrrq`|j	rzq`|d
|j
|jf7}d}q`||jkr�t
|��n|r�t|��|S)NzAPT::Get::AllowUnauthenticatedFcSsg|]}|js|�qSr)Z
is_trusted)r��itemrrr�
<listcomp>�sz&Cache._run_fetcher.<locals>.<listcomp>zUntrusted packages:
%s�
css|]}|jVqdSr)�desc_uri)r��irrrr��sz%Cache._run_fetcher.<locals>.<genexpr>r7zFailed to fetch %s %s
T)r%rMZfind_b�itemsrr(�runZstatusZ	STAT_DONEZ	STAT_IDLEr�Z
error_textZRESULT_CANCELLEDrr)r*r��allow_unauthenticatedZ	untrusted�resZfailed�err_msgr�rrr�_run_fetcher�s4��
�

zCache._run_fetchercCs4|jdkrtd��|�||j|j�s(dS|�||�S)z fetch the needed archives Nr�F)r@r!r�rBr�)r*r�r�r�rrr�_fetch_archives�s
�zCache._fetch_archivesc
Csr|dk	r|dk	rtd��|dkr,tjj��}|dkr>t�|�}|j�$|�|t�	|j
�|�W5QR�SQRXdS)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)�
ValueErrorrhrV�textrr%r�rTr�r�r>)r*rVr�r�rrr�fetch_archives�s

�zCache.fetch_archivescCs<z|j|}Wntk
r$YdSXt|jo4|j�SdS)z0Return whether the package is a virtual package.FN)r<ro�boolZhas_providesr�r�rrr�is_virtual_package�s
zCache.is_virtual_packageTcCs�t�}|jj}z"|j|}|jr.|s.t|�WSWntk
rLt|�YSX|jD]0\}}}	|	j}
|rt|	||
�krT|�	|�
|
��qTt|�S)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.
        )rNr>r�r<r�rmroZ
provides_listZ
parent_pkgr�r})r*r�Zcandidate_onlyZinclude_nonvirtualZ	providersr�ZvpZprovidesZprovidesver�versionr~rrr�get_providing_packages	s

zCache.get_providing_packagesrcCsDttj�d����(|r�tj�d�}tj�d�}tj�d�}tj�dtj�|��tj�dd�tj�dd�t�	�}|�
�n|j}z||dkr�tj
j��}z|j�|||�}	Wn*tk
r�}
zt|
��W5d}
~
XYnX|	s�|r�t��n|	W�W5QR�SW5|�r4tj�d|�tj�d|�tj�d|�XW5QRXdS)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-CleanupZxxx�0N)r"r%rMrS�findrNr&r'rOrArjrBrhrVrirr<�update�SystemErrorr)r*�fetch_progressZpulse_intervalZraise_on_errorZsources_listZold_sources_listZold_sources_list_dZold_cleanupZslistr�r.rrrr�*sH
�
�

����zCache.updatecCs�z|��Wntk
r(|��YnXt��}|r>t��z|�|�}W5|rZt��Xz|��Wntk
r�|�	�YnX|S)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.
        )
ZstartUpdate�AttributeErrorZstart_updater%Zpkgsystem_is_lockedZpkgsystem_unlock_innerZpkgsystem_lock_innerr�ZfinishUpdateZ
finish_update)r*r��install_progressZ
did_unlockr�rrr�install_archives]s 

zCache.install_archivesc
Cs�|dkrtjj��}|dkr(tjj��}|dk	s4t�t����t�|j	�}t�
|�}|j�d|�|||�}|�
||�}||jkr�q�n,||jkr�td��n||jkr�ntd|��|��q\W5QRXW5QRX||jkS)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)rhrVrirr�AssertionErrorr%Z
SystemLockr�r>r�rTr�r�ZRESULT_COMPLETEDZ
RESULT_FAILEDr�ZRESULT_INCOMPLETEZshutdown)r*r�r�r�r�r�r�rrr�commits0

�



�zCache.commitcCs|j��dS)z Unmark all changes N)r>�initrYrrr�clear�szCache.clearcCs|�d�dS)z@ called internally if the cache has changed, emit a signal then r6N�rgrYrrrr6�szCache.cache_post_changecCs|�d�dS)zS called internally if the cache is about to change, emit
            a signal then r�Nr�rYrrrr��szCache.cache_pre_changecCs>|dkrt�dtd�||jkr*g|j|<|j|�|�dS)z�Connect to a signal.

        .. deprecated:: 1.0

            Please use connect2() instead, as this function is very
            likely to cause a memory leak.
        r5zAconnect() likely causes a reference cycle, use connect2() instead�N)�warnings�warn�RuntimeWarningrCr�)r*rcrdrrrrL�s	�

z
Cache.connectcOs.||jkrg|j|<|j|�|||f�dS)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)rDr�rbrrr�connect2�s

zCache.connect2cCst�|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%ZActionGroupr>rYrrr�actiongroup�szCache.actiongroupcCsDtj�tj�d��}t�tj�|d��D]}t�|d�r(dSq(dS)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.
        r8Zupdatesz[0-9]*TF)	r&r'�dirnamer%rMZ	find_file�listdirr(�fnmatch)r*Zdpkg_status_dirrarrr�dpkg_journal_dirtys	
�zCache.dpkg_journal_dirtycCs|jjS)z7Return the number of packages with broken dependencies.)r>�broken_countrYrrrr�szCache.broken_countcCs|jjS)z2Return the number of packages marked for deletion.)r>Z	del_countrYrrr�delete_countszCache.delete_countcCs|jjS)z6Return the number of packages marked for installation.)r>Z
inst_countrYrrr�
install_count"szCache.install_countcCs|jjS)z-Return the number of packages marked as keep.)r>�
keep_countrYrrrr�(szCache.keep_count)NNF)N)N)F)N)NNN)TF)NrTN)NNN)0rrrrr+rXr5rRrgrUrkr]r,r/rr�r}r�r|r�r�r�rnr�r��propertyr�r�r�r�r�r�r�r�r�r�r�r�r6r�rLr�r�r�r�r�r�r�rrrrr2ds�
.
 







$�
�
"
�
!�
3#�
:



r2c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�ProblemResolverzuResolve problems due to dependencies and conflicts.

    The first argument 'cache' is an instance of apt.Cache.
    cCst�|j�|_||_dSr)r%r�r>�	_resolverr<�r*�cacherrrr+5szProblemResolver.__init__cCs|j�|j�dS)z'Reset the package to the default state.N)r�r�rp�r*rrrrrr�:szProblemResolver.clearcCs|j�|j�dS)z)Protect a package so it won't be removed.N)r��protectrpr�rrrr�?szProblemResolver.protectcCs|j�|j�dS)zMark a package for removal.N)r�rurpr�rrrruDszProblemResolver.removecCs"|j��|j��|j��dS)z:Resolve dependencies, try to remove packages where needed.N)r<r�r��resolver6rYrrrr�Is

zProblemResolver.resolvecCs"|j��|j��|j��dS)z4Resolve dependencies, do not try to remove packages.N)r<r�r��resolve_by_keepr6rYrrrr�Ps

zProblemResolver.resolve_by_keepN)
rrrrr+r�r�rur�r�rrrrr�/sr�c@seZdZdZdd�ZdS)�Filterz Filter base class cCsdS)zn Filter function, return True if the package matchs a
            filter criteria and False otherwise
        Tr�r*rwrrr�apply^szFilter.applyN�rrrrr�rrrrr�[sr�c@seZdZdZdd�ZdS)�MarkedChangesFilterz( Filter that returns all marked changes cCs|js|js|jrdSdSdS)NTF)Zmarked_installZ
marked_deleteZmarked_upgrader�rrrr�iszMarkedChangesFilter.applyNr�rrrrr�fsr�c@seZdZdZdd�ZdS)�InstalledFilterzMFilter that returns all installed packages.

    .. versionadded:: 1.0.0
    cCs|jSr)Zis_installedr�rrrr�wszInstalledFilter.applyNr�rrrrr�qsr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_FilteredCacheHelperz:Helper class for FilteredCache to break a reference cycle.cCs,i|_g|_|�d|j�|�d|j�dS)Nr6r4)�	_filtered�_filtersr��filter_cache_post_changer�rrrr+sz_FilteredCacheHelper.__init__cCs:i|_|D]*}|jD]}|�|�rd|j|j<q
qq
dS)z internal helper to refilter TN)r�r�r�rc)r*r�rwrarrr�_reapply_filter�s

z$_FilteredCacheHelper._reapply_filtercCsg|_|j�|�dS�zSet the current active filter.N)r�r��r*�filterrrr�
set_filter�sz_FilteredCacheHelper.set_filtercCs|�|�dS�z;Called internally if the cache changes, emit a signal then.N)r�r�rrrr��sz-_FilteredCacheHelper.filter_cache_post_changeN)rrrrr+r�r�r�rrrrr�|s
	r�c@sbeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�
FilteredCacheza A package cache that is filtered.

        Can work on a existing cache or create a new one
    NcCs*|dkrt|�|_n||_t|j�|_dSr)r2r�r��_helper)r*r�rVrrrr+�szFilteredCache.__init__cCst|jj�Sr)rlr�r�rYrrrr��szFilteredCache.__len__cCs
|j|Sr�r�r�rrrr�szFilteredCache.__getitem__ccs|jjD]}|j|VqdSr)r�r�r�)r*r�rrrr��szFilteredCache.__iter__cCs|jj��Sr)r�r�rnrYrrrrn�szFilteredCache.keyscCs||kSrrr�rrrr��szFilteredCache.has_keycCs2z|j|j|jjkWStk
r,YdSXdSr�)r�rcr�r�ror�rrrr��szFilteredCache.__contains__cCs|j�|�|j��dSr�)r�r�r�r6r�rrrr��szFilteredCache.set_filtercCs|j�|j�dSr�)r�r�r�rYrrrr��sz&FilteredCache.filter_cache_post_changecCst|j|�S)z)we try to look exactly like a real cache.)�getattrr�r�rrr�__getattr__�szFilteredCache.__getattr__)NN)rrrrr+r�rr�rnr�r�r�r�r�rrrrr��s
r�cCstd�dS)Nzcache pre changed��printr�rrr�cache_pre_changed�sr�cCstd�dS)Nzcache post changedr�r�rrr�cache_post_changed�sr�cCstd�t��ttjj���}|�dt	�|�dt
�td|k�|d}t|j�tt|��|�
�D]}||j|ksjt�qj|��|��}tt|��|D]}|js�t�q�dD]}tj�|�s�t�|�q�tj�dd�t�|j�}t�tjj���}|�||d�td	�t|�}|j�dt	�|j�dt
�|j��|�t��tt|��|�
�D]}|||jk�sbt��qbtt|��td
�ttjj ��d�}|j�dt	�|j�dt
�|j��|�t��tt|��|�
�D]}|||jk�s�t��q�tt|��dS)zInternal test code.zCache self testr�r6Zaptitude)�/tmp/pytestz/tmp/pytest/partialr;r�Nz.Testing filtered cache (argument is old cache)z$Testing filtered cache (no argument))rV)!r�r%r�r2rhrVr�rr�r�r�rcrlrnr�r�r�r&r'rP�mkdirrMrNr�r>r�rr�r�r�r�r�ri)r�rwr�r�r�r�r�Zfilteredrrr�_test�sV


r��__main__)1Z
__future__rr�r&r�rE�typingrrrrrrr	r
rrr
�ImportErrorr%Zapt.packagerrZapt.progress.textrhZapt.progress.baserrr�IOErrorrrrr �	Exceptionr!�objectr"r2r�r�r�r�r�r�r�r�r�rrrrr�<module>sd4P,$<9