Current File : //usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-312.pyc |
�
/�g� � �� � d dl mZ d dlZd dlZd dlZd dlmZmZmZm Z d dl
mZ d dlm
Z
d dlmZmZ d dlmZ er d dlmZmZ d d lmZ d d
lmZ d dlmZ d dlmZ G d
� de� Zy)� )�annotationsN)�
TYPE_CHECKING�Any�
Collection�Mapping)�HTTPAdapter)� DictCache)�PERMANENT_REDIRECT_STATUSES�CacheController)�CallbackFileWrapper)�PreparedRequest�Response)�HTTPResponse)� BaseCache)�
BaseHeuristic)�
Serializerc � � � e Zd Zh d�Z d d� fd�
Z d d � fd�
Z d
d� fd�
Zd� fd�Z� xZS )
�CacheControlAdapter> �PUT�PATCH�DELETEc � �� t �
| � |i |�� |�
t � n|| _ || _ |xs d| _ |xs t } | | j ||�� | _ y )N)�GET)�cache_etags�
serializer)�super�__init__r �cache� heuristic�cacheable_methodsr �
controller)�selfr r �controller_classr r r �args�kw�controller_factory� __class__s ��B/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/adapter.pyr zCacheControlAdapter.__init__ s\ �� � ���$�%�"�%�$)�M�Y�[�u��
�"���!2�!>�h���-�@���,��J�J�K�J�
��� c �n �� |xs | j }|j |v rf | j j |� } | r| j
|| d�� S |j j | j j |� � t �| �- ||||||� }
|
S # t j
$ r d} Y �ww xY w)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 �send)r"