3 Re @sdZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZdd lmZerxdd lmZmZd d Zed dZGdddeZdS)zHTTP cache implementation. N)contextmanager) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dir)MYPY_CHECK_RUNNING)OptionalIteratorcCs t|ddS)N from_cacheF)getattr)responser/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/cache.py is_from_cachesrc cs(y dVWnttfk r"YnXdS)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorIOErrorrrrrsuppressed_cache_errorss rcs@eZdZdZfddZddZddZdd Zd d ZZ S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. cs(|dk stdtt|j||_dS)Nz!Cache directory must not be None.)AssertionErrorsuperr__init__ directory)selfr) __class__rrr*szSafeFileCache.__init__cCs4tj|}t|dd|g}tjj|jf|S)N)rencodelistospathjoinr)rnamehashedpartsrrr_get_cache_path0s zSafeFileCache._get_cache_pathcCs:|j|}t t|d }|jSQRXWdQRXdS)Nrb)r%ropenread)rkeyr frrrget9s  zSafeFileCache.getcCsZ|j|}t@ttjj|t|}|j|WdQRXt|j |WdQRXdS)N) r%rrrr dirnamerwriterr")rr)valuer r*rrrset@s   zSafeFileCache.setc Cs*|j|}ttj|WdQRXdS)N)r%rrremove)rr)r rrrdeleteKs zSafeFileCache.delete) __name__ __module__ __qualname____doc__rr%r+r/r1 __classcell__rr)rrr$s    r)r5r contextlibrZpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrZpip._vendor.requests.modelsrpip._internal.utils.filesystemrrpip._internal.utils.miscrpip._internal.utils.typingr typingr r rrrrrrrs