Re @sdZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZdd lmZerdd lmZmZd d Zed dZGdddeZdS)zHTTP cache implementation. N)contextmanager) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dir)MYPY_CHECK_RUNNING)OptionalIteratorcCst|ddS)N from_cacheF)getattr)responser/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/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 rcsXeZdZdZfddZddZddZdd Zd d ZS) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. cs8|dk stdtt|j||_dS)Nz!Cache directory must not be None.)AssertionErrorsuperr__init__ directory)selfr) __class__rrr*szSafeFileCache.__init__cCsBtj|}t|dd|g}tjj|j|S)N)rencodelistospathjoinr)rnamehashedpartsrrr_get_cache_path0szSafeFileCache._get_cache_pathcCsG|j|}t(t|d}|jSWdQRXWdQRXdS)Nrb)r%ropenread)rkeyr frrrget9s zSafeFileCache.getcCsm|j|}tNttjj|t|}|j|WdQRXt|j |WdQRXdS)N) r%rrrr dirnamerwriterr")rr)valuer r*rrrset@s  zSafeFileCache.setc Cs1|j|}ttj|WdQRXdS)N)r%rrremove)rr)r rrrdeleteKs zSafeFileCache.delete) __name__ __module__ __qualname____doc__rr%r+r/r1rr)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