Re @ s d Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l
m Z m Z d d l
m Z d d l m Z e r d d
l m Z m Z d d Z e d
d Z Gd d d e Z d S)zHTTP cache implementation.
N)contextmanager) BaseCache) FileCache)Response)adjacent_tmp_filereplace)
ensure_dir)MYPY_CHECK_RUNNING)OptionalIteratorc C s t | d d S)N
from_cacheF)getattr)response r /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_cache s r c c s( y d VWn t t f k
r# Yn Xd S)zvIf we can't access the cache then we can just skip caching and process
requests as if caching wasn't enabled.
N)OSErrorIOErrorr r r r suppressed_cache_errors s r c sX e Z d Z d Z f d d Z d d Z d d Z d d Z d
d Z S)
SafeFileCachezw
A file based cache which is safe to use even when the target directory may
not be accessible or writable.
c s8 | d k s t d t t | j | | _ d S)Nz!Cache directory must not be None.)AssertionErrorsuperr __init__ directory)selfr ) __class__r r r * s zSafeFileCache.__init__c C sB t j | } t | d d | g } t j j | j | S)N )r encodelistospathjoinr )r namehashedpartsr r r _get_cache_path0 s zSafeFileCache._get_cache_pathc C sG | j | } t ( t | d } | j SWd QRXWd QRXd S)Nrb)r% r openread)r keyr fr r r get9 s
zSafeFileCache.getc C sm | j | } t N t t j j | t | } | j | Wd QRXt | j | Wd QRXd S)N)
r% r r r r dirnamer writer r" )r r) valuer r* r r r set@ s
zSafeFileCache.setc C s1 | j | } t t j | Wd QRXd S)N)r% r r remove)r r) r r r r deleteK s
zSafeFileCache.delete) __name__
__module____qualname____doc__r r% r+ r/ r1 r r )r r r $ s r )r5 r
contextlibr Zpip._vendor.cachecontrol.cacher pip._vendor.cachecontrol.cachesr Zpip._vendor.requests.modelsr pip._internal.utils.filesystemr r pip._internal.utils.miscr pip._internal.utils.typingr typingr
r r r r r r r r