
{Udc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 m Z m Z m Z d d l m Z d d l m Z m 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 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( m) Z) m* Z* d d l+ m, Z, d d l- m. Z. e, rd d l/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 d d l5 m6 Z6 e3 e7 e7 e2 e4 e8 e7 f f Z9 n  e j: e;  Z< e	 j= d d e d+ d, d- d. d/ d0 g Z? d1 Z@ d!   ZA d"   ZB d# e f d$     YZC d% e f d&     YZD d' e f d(     YZE d) e jF f d*     YZG d S(2   sh   PipSession and supporting code, containing all pip-specific
network request configuration and behavior.
iN(   t   requestst   sixt   urllib3(   t   CacheControlAdapter(   t   BaseAdaptert   HTTPAdapter(   t   Response(   t   CaseInsensitiveDict(   t   parse(   t   InsecureRequestWarning(   t   __version__(   t   MultiDomainBasicAuth(   t   SafeFileCache(   t   has_tlst	   ipaddress(   t   libc_ver(   t   build_url_from_netloct   get_installed_versiont   parse_netloc(   t   MYPY_CHECK_RUNNING(   t   url_to_path(   t   Iteratort   Listt   Optionalt   Tuplet   Union(   t   Linkt   ignoret   categoryt   httpst   *t	   localhosts   127.0.0.0/8s   ::1/128t   filet   ssht   BUILD_BUILDIDt   BUILD_IDt   CIt	   PIP_IS_CIc           C   s   t  d   t D  S(   s?   
    Return whether it looks like pip is running under CI.
    c         s   s   |  ] } | t  j k Vq d  S(   N(   t   ost   environ(   t   .0t   name(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pys	   <genexpr>_   s    (   t   anyt   CI_ENVIRONMENT_VARIABLES(    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   looks_like_ciW   s    c    	   
   C   sI  i i d d 6t  d 6d 6t j   d 6i t j   d 6d 6}  |  d d d k rg t j   |  d d <n |  d d d k r t j j d	 k r t j d
  } n	 t j } d j g  | D] } t |  ^ q  |  d d <nV |  d d d k rt j   |  d d <n+ |  d d d k r/t j   |  d d <n  t j j	 d  rd d l
 m } t t d   t d d d g | j      } t t d   t d d g t      } | r| | d <n  | r| |  d <qn  t j j	 d  rt j   d ri d d 6t j   d d 6|  d <n  t j   rFt j   |  j d i   d <n  t j   rqt j   |  j d i   d <n  t j   rt j   |  d <n  t   rd d l } | j |  d <n  t d  } | d k	 r| |  d  <n  t   rt n d |  d! <t j j d"  } | d k	 r| |  d# <n  d$ j  d% |  d& t! j" |  d' d+ d* t  S(,   s6   
    Return a string representing the user agent.
    t   pipR)   t   versiont	   installert   pythont   implementationt   CPythont   PyPyt   finali   t   .t   Jythont
   IronPythont   linuxi(   t   distroc         S   s   |  d S(   Ni   (    (   t   x(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   <lambda>   t    t   idc         S   s   |  d S(   Ni   (    (   R:   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR;      R<   t   libt   libcR9   t   darwini    t   macOSt   systemt   releaset   cpuNt   openssl_versiont
   setuptoolst   setuptools_versiont   cit   PIP_USER_AGENT_USER_DATAt	   user_datas9   {data[installer][name]}/{data[installer][version]} {json}t   datat   jsont
   separatorst   ,t   :t	   sort_keys(   RN   RO   (#   R
   t   platformt   python_versiont   python_implementationt   syst   pypy_version_infot   releaselevelt   joint   strt
   startswitht   pip._vendorR9   t   dictt   filtert   zipt   linux_distributionR   t   mac_verRB   t
   setdefaultRC   t   machineR   t   _sslt   OPENSSL_VERSIONR   t   NoneR,   t   TrueR&   R'   t   gett   formatRL   t   dumps(	   RK   RU   R:   R9   t   distro_infosR?   t   sslRG   RJ   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt
   user_agentb   sd    	-$"%		t   LocalFSAdapterc           B   s)   e  Z d d d d d d   Z d   Z RS(   c         C   s   t  | j  } t   } d | _ | j | _ y t j |  }	 Wn% t k
 rg }
 d | _ |
 | _ n} Xt j	 j
 |	 j d t } t j |  d p d } t i | d 6|	 j d 6| d 6 | _ t | d	  | _ | j j | _ | S(
   Ni   i  t   usegmti    s
   text/plains   Content-Types   Content-Lengths   Last-Modifiedt   rb(   R   t   urlR   t   status_codeR&   t   statt   OSErrort   rawt   emailt   utilst
   formatdatet   st_mtimeRe   t	   mimetypest
   guess_typeR   t   st_sizet   headerst   opent   close(   t   selft   requestt   streamt   timeoutt   verifyt   certt   proxiest   pathnamet   respt   statst   exct   modifiedt   content_type(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   send   s$    			
c         C   s   d  S(   N(    (   R~   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR}      s    N(   t   __name__t
   __module__Rd   R   R}   (    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyRl      s   t   InsecureHTTPAdapterc           B   s   e  Z d    Z RS(   c      	   C   s/   t  t |   j d | d | d t d |  d  S(   Nt   connRo   R   R   (   t   superR   t   cert_verifyt   False(   R~   R   Ro   R   R   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s    (   R   R   R   (    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s   t   InsecureCacheControlAdapterc           B   s   e  Z d    Z RS(   c      	   C   s/   t  t |   j d | d | d t d |  d  S(   NR   Ro   R   R   (   R   R   R   R   (   R~   R   Ro   R   R   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s    (   R   R   R   (    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s   t
   PipSessionc           B   sJ   e  Z d Z d    Z d   Z d e d  Z d   Z d   Z	 d   Z
 RS(   c   
      O   sz  | j  d d  } | j  d d  } | j  d g   } | j  d d  } t t |   j | |   g  |  _ t   |  j d <t d |  |  _	 t
 j d | d d	 d
 d d g d d  } t d |  } | rt d t |  d |  } t d t |  d |  |  _ n t d |  } | |  _ |  j d |  |  j d |  |  j d t    x! | D] }	 |  j |	 d t qYWd S(   sj   
        :param trusted_hosts: Domains not to emit warnings for when not using
            HTTPS.
        t   retriesi    t   cachet   trusted_hostst
   index_urlss
   User-Agentt   totalt   status_forcelisti  i  i  i  t   backoff_factorg      ?t   max_retriess   https://s   http://s   file://t   suppress_loggingN(   t   popRd   R   R   t   __init__t   pip_trusted_originsRk   R{   R   t   authR   t   RetryR   R   R   R   t   _trusted_host_adapterR   t   mountRl   t   add_trusted_hostRe   (
   R~   t   argst   kwargsR   R   R   R   t   insecure_adaptert   secure_adaptert   host(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s6    					c         C   s   | |  j  _ d S(   sn   
        :param new_index_urls: New index urls to update the authentication
            handler with.
        N(   R   R   (   R~   t   new_index_urls(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   update_index_urls3  s    c         C   s   | sG d j  |  } | d k	 r7 | d j  |  7} n  t j |  n  t |  } | |  j k ru |  j j |  n  |  j t |  d |  j	  | d s |  j t |  d |  j	  n  d S(   s   
        :param host: It is okay to provide a host that has previously been
            added.
        :param source: An optional source string, for logging where the host
            string came from.
        s   adding trusted host: {!r}s
    (from {})t   /i   RO   N(
   Rg   Rd   t   loggert   infoR   R   t   appendR   R   R   (   R~   R   t   sourceR   t   msgt	   host_port(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR   ;  s    

c         c   sT   x t  D] } | Vq Wx7 |  j D], \ } } d | | d  k rD d n | f Vq  Wd  S(   NR   (   t   SECURE_ORIGINSR   Rd   (   R~   t   secure_originR   t   port(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   iter_secure_originsX  s    	c         C   sj  t  j t |   } | j | j | j } } } | j d d  d } x|  j   D] } | \ } } }	 | | k r | d k r qU n  yF t j	 | d  k r d  n t j |   }
 t j t j |   } WnA t k
 r| r$| j   | j   k r$| d k r$qU q$n X|
 | k r$qU n  | |	 k rN|	 d k rN|	 d  k	 rNqU n  t SWt j d | |  t S(   Nt   +i   iR   s   The repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.(   t   urllib_parset   urlparseRX   t   schemet   hostnameR   t   rsplitR   R   t
   ip_addressRd   R   t   ensure_textt
   ip_networkt
   ValueErrort   lowerRe   R   t   warningR   (   R~   t   locationt   parsedt   origin_protocolt   origin_hostt   origin_portR   t   secure_protocolt   secure_hostt   secure_portt   addrt   network(    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   is_secure_origin_  s<    
c         O   s2   | j  d |  j  t t |   j | | | |  S(   NR   (   R`   R   R   R   R   (   R~   t   methodRo   R   R   (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR     s    N(   R   R   Rd   R   R   R   R   R   R   R   R   (    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyR      s   	L			H(   R   R   R   (   R   R   R   (   R   s   127.0.0.0/8R   (   R   s   ::1/128R   (   R    R   N(   R!   R   R   (   R"   R#   R$   R%   (H   t   __doc__t   email.utilsRt   RL   t   loggingRx   R&   RQ   RT   t   warningsRZ   R    R   R   t   pip._vendor.cachecontrolR   t   pip._vendor.requests.adaptersR   R   t   pip._vendor.requests.modelsR   t   pip._vendor.requests.structuresR   t   pip._vendor.six.moves.urllibR   R   t   pip._vendor.urllib3.exceptionsR	   R-   R
   t   pip._internal.network.authR   t   pip._internal.network.cacheR   t   pip._internal.utils.compatR   R   t   pip._internal.utils.glibcR   t   pip._internal.utils.miscR   R   R   t   pip._internal.utils.typingR   t   pip._internal.utils.urlsR   t   typingR   R   R   R   R   t   pip._internal.models.linkR   RX   t   intt   SecureOrigint	   getLoggerR   R   t   filterwarningsRd   R   R+   R,   Rk   Rl   R   R   t   SessionR   (    (    (    sk   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/session.pyt   <module>   sZ   ($	   		P!