o
ai4 @ s d Z ddlZddlmZ ddlmZmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZ dd lmZ d
edefdd
Zeded fddZG dd deZdS )zHTTP cache implementation.
N)contextmanager)IteratorOptional) BaseCache) FileCache)Response)adjacent_tmp_filereplace)
ensure_dirresponsereturnc C s 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_cache s r c c s$ zdV W dS t y Y dS w )zvIf we can't access the cache then we can just skip caching and process
requests as if caching wasn't enabled.
N)OSErrorr r r r suppressed_cache_errors s r c sz e Zd ZdZdeddf fddZdedefdd Zd
edee fddZ d
ed
eddfddZ
d
eddfddZ ZS )
SafeFileCachezw
A file based cache which is safe to use even when the target directory may
not be accessible or writable.
directoryr Nc s$ |d usJ dt || _d S )Nz!Cache directory must not be None.)super__init__r )selfr __class__r r r % s
zSafeFileCache.__init__namec C s6 t |}t|d d |g }tjj| jg|R S )N )r encodelistospathjoinr )r r hashedpartsr r r _get_cache_path* s
zSafeFileCache._get_cache_pathkeyc C sv | |}t ) t|d}| W d W d S 1 s$w Y W d d S 1 s4w Y d S )Nrb)r$ r openread)r r% r fr r r get2 s
"zSafeFileCache.getvaluec C s | |}t 0 ttj| t|
}|| W d n1 s%w Y t|j | W d d S 1 s;w Y d S N)
r$ r r
r r dirnamer writer r )r r% r+ r r) r r r set8 s
"zSafeFileCache.setc C s@ | |}t t| W d d S 1 sw Y d S r, )r$ r r remove)r r% r r r r deleteB s
"zSafeFileCache.delete)
__name__
__module____qualname____doc__strr r$ r bytesr* r/ r1
__classcell__r r r r r s
r )r5 r
contextlibr typingr r Zpip._vendor.cachecontrol.cacher pip._vendor.cachecontrol.cachesr pip._vendor.requests.modelsr pip._internal.utils.filesystemr r pip._internal.utils.miscr
boolr r r r r r r