| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.7/site-packages/pip/_vendor/cachecontrol/__pycache__/ |
Upload File : |
B
�N�a � @ s\ d dl Z d dlZd dlZd dlmZ ddlmZ ddlmZ ddl m
Z
G dd� de�ZdS ) � N)�HTTPAdapter� )�CacheController)� DictCache)�CallbackFileWrapperc sN e Zd ZddhZd� fdd� Zd� fdd� Zd� fd
d� Z� fdd
�Z� ZS )�CacheControlAdapterZPUTZDELETENTc
sT t t| �j||� |d kr t� n|| _|| _|p2d| _|p<t} | | j||d�| _d S )N)ZGET)�cache_etags�
serializer) �superr �__init__r �cache� heuristic�cacheable_methodsr �
controller)
�selfr r Zcontroller_classr r
r �args�kwZcontroller_factory)� __class__� �D/usr/lib/python3.7/site-packages/pip/_vendor/cachecontrol/adapter.pyr s
zCacheControlAdapter.__init__c s� |p| j }|j|krhy| j�|�}W n tjk
r> d}Y nX |rT| j||dd�S |j�| j� |�� t
t| �j|f|�}|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 Zcached_request�zlib�error�build_responseZheaders�updateZconditional_headersr
r �send)r �requestr r � cacheable�cached_response�resp)r r r r $ s
zCacheControlAdapter.sendFc
s |p| j }|s�|j|kr�| jr*| j�|�}|jdkrh| j�||�}||k rNd}|jdd� |�� |}n\|jdkr�| j� ||� nBt
|jt�
| jj ||��|_|jr�|j� � fdd�}t�||�|_tt| ��||�}|j| jk�r|j�r| j�|j�} | j�| � ||_|S )z�
Build a response by making a request or using the cache.
This will end up calling send and returning a potentially
cached response
i0 TF)Zdecode_contenti- c s � � | j dkr| j�� d S )Nr )Z
chunk_left�_fpZ_close)r )�super_update_chunk_lengthr r �_update_chunk_lengthn s
z@CacheControlAdapter.build_response.<locals>._update_chunk_length)r r r
Zapply�statusr Zupdate_cached_response�readZrelease_connZcache_responser r! � functools�partialZchunkedr# �types�
MethodTyper
r r �invalidating_methods�ok� cache_urlZurlr �deleter )
r r Zresponser r r r r# r r, )r )r"