관리-도구
편집 파일: adapter.cpython-38.pyc
U &?�f� � @ s� 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 d� de�ZdS )� )�annotationsN)� TYPE_CHECKING�Any� Collection�Mapping)�HTTPAdapter)� DictCache)�PERMANENT_REDIRECT_STATUSES�CacheController)�CallbackFileWrapper)�PreparedRequest�Response)�HTTPResponse)� BaseCache)� BaseHeuristic)� Serializerc s� e Zd ZdddhZd"dddd d dddd d� � fdd� Zd#ddddddddd�� fdd� Zd$dddddd�� fdd� Zd d�� fd d!�Z� ZS )%�CacheControlAdapter�PUT�PATCH�DELETENTzBaseCache | None�boolztype[CacheController] | NonezSerializer | NonezBaseHeuristic | NonezCollection[str] | Noner �None) �cache�cache_etags�controller_class� serializer� heuristic�cacheable_methods�args�kw�returnc sP t � j||� |d krt� n|| _|| _|p.d| _|p8t} | | j||d�| _d S )N)�GET)r r )�super�__init__r r r r r � controller) �selfr r r r r r r r �controller_factory�� __class__� �N/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/cachecontrol/adapter.pyr# s �zCacheControlAdapter.__init__Fr z7None | float | tuple[float, float] | tuple[float, None]z bool | strz4None | bytes | str | tuple[bytes | str, bytes | str]zMapping[str, str] | Noner )�request�stream�timeout�verify�cert�proxiesr r c s� |p| j }|j|krhz| j�|�} W n tjk r> d} Y nX | rT| j|| dd�S |j�| j� |�� t � �||||||�} | 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"