File: //lib/python3/dist-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-310.pyc
o
@%Ne� � @ s` d dl Z d dlZd dlZd dlmZ ddlmZmZ ddlm Z ddl
mZ G dd� de�ZdS ) � N)�HTTPAdapter� )�CacheController�PERMANENT_REDIRECT_STATUSES)� DictCache)�CallbackFileWrapperc s\ e Zd Zh d�Z d
� fdd� Zd� fdd� Z d� fd d
� Z� fdd�Z� ZS )�CacheControlAdapter> �PUT�PATCH�DELETENTc
sX t t| �j|i |�� |d u rt� n|| _|| _|pd| _|p t} | | j||d�| _d S )N)�GET)�cache_etags�
serializer) �superr �__init__r �cache� heuristic�cacheable_methodsr �
controller)
�selfr r
�controller_classr r r �args�kw�controller_factory�� __class__� �B/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/adapter.pyr s
�zCacheControlAdapter.__init__c s� |p| j }|j|v r3z| j�|�}W n tjy d}Y nw |r)| j||dd�S |j�| j� |�� t
t| �j|fi |��}|S )z�
Send a request. Use the request information to see if it
exists in the cache and cache the response if we need to and can.
NT)�
from_cache)
r �methodr �cached_request�zlib�error�build_response�headers�update�conditional_headersr r �send)r �requestr r � cacheable�cached_response�respr r r r'