ó
{Udc           @   sŲ   d  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	 d d l
 m Z m Z d d l m Z d d	 l m Z e r§ d d
 l m Z m Z n  d   Z e d    Z d e f d     YZ d S(   s   HTTP cache implementation.
iĸĸĸĸN(   t   contextmanager(   t	   BaseCache(   t	   FileCache(   t   Response(   t   adjacent_tmp_filet   replace(   t
   ensure_dir(   t   MYPY_CHECK_RUNNING(   t   Iteratort   Optionalc         C   s   t  |  d t  S(   Nt
   from_cache(   t   getattrt   False(   t   response(    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   is_from_cache   s    c           c   s'   y	 d VWn t  t f k
 r" n Xd S(   sv   If we can't access the cache then we can just skip caching and process
    requests as if caching wasn't enabled.
    N(   t   OSErrort   IOError(    (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   suppressed_cache_errors   s    	t   SafeFileCachec           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sw   
    A file based cache which is safe to use even when the target directory may
    not be accessible or writable.
    c         C   s8   | d  k	 s t d   t t |   j   | |  _ d  S(   Ns!   Cache directory must not be None.(   t   Nonet   AssertionErrort   superR   t   __init__t	   directory(   t   selfR   (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyR   *   s    c         C   s<   t  j |  } t | d   | g } t j j |  j |  S(   Ni   (   R   t   encodet   listt   ost   patht   joinR   (   R   t   namet   hashedt   parts(    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   _get_cache_path0   s    c      	   C   sE   |  j  |  } t   ' t | d   } | j   SWd  QXWd  QXd  S(   Nt   rb(   R!   R   t   opent   read(   R   t   keyR   t   f(    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   get9   s    
c      
   C   sk   |  j  |  } t   M t t j j |   t |   } | j |  Wd  QXt | j	 |  Wd  QXd  S(   N(
   R!   R   R   R   R   t   dirnameR   t   writeR   R   (   R   R%   t   valueR   R&   (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   set@   s    
c         C   s0   |  j  |  } t    t j |  Wd  QXd  S(   N(   R!   R   R   t   remove(   R   R%   R   (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   deleteK   s    
(   t   __name__t
   __module__t   __doc__R   R!   R'   R+   R-   (    (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyR   $   s   					(   R0   R   t
   contextlibR    t   pip._vendor.cachecontrol.cacheR   t   pip._vendor.cachecontrol.cachesR   t   pip._vendor.requests.modelsR   t   pip._internal.utils.filesystemR   R   t   pip._internal.utils.miscR   t   pip._internal.utils.typingR   t   typingR   R	   R   R   R   (    (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/cache.pyt   <module>   s   	