관리-도구
편집 파일: adapter.cpython-35.pyc
��Re � @ s~ d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z Gd d � d e � Z d S) � N)�HTTPAdapter� )�CacheController)� DictCache)�CallbackFileWrapperc s e Z d Z d d h Z d d d d d d � f d d � Z d � f d d � Z d d � f d d � Z � f d d � Z � S)�CacheControlAdapter�PUT�DELETENTc s} t t | � j | | � | d k r. t � n | | _ | | _ | pI d | _ | pX t } | | j d | d | �| _ d S)N�GET�cache_etags� serializer)r ) �superr �__init__r �cache� heuristic�cacheable_methodsr � controller) �selfr r �controller_classr r r �args�kw�controller_factory)� __class__� ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/adapter.pyr s zCacheControlAdapter.__init__c s� | p | j } | j | k r� y | j j | � } Wn t j k rQ d } Yn X| rn | j | | d d �S| j j | j j | � � t t | � j | | � } | 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. N� from_cacheT) r �methodr �cached_request�zlib�error�build_response�headers�update�conditional_headersr r �send)r �requestr r � cacheable�cached_response�resp)r r r r$ $ s zCacheControlAdapter.sendFc s� | p | j } | r!| j | k r!| j r@ | j j | � } | j d k r� | j j | | � } | | k rv d } | j d d � | j � | } n� | j d k r� | j j | | � nc t | j t j | j j | | � � | _ | j r!| j � � f d d � } t j | | � | _ t t | � j | | � } | j | j k r|| j r|| j j | 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 T�decode_contentFi- c s'