U .e @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z m Z ddlmZ ddl mZ erhdd lmZ ed d ZG dd d eZdS )zHTTP cache implementation. N)contextmanager) BaseCache) FileCache)adjacent_tmp_filereplace) ensure_dir)MYPY_CHECK_RUNNING)Optionalc c s( z dV W n t tfk r" Y nX dS )zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorIOError r r ?/usr/lib/python3.8/site-packages/pip/_internal/network/cache.pysuppressed_cache_errors s r c s@ e Zd ZdZ fddZdd Zdd Zdd Zd d Z Z S ) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. c s( |d k st dtt| || _d S )Nz!Cache directory must not be None.)AssertionErrorsuperr __init__ directory)selfr __class__r r r &