o ai4@sdZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZmZdd lmZd e d efd d Zed edfddZGdddeZdS)zHTTP cache implementation. N)contextmanager)IteratorOptional) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dirresponsereturncCs t|ddS)N from_cacheF)getattr)r r/builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/network/cache.py is_from_caches rccs$zdVWdStyYdSw)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorrrrrsuppressed_cache_errorss   rcszeZdZdZdeddffdd Zdedefdd Zd edeefd d Z d ed eddfddZ d eddfddZ Z S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. directoryr Ncs$|dusJdt||_dS)Nz!Cache directory must not be None.)super__init__r)selfr __class__rrr%s  zSafeFileCache.__init__namecCs6t|}t|dd|g}tjj|jg|RS)N)rencodelistospathjoinr)rrhashedpartsrrr_get_cache_path*s zSafeFileCache._get_cache_pathkeyc Csv||}t)t|d}|WdWdS1s$wYWddS1s4wYdS)Nrb)r$ropenread)rr%r frrrget2s  "zSafeFileCache.getvaluec Cs||}t0ttj|t| }||Wdn1s%wYt|j |WddS1s;wYdSN) r$rr rr dirnamerwriter r)rr%r+r r)rrrset8s   "zSafeFileCache.setcCs@||}tt|WddS1swYdSr,)r$rrremove)rr%r rrrdeleteBs  "zSafeFileCache.delete) __name__ __module__ __qualname____doc__strrr$rbytesr*r/r1 __classcell__rrrrrs r)r5r contextlibrtypingrrZpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrpip._vendor.requests.modelsrpip._internal.utils.filesystemrr pip._internal.utils.miscr boolrrrrrrrs