U n aZ @sdZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZdd lmZertdd lmZd d Zed dZGdddeZdS)zHTTP cache implementation. N)contextmanager) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dir)MYPY_CHECK_RUNNING)OptionalcCs t|ddS)N from_cacheF)getattr)responser\C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\network\cache.py is_from_cachesrc cs(z 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|||_dS)Nz!Cache directory must not be None.)AssertionErrorsuperr__init__ directory)selfr __class__rrr,szSafeFileCache.__init__cCs4t|}t|dd|g}tjj|jf|S)N)rencodelistospathjoinr)rnamehashedpartsrrr_get_cache_path2s zSafeFileCache._get_cache_pathc CsR||}t8t|d"}|W5QRW5QRSQRXW5QRXdS)Nrb)r%ropenread)rkeyr frrrget;s  zSafeFileCache.getc CsZ||}t@ttj|t|}||W5QRXt|j |W5QRXdSN) r%rrrr dirnamerwriterr")rr)valuer r*rrrsetBs   zSafeFileCache.setc Cs*||}tt|W5QRXdSr,)r%rrremove)rr)r rrrdeleteMs zSafeFileCache.delete) __name__ __module__ __qualname____doc__rr%r+r0r2 __classcell__rrrrr&s    r)r6r contextlibrZpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrZpip._vendor.requests.modelsrpip._internal.utils.filesystemrrpip._internal.utils.miscrpip._internal.utils.typingr typingr rrrrrrrs