ó
^\kdc           @   s]  d  d l  Z  d  d l m Z d  d l Z d  d l Z d  d l m 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 Z d  d l Z d  d l Z d  d l Z d  d l Z y d  d l Z Wn e k
 rd  d l Z n Xd  d l Z d d l m Z d d l m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z' m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z- m. Z. m/ Z/ e
 j0 e1 ƒ Z2 d Z3 e j4 e3 ƒ Z5 d Z6 d	 e6 d
 Z7 e6 d Z8 d Z9 d e9 d e8 d e3 d e9 d e8 d Z: d Z; d e: d e; d e: d Z< e7 d e3 e7 d Z= d e= d Z> d e6 d e> d e< d Z? e j4 e? ƒ Z@ d e9 d e8 d
 ZA e j4 eA ƒ ZB d „  ZC d  „  ZD d! „  ZE d" „  ZF d d d# „ ZH d$ „  ZI d% „  ZJ d& „  ZK e jL d' „  ƒ ZM e jL d( „  ƒ ZN e jL d) d* „ ƒ ZO d+ eP f d, „  ƒ  YZQ d- „  ZR d. eP f d/ „  ƒ  YZS d0 „  ZT d1 eP f d2 „  ƒ  YZU e j4 d3 e jV ƒ ZW d4 „  ZX d d5 „ ZY d6 „  ZZ d7 „  Z[ d8 „  Z\ d9 „  Z] d: „  Z^ e j4 d; e j_ ƒ Z` e j4 d< ƒ Za d d= „ Zb e j4 d> ƒ Zc d? „  Zd d@ „  Ze dA „  Zf dB „  Zg dC „  Zh dD eP f dE „  ƒ  YZi dF eP f dG „  ƒ  YZj d{ Zk d el dO „ Zm dP „  Zn d| Zo dW eP f dX „  ƒ  YZp e j4 dY ƒ Zq e j4 dZ ƒ Zr e j4 d[ ƒ Zs d\ „  Z d] „  Zt d^ e" ju f d_ „  ƒ  YZu d` e' f da „  ƒ  YZ& db e& e% f dc „  ƒ  YZv e jw dd  Zx ex d} k r—df e" jy f dg „  ƒ  YZy dh e" jz f di „  ƒ  YZz n  dj e# j{ f dk „  ƒ  YZ{ dl e# j| f dm „  ƒ  YZ| dn e# j} f do „  ƒ  YZ} dp „  Z~ dq eP f dr „  ƒ  YZ ds e f dt „  ƒ  YZ€ du e f dv „  ƒ  YZ� dw e( f dx „  ƒ  YZ‚ dy eP f dz „  ƒ  YZƒ d S(~   iÿÿÿÿN(   t   deque(   t   iglobi   (   t   DistlibException(   t   string_typest	   text_typet   shutilt	   raw_inputt   StringIOt   cache_from_sourcet   urlopent   httplibt	   xmlrpclibt	   splittypet   HTTPHandlert   HTTPSHandlert   BaseConfiguratort   valid_identt	   Containert   configparsert   URLErrort   match_hostnamet   CertificateErrort   ZipFiles   \s*,\s*s
   (\w|[.-])+s   (\*|:(\*|\w+):|t   )s   \*?s   ([<>=!~]=)|[<>]t   (s   )?\s*(s   )(s   )\s*(s   ))*s   (from\s+(?P<diref>.*))s   \(\s*(?P<c1>t   |s   )\s*\)|(?P<c2>s   \s*)s   )*s   \[\s*(?P<ex>s   )?\s*\]s   (?P<dn>s	   \s*)?(\s*s   )?$s   (?P<op>s   )\s*(?P<vn>c         C   sk  d „  } d  } t j |  ƒ } | rg| j ƒ  } | d } | d pK | d } | d sa d  } n d  } | d j ƒ  } | s– d  } d } | d }	 n{ | d d k r³ d	 | } n  t j | ƒ }
 g  |
 D] } | | ƒ ^ qÉ } d
 | d j g  | D] } d | ^ qô ƒ f }	 | d s$d  } n t j	 | d ƒ } t
 d | d | d | d |	 d |  d | ƒ } n  | S(   Nc         S   s   |  j  ƒ  } | d | d f S(   Nt   opt   vn(   t	   groupdict(   t   mt   d(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_constraintT   s    t   dnt   c1t   c2t   direft    i    s   <>!=s   ~=s   %s (%s)s   , s   %s %st   ext   namet   constraintst   extrast   requirementt   sourcet   url(   t   Nonet   REQUIREMENT_REt   matchR   t   stript   RELOP_IDENT_REt   finditert   joint   COMMA_REt   splitR   (   t   sR   t   resultR   R   R&   t   consR+   t   constrt   rst   iteratort   conR(   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   parse_requirementR   s4    	

	0
	c         C   sõ   d „  } i  } xß | D]× \ } } } t  j j |  | ƒ } x° t | ƒ D]¢ } t  j j | | ƒ }	 x„ t |	 ƒ D]v }
 | |  |
 ƒ } | d k r£ | j | d ƒ qo | | |
 ƒ } | j t  j j d ƒ j d ƒ } | d | | | <qo WqG Wq W| S(   s%   Find destinations for resources filesc         S   s\   |  j  t j j d ƒ }  | j  t j j d ƒ } | j |  ƒ sE t ‚ | t |  ƒ j d ƒ S(   Nt   /(   t   replacet   ost   patht   sept
   startswitht   AssertionErrort   lent   lstrip(   t   baseR@   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_rel_pathz   s    R=   N(	   R?   R@   R2   R   R,   t   popR>   RA   t   rstrip(   t   resources_roott   rulesRG   t   destinationsRF   t   suffixt   destt   prefixt   abs_baset   abs_globt   abs_patht   resource_filet   rel_patht   rel_dest(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_resources_destsw   s    	!c          C   s:   t  t d ƒ r t }  n t j t t d t j ƒ k }  |  S(   Nt   real_prefixt   base_prefix(   t   hasattrt   syst   TrueRO   t   getattr(   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   in_venv’   s    	c          C   s;   t  j d k r. d t j k r. t j d }  n	 t  j }  |  S(   Nt   darwint   __VENV_LAUNCHER__(   RZ   t   platformR?   t   environt
   executable(   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_executableœ   s
    	c         C   s„   |  } xw t  r t | ƒ } |  } | r7 | r7 | } n  | r	 | d j ƒ  } | | k r] Pn  | r| d | | |  f } q| q	 q	 W| S(   Ni    s	   %c: %s
%s(   R[   R   t   lower(   t   promptt   allowed_charst   error_promptt   defaultt   pR5   t   c(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   proceed¥   s    		c         C   sV   t  | t ƒ r | j ƒ  } n  i  } x+ | D]# } | |  k r+ |  | | | <q+ q+ W| S(   N(   t
   isinstanceR   R4   (   R   t   keysR6   t   key(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   extract_by_keyµ   s    c         C   s¹  t  j d d k r+ t j d ƒ |  ƒ }  n  |  j ƒ  } t | ƒ }  y“ t j |  ƒ } | d } xo | j ƒ  D]a \ } } xR | j ƒ  D]D \ } } d | | f } t	 | ƒ } | d  k	 s¿ t ‚ | | | <q… Wql W| SWn! t k
 rù |  j d d ƒ n Xt j ƒ  }	 t |	 d ƒ r%|	 j |  ƒ n |	 j |  ƒ i  } xz |	 j ƒ  D]l }
 i  | |
 <} xU |	 j |
 ƒ D]D \ } } d | | f } t	 | ƒ } | d  k	 s£t ‚ | | | <qiWqEW| S(   Ni    i   s   utf-8t   exportss   %s = %st	   read_file(   RZ   t   version_infot   codecst	   getreadert   readR   t   jsont   loadt   itemst   get_export_entryR,   RC   t	   Exceptiont   seekR   t   ConfigParserRY   Rq   t   readfpt   sections(   t   streamt   dataR6   t   groupt   entriest   kt   vR5   t   entryt   cpRn   R&   t   value(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   read_exports¾   s:    
c         C   sø   t  j d d k r+ t j d ƒ | ƒ } n  t j ƒ  } x­ |  j ƒ  D]Ÿ \ } } | j | ƒ xƒ | j ƒ  D]u } | j	 d  k r‹ | j } n d | j | j	 f } | j rÉ d | d j | j ƒ f } n  | j | | j | ƒ qj WqD W| j | ƒ d  S(   Ni    i   s   utf-8s   %s:%ss   %s [%s]s   , (   RZ   Rr   Rs   t	   getwriterR   R|   Rx   t   add_sectiont   valuesRM   R,   RO   t   flagsR2   t   setR&   t   write(   Rp   R   R†   Rƒ   R„   R…   R5   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   write_exportsâ   s    	c          c   s*   t  j ƒ  }  z	 |  VWd  t j |  ƒ Xd  S(   N(   t   tempfilet   mkdtempR   t   rmtree(   t   td(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   tempdirõ   s    	c         c   s7   t  j ƒ  } z t  j |  ƒ d  VWd  t  j | ƒ Xd  S(   N(   R?   t   getcwdt   chdir(   R   t   cwd(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR–   ý   s
    	i   c         c   s7   t  j ƒ  } z t  j |  ƒ d  VWd  t  j | ƒ Xd  S(   N(   t   sockett   getdefaulttimeoutt   setdefaulttimeout(   t   secondst   cto(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   socket_timeout  s
    	t   cached_propertyc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s   | |  _  d  S(   N(   t   func(   t   selfRŸ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __init__  s    c         C   s<   | d  k r |  S|  j | ƒ } t j | |  j j | ƒ | S(   N(   R,   RŸ   t   objectt   __setattr__t   __name__(   R    t   objt   clsR‡   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __get__  s
    N(   R¤   t
   __module__R¡   R,   R§   (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRž     s   	c         C   sµ   t  j d k r |  S|  s |  S|  d d k r@ t d |  ƒ ‚ n  |  d d k rc t d |  ƒ ‚ n  |  j d ƒ } x# t  j | k r— | j t  j ƒ qu W| s¥ t  j St  j j | Œ  S(   sÐ  Return 'pathname' as a name that will work on the native filesystem.

    The path is split on '/' and put back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    R=   i    s   path '%s' cannot be absoluteiÿÿÿÿs   path '%s' cannot end with '/'(   R?   RA   t
   ValueErrorR4   t   curdirt   removeR@   R2   (   t   pathnamet   paths(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   convert_path  s    
t   FileOperatorc           B   sª   e  Z e d  „ Z d „  Z d „  Z d „  Z e d „ Z d d „ Z
 d „  Z d „  Z d „  Z d	 „  Z d
 „  Z e e d d „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s#   | |  _  t ƒ  |  _ |  j ƒ  d  S(   N(   t   dry_runR�   t   ensuredt   _init_record(   R    R°   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   ;  s    	c         C   s%   t  |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   t   Falset   recordR�   t   files_writtent   dirs_created(   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR²   @  s    	c         C   s    |  j  r |  j j | ƒ n  d  S(   N(   R´   Rµ   t   add(   R    R@   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   record_as_writtenE  s    	c         C   si   t  j j | ƒ s1 t d t  j j | ƒ ƒ ‚ n  t  j j | ƒ sG t St  j | ƒ j t  j | ƒ j k S(   sÎ  Tell if the target is newer than the source.

        Returns true if 'source' exists and is more recently modified than
        'target', or if 'source' exists and 'target' doesn't.

        Returns false if both exist and 'target' is the same age or younger
        than 'source'. Raise PackagingFileError if 'source' does not exist.

        Note that this test is not very accurate: files created in the same
        second will have the same "age".
        s   file '%r' does not exist(   R?   R@   t   existsR   t   abspathR[   t   statt   st_mtime(   R    R*   t   target(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   newerI  s    c         C   sÒ   |  j  t j j | ƒ ƒ t j d | | ƒ |  j sÁ d } | r• t j j | ƒ r` d | } q• t j j	 | ƒ r• t j j
 | ƒ r• d | } q• n  | r® t | d ƒ ‚ n  t j | | ƒ n  |  j | ƒ d S(   s8   Copy a file respecting dry-run and force flags.
        s   Copying %s to %ss   %s is a symlinks   %s is a non-regular files    which would be overwrittenN(   t
   ensure_dirR?   R@   t   dirnamet   loggert   infoR°   R,   t   islinkR¹   t   isfileR©   R   t   copyfileR¸   (   R    t   infilet   outfilet   checkt   msg(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   copy_file]  s    	%c         C   sº   t  j j | ƒ s t ‚ |  j t  j j | ƒ ƒ t j d | | ƒ |  j s© | d  k rl t
 | d ƒ } n t j
 | d d | ƒ} z t j | | ƒ Wd  | j ƒ  Xn  |  j | ƒ d  S(   Ns   Copying stream %s to %st   wbt   wt   encoding(   R?   R@   t   isdirRC   R¿   RÀ   RÁ   RÂ   R°   R,   t   openRs   R   t   copyfileobjt   closeR¸   (   R    t   instreamRÇ   RÍ   t	   outstream(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   copy_streamn  s    	c         C   s[   |  j  t j j | ƒ ƒ |  j sJ t | d ƒ � } | j | ƒ Wd  QXn  |  j | ƒ d  S(   NRË   (   R¿   R?   R@   RÀ   R°   RÏ   RŽ   R¸   (   R    R@   R€   t   f(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   write_binary_file}  s
    	c         C   sd   |  j  t j j | ƒ ƒ |  j sS t | d ƒ � } | j | j | ƒ ƒ Wd  QXn  |  j | ƒ d  S(   NRË   (	   R¿   R?   R@   RÀ   R°   RÏ   RŽ   t   encodeR¸   (   R    R@   R€   RÍ   RÕ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   write_text_file„  s
    	c         C   s€   t  j d k r| xj | D]_ } |  j r8 t j d | ƒ q t  j | ƒ j | B| @} t j d | | ƒ t  j | | ƒ q Wn  d  S(   Nt   posixs   changing mode of %ss   changing mode of %s to %o(   R?   R&   R°   RÁ   RÂ   R»   t   st_modet   chmod(   R    t   bitst   maskt   filesRÕ   t   mode(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   set_mode‹  s    	c         C   s   |  j  d d | ƒ S(   Nim  iÿ  (   Rà   (   R5   RÕ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   <lambda>—  s    c         C   s¶   t  j j | ƒ } | |  j k r² t  j j | ƒ r² |  j j | ƒ t  j j | ƒ \ } } |  j | ƒ t j	 d | ƒ |  j
 s“ t  j | ƒ n  |  j r² |  j j | ƒ q² n  d  S(   Ns   Creating %s(   R?   R@   Rº   R±   R¹   R·   R4   R¿   RÁ   RÂ   R°   t   mkdirR´   R¶   (   R    R@   R   RÕ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¿   ™  s    "		c         C   s¥   t  | | ƒ } t j d | | ƒ |  j s” | sD |  j | | ƒ r{ | sS d  } q{ | j | ƒ sh t ‚ | t | ƒ } n  t	 j
 | | | t ƒ n  |  j | ƒ | S(   Ns   Byte-compiling %s to %s(   R   RÁ   RÂ   R°   R¾   R,   RB   RC   RD   t
   py_compilet   compileR[   R¸   (   R    R@   t   optimizet   forceRO   t   dpatht   diagpath(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   byte_compile¥  s    		c         C   s  t  j j | ƒ rt  j j | ƒ r‘ t  j j | ƒ r‘ t j d | ƒ |  j s` t j	 | ƒ n  |  j
 r| |  j k rŽ |  j j | ƒ qŽ qqt  j j | ƒ r¬ d } n d } t j d | | ƒ |  j sÞ t  j | ƒ n  |  j
 r| |  j k r|  j j | ƒ qqn  d  S(   Ns   Removing directory tree at %st   linkt   files   Removing %s %s(   R?   R@   R¹   RÎ   RÃ   RÁ   t   debugR°   R   R’   R´   R¶   R«   Rµ   (   R    R@   R5   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   ensure_removed³  s"    %					c         C   sj   t  } x] | se t j j | ƒ r: t j | t j ƒ } Pn  t j j | ƒ } | | k r\ Pn  | } q	 W| S(   N(   R³   R?   R@   R¹   t   accesst   W_OKRÀ   (   R    R@   R6   t   parent(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   is_writableÈ  s    	
c         C   s/   |  j  s t ‚ |  j |  j f } |  j ƒ  | S(   sV   
        Commit recorded changes, turn off recording, return
        changes.
        (   R´   RC   Rµ   R¶   R²   (   R    R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   commitÔ  s    
c         C   sÜ   |  j  sÎ x9 t |  j ƒ D]( } t j j | ƒ r t j | ƒ q q Wt |  j d t	 ƒ} xq | D]f } t j
 | ƒ } | rº | d g k s‘ t ‚ t j j | | d ƒ } t j | ƒ n  t j | ƒ qa Wn  |  j ƒ  d  S(   Nt   reverset   __pycache__i    (   R°   t   listRµ   R?   R@   R¹   R«   t   sortedR¶   R[   t   listdirRC   R2   t   rmdirR²   (   R    RÕ   t   dirsR   t   flistt   sd(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   rollbackÞ  s    	N(   R¤   R¨   R³   R¡   R²   R¸   R¾   R[   RÊ   R,   RÔ   RÖ   RØ   Rà   t   set_executable_modeR¿   Ré   Rí   Rñ   Rò   Rü   (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¯   :  s    											
c         C   s‹   |  t  j k r t  j |  } n t |  ƒ } | d  k r@ | } nG | j d ƒ } t | | j d ƒ ƒ } x | D] } t | | ƒ } qn W| S(   Nt   .i    (   RZ   t   modulest
   __import__R,   R4   R\   RH   (   t   module_namet   dotted_patht   modR6   t   partsRi   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   resolveð  s    	t   ExportEntryc           B   s;   e  Z d  „  Z e d „  ƒ Z d „  Z d „  Z e j Z RS(   c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   R&   RO   RM   RŒ   (   R    R&   RO   RM   RŒ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡      s    			c         C   s   t  |  j |  j ƒ S(   N(   R  RO   RM   (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR‡     s    c         C   s    d |  j  |  j |  j |  j f S(   Ns   <ExportEntry %s = %s:%s %s>(   R&   RO   RM   RŒ   (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __repr__
  s    c         C   sd   t  | t ƒ s t } nH |  j | j k o] |  j | j k o] |  j | j k o] |  j | j k } | S(   N(   Rl   R  R³   R&   RO   RM   RŒ   (   R    t   otherR6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __eq__  s    	(	   R¤   R¨   R¡   Rž   R‡   R  R	  R¢   t   __hash__(    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  ÿ  s
   			
s´   (?P<name>(\w|[-.])+)
                      \s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
                      \s*(\[\s*(?P<flags>\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
                      c         C   sS  t  j |  ƒ } | sI d  } d |  k s3 d |  k rOt d |  ƒ ‚ qOn| j ƒ  } | d } | d } | j d ƒ } | d k r” | d  } } n4 | d k r³ t d |  ƒ ‚ n  | j d ƒ \ } } | d	 }	 |	 d  k rd |  k sö d |  k r	t d |  ƒ ‚ n  g  }	 n( g  |	 j d
 ƒ D] }
 |
 j ƒ  ^ q"}	 t | | | |	 ƒ } | S(   Nt   [t   ]s   Invalid specification %rR&   t   callablet   :i    i   RŒ   t   ,(	   t   ENTRY_REt   searchR,   R   R   t   countR4   R/   R  (   t   specificationR   R6   R   R&   R@   t   colonsRO   RM   RŒ   RÕ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRy   !  s2    


	(c         C   s"  |  d
 k r d }  n  t j d k rH d t j k rH t j j d ƒ } n t j j d ƒ } t j j | |  ƒ } t j j | ƒ r² t j	 | t j
 ƒ } | sù t j d | ƒ qù nG y t j | ƒ t } Wn- t k
 rø t j d | d t ƒt } n X| st j ƒ  } t j d	 | ƒ n  | S(   s¦  
    Return the default base location for distlib caches. If the directory does
    not exist, it is created. Use the suffix provided for the base directory,
    and default to '.distlib' if it isn't provided.

    On Windows, if LOCALAPPDATA is defined in the environment, then it is
    assumed to be a directory, and will be the parent directory of the result.
    On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home
    directory - using os.expanduser('~') - will be the parent directory of
    the result.

    The result is just the directory '.distlib' in the parent directory as
    determined above, or with the name specified with ``suffix``.
    s   .distlibt   ntt   LOCALAPPDATAs   $localappdatat   ~s(   Directory exists but is not writable: %ss   Unable to create %st   exc_infos#   Default location unusable, using %sN(   R,   R?   R&   Ra   R@   t
   expandvarst
   expanduserR2   RÎ   Rî   Rï   RÁ   t   warningt   makedirsR[   t   OSErrorR³   R�   R‘   (   RM   R6   t   usable(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_cache_base@  s(    	

c         C   s`   t  j j t  j j |  ƒ ƒ \ } } | r? | j d d ƒ } n  | j t  j d ƒ } | | d S(   s  
    Convert an absolute path to a directory name for use in a cache.

    The algorithm used is:

    #. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
    #. Any occurrence of ``os.sep`` is replaced with ``'--'``.
    #. ``'.cache'`` is appended.
    R  s   ---s   --s   .cache(   R?   R@   t
   splitdriveRº   R>   RA   (   R@   R   Ri   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   path_to_cache_dirj  s
    
$c         C   s   |  j  d ƒ s |  d S|  S(   NR=   (   t   endswith(   R5   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   ensure_slash{  s    c         C   sk   d  } } d |  k r^ |  j d d ƒ \ } }  d | k rC | } q^ | j d d ƒ \ } } n  | | |  f S(   Nt   @i   R  (   R,   R4   (   t   netloct   usernamet   passwordRO   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   parse_credentials�  s    
	c          C   s    t  j d ƒ }  t  j |  ƒ |  S(   Ni   (   R?   t   umask(   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_process_umaskŒ  s    c         C   sX   t  } d  } x3 t |  ƒ D]% \ } } t | t ƒ s t } Pq q W| d  k	 sT t ‚ | S(   N(   R[   R,   t	   enumerateRl   R   R³   RC   (   t   seqR6   t   iR5   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   is_string_sequence‘  s    s3   ([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)s   -py(\d\.?\d?)c         C   s  d } d } t j |  ƒ } | rC | j d ƒ } |  | j ƒ   }  n  | r· t |  ƒ t | ƒ d k r· t j t j | ƒ d |  ƒ } | r· | j	 ƒ  } |  |  |  | d | f } q· n  | d k rÿ t
 j |  ƒ } | rÿ | j d ƒ | j d ƒ | f } qÿ n  | S(   sw   
    Extract name, version, python version from a filename (no extension)

    Return name, version, pyver or None
    i   s   \bi   N(   R,   t   PYTHON_VERSIONR  R�   t   startRD   t   reR.   t   escapet   endt   PROJECT_NAME_AND_VERSION(   t   filenamet   project_nameR6   t   pyverR   t   n(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   split_filename   s     "!'s-   (?P<name>[\w .-]+)\s*\(\s*(?P<ver>[^\s)]+)\)$c         C   sR   t  j |  ƒ } | s( t d |  ƒ ‚ n  | j ƒ  } | d j ƒ  j ƒ  | d f S(   sÇ   
    A utility method used to get name and version from a string.

    From e.g. a Provides-Dist value.

    :param p: A value in a form 'foo (1.0)'
    :return: The name and version as a tuple.
    s$   Ill-formed name/version string: '%s'R&   t   ver(   t   NAME_VERSION_RER.   R   R   R/   Rd   (   Ri   R   R   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   parse_name_and_version»  s
    	c         C   s	  t  ƒ  } t  |  p g  ƒ }  t  | p' g  ƒ } d |  k rS |  j d ƒ | | O} n  x¯ |  D]§ } | d k r| | j | ƒ qZ | j d ƒ rÔ | d } | | k rµ t j d | ƒ n  | | k r| j | ƒ qqZ | | k rô t j d | ƒ n  | j | ƒ qZ W| S(   Nt   *t   -i   s   undeclared extra: %s(   R�   R«   R·   RB   RÁ   R  (   t	   requestedt	   availableR6   t   rt   unwanted(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt
   get_extrasÊ  s&    	
c         C   s˜   i  } ye t  |  ƒ } | j ƒ  } | j d ƒ d k rF t j d ƒ n$ t j d ƒ | ƒ } t j | ƒ } Wn& t	 k
 r“ } t j
 d |  | ƒ n X| S(   Ns   Content-Types   application/jsons$   Unexpected response for JSON requests   utf-8s&   Failed to get external data for %s: %s(   R	   RÂ   t   getRÁ   Rì   Rs   Rt   Rv   Rw   Rz   t	   exception(   R+   R6   t   respt   headerst   readert   e(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   _get_external_dataã  s    c         C   s*   d |  d j  ƒ  |  f } t | ƒ } | S(   Ns9   https://www.red-dove.com/pypi/projects/%s/%s/project.jsoni    (   t   upperRJ  (   R&   R+   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_project_data÷  s    c         C   s'   d |  d j  ƒ  |  | f } t | ƒ S(   Ns<   https://www.red-dove.com/pypi/projects/%s/%s/package-%s.jsoni    (   RK  RJ  (   R&   t   versionR+   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_package_dataý  s    t
   EventMixinc           B   s>   e  Z d  Z d „  Z e d „ Z d „  Z d „  Z d „  Z RS(   s1   
    A very simple publish/subscribe system.
    c         C   s   i  |  _  d  S(   N(   t   _subscribers(   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡     s    c         C   s\   |  j  } | | k r+ t | g ƒ | | <n- | | } | rK | j | ƒ n | j | ƒ d S(   s`  
        Add a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be added (and called when the
                           event is published).
        :param append: Whether to append or prepend the subscriber to an
                       existing subscriber list for the event.
        N(   RP  R    t   appendt
   appendleft(   R    t   eventt
   subscriberRQ  t   subst   sq(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR·   
  s    
	
c         C   s=   |  j  } | | k r( t d | ƒ ‚ n  | | j | ƒ d S(   s™   
        Remove a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be removed.
        s   No subscribers: %rN(   RP  R©   R«   (   R    RS  RT  RU  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR«     s    	c         C   s   t  |  j j | d ƒ ƒ S(   s�   
        Return an iterator for the subscribers for an event.
        :param event: The event to return subscribers for.
        (    (   t   iterRP  RD  (   R    RS  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   get_subscribers*  s    c         O   s‡   g  } xa |  j  | ƒ D]P } y | | | | Ž } Wn$ t k
 rX t j d ƒ d } n X| j | ƒ q Wt j d | | | | ƒ | S(   s^  
        Publish a event and return a list of values returned by its
        subscribers.

        :param event: The event to publish.
        :param args: The positional arguments to pass to the event's
                     subscribers.
        :param kwargs: The keyword arguments to pass to the event's
                       subscribers.
        s"   Exception during event publications/   publish %s: args = %s, kwargs = %s, result = %sN(   RX  Rz   RÁ   RE  R,   RQ  Rì   (   R    RS  t   argst   kwargsR6   RT  R‡   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   publish1  s    
	(	   R¤   R¨   t   __doc__R¡   R[   R·   R«   RX  R[  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRO    s   			t	   Sequencerc           B   sh   e  Z d  „  Z d „  Z e d „ Z d „  Z d „  Z d „  Z d „  Z	 e
 d „  ƒ Z e
 d „  ƒ Z RS(	   c         C   s"   i  |  _  i  |  _ t ƒ  |  _ d  S(   N(   t   _predst   _succsR�   t   _nodes(   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   L  s    		c         C   s   |  j  j | ƒ d  S(   N(   R`  R·   (   R    t   node(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   add_nodeQ  s    c         C   s  | |  j  k r" |  j  j | ƒ n  | r	x3 t |  j j | d ƒ ƒ D] } |  j | | ƒ qD Wx3 t |  j j | d ƒ ƒ D] } |  j | | ƒ qz Wx6 t |  j j ƒ  ƒ D] \ } } | sª |  j | =qª qª Wx9 t |  j j ƒ  ƒ D] \ } } | sã |  j | =qã qã Wn  d  S(   N(    (    (   R`  R«   R�   R^  RD  R_  Rõ   Rx   (   R    Ra  t   edgesRi   R5   Rƒ   R„   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   remove_nodeT  s    """"c         C   sT   | | k s t  ‚ |  j j | t ƒ  ƒ j | ƒ |  j j | t ƒ  ƒ j | ƒ d  S(   N(   RC   R^  t
   setdefaultR�   R·   R_  (   R    t   predt   succ(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR·   d  s    c         C   s    | | k s t  ‚ y |  j | } |  j | } Wn! t k
 rS t d | ƒ ‚ n Xy | j | ƒ | j | ƒ Wn' t k
 r› t d | | f ƒ ‚ n Xd  S(   Ns   %r not a successor of anythings   %r not a successor of %r(   RC   R^  R_  t   KeyErrorR©   R«   (   R    Rf  Rg  t   predst   succs(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR«   i  s    c         C   s+   | |  j  k p* | |  j k p* | |  j k S(   N(   R^  R_  R`  (   R    t   step(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   is_stepv  s    c         C   sÞ   |  j  | ƒ s" t d | ƒ ‚ n  g  } g  } t ƒ  } | j | ƒ x� | rÓ | j d ƒ } | | k r” | | k rÐ | j | ƒ | j | ƒ qÐ qG | j | ƒ | j | ƒ |  j j | d ƒ } | j	 | ƒ qG Wt
 | ƒ S(   Ns   Unknown: %ri    (    (   Rl  R©   R�   RQ  RH   R«   R·   R^  RD  t   extendt   reversed(   R    t   finalR6   t   todot   seenRk  Ri  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   get_stepsz  s"    		c            sy   d g ‰ g  ‰ i  ‰ i  ‰ g  ‰ |  j  ‰  ‡  ‡ ‡ ‡ ‡ ‡ ‡ f d †  ‰ x' ˆ  D] } | ˆ k rR ˆ | ƒ qR qR Wˆ S(   Ni    c            s@  ˆ d ˆ |  <ˆ d ˆ |  <ˆ d c d 7<ˆ j  |  ƒ y ˆ  |  } Wn t k
 r` g  } n Xxl | D]d } | ˆ k r¢ ˆ | ƒ t ˆ |  ˆ | ƒ ˆ |  <qh | ˆ k rh t ˆ |  ˆ | ƒ ˆ |  <qh qh Wˆ |  ˆ |  k r<g  } x3 t rˆ j ƒ  } | j  | ƒ | |  k rí Pqí qí Wt | ƒ } ˆ j  | ƒ n  d  S(   Ni    i   (   RQ  Rz   t   minR[   RH   t   tuple(   Ra  t
   successorst	   successort   connected_componentt	   component(   t   grapht   indext   index_countert   lowlinksR6   t   stackt   strongconnect(    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR~  ž  s.    

"	 (   R_  (   R    Ra  (    (   Ry  Rz  R{  R|  R6   R}  R~  s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   strong_connections“  s    		!"c         C   s‘   d g } xF |  j  D]; } |  j  | } x% | D] } | j d | | f ƒ q- Wq Wx" |  j D] } | j d | ƒ q\ W| j d ƒ d j | ƒ S(   Ns   digraph G {s     %s -> %s;s     %s;t   }s   
(   R^  RQ  R`  R2   (   R    R6   Rg  Ri  Rf  Ra  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   dotÆ  s    	(   R¤   R¨   R¡   Rb  R³   Rd  R·   R«   Rl  Rr  t   propertyR  R�  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR]  K  s   						3s   .tar.gzs   .tar.bz2s   .tars   .zips   .tgzs   .tbzs   .whlc   
         sæ  ‡  ‡ f d †  } t  j j ˆ  ƒ ‰  t ˆ  ƒ ‰ d  } | d  k rÇ |  j d ƒ rZ d } qÇ |  j d ƒ rx d } d } qÇ |  j d ƒ r– d } d } qÇ |  j d ƒ r´ d } d } qÇ t d |  ƒ ‚ n  z| d k rt |  d ƒ } | rZ| j ƒ  } x | D] } | | ƒ qþ WqZnB t	 j
 |  | ƒ } | rZ| j ƒ  } x | D] } | | ƒ qCWn  | d k r½t j d d k  r½xA | j ƒ  D]0 }	 t |	 j t ƒ s†|	 j j d ƒ |	 _ q†q†Wn  | j ˆ  ƒ Wd  | rá| j ƒ  n  Xd  S(   Nc            s|   t  |  t ƒ s! |  j d ƒ }  n  t j j t j j ˆ  |  ƒ ƒ } | j ˆ  ƒ se | ˆ t j k rx t	 d | ƒ ‚ n  d  S(   Ns   utf-8s   path outside destination: %r(
   Rl   R   t   decodeR?   R@   Rº   R2   RB   RA   R©   (   R@   Ri   (   t   dest_dirt   plen(    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt
   check_pathÛ  s
    !#s   .zips   .whlt   zips   .tar.gzs   .tgzt   tgzs   r:gzs   .tar.bz2s   .tbzt   tbzs   r:bz2s   .tart   tarRA  s   Unknown format for %ri    i   s   utf-8(   s   .zips   .whl(   s   .tar.gzs   .tgz(   s   .tar.bz2s   .tbz(   R?   R@   Rº   RD   R,   R"  R©   R   t   namelistt   tarfileRÏ   t   getnamesRZ   Rr   t
   getmembersRl   R&   R   Rƒ  t
   extractallRÑ   (
   t   archive_filenameR„  t   formatRÈ   R†  t   archiveRß   t   namesR&   t   tarinfo(    (   R„  R…  s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   unarchiveÙ  sH    				c      	   C   s¬   t  j ƒ  } t |  ƒ } t | d ƒ � } xu t j |  ƒ D]d \ } } } xR | D]J } t j j | | ƒ } | | }	 t j j |	 | ƒ }
 | j | |
 ƒ qP Wq: WWd QX| S(   s*   zip a directory tree into a BytesIO objectRÌ   N(	   t   iot   BytesIORD   R   R?   t   walkR@   R2   RŽ   (   t	   directoryR6   t   dlent   zft   rootRù   RÞ   R&   t   fullt   relRN   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   zip_dir  s    
R$   t   Kt   Mt   Gt   Tt   Pt   Progressc           B   s†   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z	 e d	 „  ƒ Z
 d
 „  Z e d „  ƒ Z e d „  ƒ Z RS(   t   UNKNOWNi    id   c         C   sV   | d  k s | | k s t ‚ | |  _ |  _ | |  _ d  |  _ d |  _ t |  _ d  S(   Ni    (	   R,   RC   Rs  t   curt   maxt   startedt   elapsedR³   t   done(   R    t   minvalt   maxval(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   &  s    			c         C   s}   |  j  | k s t ‚ |  j d  k s9 | |  j k s9 t ‚ | |  _ t j ƒ  } |  j d  k ri | |  _ n | |  j |  _ d  S(   N(   Rs  RC   R¨  R,   R§  t   timeR©  Rª  (   R    t   curvalt   now(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   update.  s    $	c         C   s*   | d k s t  ‚ |  j |  j | ƒ d  S(   Ni    (   RC   R±  R§  (   R    t   incr(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   increment8  s    c         C   s   |  j  |  j ƒ |  S(   N(   R±  Rs  (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR0  <  s    c         C   s/   |  j  d  k	 r" |  j |  j  ƒ n  t |  _ d  S(   N(   R¨  R,   R±  R[   R«  (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   stop@  s    c         C   s   |  j  d  k r |  j S|  j  S(   N(   R¨  R,   t   unknown(   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   maximumE  s    c         C   sZ   |  j  r d } nD |  j d  k r* d } n, d |  j |  j |  j |  j } d | } | S(   Ns   100 %s    ?? %g      Y@s   %3d %%(   R«  R¨  R,   R§  Rs  (   R    R6   R„   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt
   percentageI  s    			"
c         C   sU   | d k r |  j  d  k s- |  j |  j k r6 d } n t j d t j | ƒ ƒ } | S(   Ni    s   ??:??:??s   %H:%M:%S(   R¨  R,   R§  Rs  R®  t   strftimet   gmtime(   R    t   durationR6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   format_durationT  s    -	c         C   sµ   |  j  r d } |  j } nƒ d } |  j d  k r9 d } ne |  j d k sZ |  j |  j k rc d } n; t |  j |  j ƒ } | |  j |  j :} | d |  j } d | |  j | ƒ f S(   Nt   Dones   ETA iÿÿÿÿi    i   s   %s: %s(   R«  Rª  R¨  R,   R§  Rs  t   floatR»  (   R    RO   t   t(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   ETA]  s    		!	c         C   sh   |  j  d k r d } n |  j |  j |  j  } x( t D]  } | d k  rL Pn  | d :} q6 Wd | | f S(   Ni    g        iè  g     @�@s   %d %sB/s(   Rª  R§  Rs  t   UNITS(   R    R6   t   unit(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   speedp  s    	(   R¤   R¨   Rµ  R¡   R±  R³  R0  R´  R‚  R¶  R·  R»  R¿  RÂ  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¥  #  s   	
					s   \{([^}]*)\}s   [^/\\,{]\*\*|\*\*[^/\\,}]s   ^[^{]*\}|\{[^}]*$c         C   sZ   t  j |  ƒ r( d } t | |  ƒ ‚ n  t j |  ƒ rP d } t | |  ƒ ‚ n  t |  ƒ S(   sA   Extended globbing function that supports ** and {opt1,opt2,opt3}.s7   invalid glob %r: recursive glob "**" must be used alones2   invalid glob %r: mismatching set marker '{' or '}'(   t   _CHECK_RECURSIVE_GLOBR  R©   t   _CHECK_MISMATCH_SETt   _iglob(   t	   path_globRÉ   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR   …  s    c         c   s‹  t  j |  d ƒ } t | ƒ d k rœ t | ƒ d k sB t | ƒ ‚ | \ } } } x3| j d ƒ D]4 } x+ t d j | | | f ƒ ƒ D] } | Vq† Wqa Wnë d |  k rÇ xÜ t |  ƒ D] } | Vqµ WnÀ |  j d d ƒ \ } } | d k rô d } n  | d k r	d } n | j d ƒ } | j d	 ƒ } x] t j	 | ƒ D]L \ } } }	 t j
 j | ƒ } x( t t j
 j | | ƒ ƒ D] }
 |
 VqtWq7Wd  S(
   Ni   i   R  R$   s   **Rþ   R=  R=   s   \(   t	   RICH_GLOBR4   RD   RC   RÅ  R2   t	   std_iglobRE   R?   R˜  R@   t   normpath(   RÆ  t   rich_path_globRO   R�   RM   t   itemR@   t   radicalt   dirRÞ   t   fn(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRÅ  �  s*    %		"t   HTTPSConnectionc           B   s   e  Z d Z e Z d  „  Z RS(   c      
   C   sÝ  t  j |  j |  j f |  j ƒ } t |  d t ƒ rI | |  _ |  j ƒ  n  t	 t
 d ƒ s¯ |  j rm t
 j } n	 t
 j } t
 j | |  j |  j d | d t
 j d |  j ƒ|  _ n® t
 j t
 j ƒ } | j t
 j O_ |  j rõ | j |  j |  j ƒ n  i  } |  j rHt
 j | _ | j d |  j ƒ t t
 d t ƒ rH|  j | d <qHn  | j | | � |  _ |  j rÙ|  j rÙy0 t |  j j ƒ  |  j ƒ t j d	 |  j ƒ WqÙt k
 rÕ|  j j t  j ƒ |  j j  ƒ  ‚  qÙXn  d  S(
   Nt   _tunnel_hostt
   SSLContextt	   cert_reqst   ssl_versiont   ca_certst   cafilet   HAS_SNIt   server_hostnames   Host verified: %s(!   R˜   t   create_connectiont   hostt   portt   timeoutR\   R³   t   sockt   _tunnelRY   t   sslRÔ  t   CERT_REQUIREDt	   CERT_NONEt   wrap_sockett   key_filet	   cert_filet   PROTOCOL_SSLv23RÑ  t   optionst   OP_NO_SSLv2t   load_cert_chaint   verify_modet   load_verify_locationst   check_domainR   t   getpeercertRÁ   Rì   R   t   shutdownt	   SHUT_RDWRRÑ   (   R    RÜ  RÒ  t   contextRZ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   connect¶  s>    !						N(   R¤   R¨   R,   RÔ  R[   Rê  Rï  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRÏ  ±  s   R   c           B   s&   e  Z e d  „ Z d „  Z d „  Z RS(   c         C   s#   t  j |  ƒ | |  _ | |  _ d  S(   N(   t   BaseHTTPSHandlerR¡   RÔ  Rê  (   R    RÔ  Rê  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   Ü  s    	c         O   s7   t  | | Ž  } |  j r3 |  j | _ |  j | _ n  | S(   sû  
        This is called to create a connection instance. Normally you'd
        pass a connection class to do_open, but it doesn't actually check for
        a class, and just expects a callable. As long as we behave just as a
        constructor would have, we should be OK. If it ever changes so that
        we *must* pass a class, we'll create an UnsafeHTTPSConnection class
        which just sets check_domain to False in the class definition, and
        choose which one to pass to do_open.
        (   RÏ  RÔ  Rê  (   R    RY  RZ  R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   _conn_makerá  s
    
	c         C   s_   y |  j  |  j | ƒ SWnA t k
 rZ } d t | j ƒ k rT t d | j ƒ ‚ q[ ‚  n Xd  S(   Ns   certificate verify faileds*   Unable to verify server certificate for %s(   t   do_openRñ  R   t   strt   reasonR   RÙ  (   R    t   reqRI  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt
   https_openñ  s    (   R¤   R¨   R[   R¡   Rñ  Rö  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR   Û  s   	t   HTTPSOnlyHandlerc           B   s   e  Z d  „  Z RS(   c         C   s   t  d | ƒ ‚ d  S(   NsA   Unexpected HTTP request on what should be a secure connection: %s(   R   (   R    Rõ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   http_open  s    (   R¤   R¨   Rø  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR÷    s   i   i   t   HTTPc           B   s   e  Z d  d d „ Z RS(   R$   c         K   s5   | d k r d  } n  |  j |  j | | | � ƒ d  S(   Ni    (   R,   t   _setupt   _connection_class(   R    RÙ  RÚ  RZ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡     s    	N(   R¤   R¨   R,   R¡   (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRù    s   t   HTTPSc           B   s   e  Z d  d d „ Z RS(   R$   c         K   s5   | d k r d  } n  |  j |  j | | | � ƒ d  S(   Ni    (   R,   Rú  Rû  (   R    RÙ  RÚ  RZ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡     s    	N(   R¤   R¨   R,   R¡   (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRü    s   t	   Transportc           B   s   e  Z d  d „ Z d „  Z RS(   i    c         C   s    | |  _  t j j |  | ƒ d  S(   N(   RÛ  R   Rý  R¡   (   R    RÛ  t   use_datetime(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡     s    	c         C   sŽ   |  j  | ƒ \ } } } t d k r< t | d |  j ƒ} nN |  j sY | |  j d k r} | |  _ | t j | ƒ f |  _ n  |  j d } | S(   Ni   i   RÛ  i    i   (   i   i   (   t   get_host_infot	   _ver_infoRù  RÛ  t   _connectiont   _extra_headersR
   t   HTTPConnection(   R    RÙ  t   ht   eht   x509R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   make_connection#  s    	(   R¤   R¨   R¡   R  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRý    s   t   SafeTransportc           B   s   e  Z d  d „ Z d „  Z RS(   i    c         C   s    | |  _  t j j |  | ƒ d  S(   N(   RÛ  R   R  R¡   (   R    RÛ  Rþ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   /  s    	c         C   s­   |  j  | ƒ \ } } } | s' i  } n  |  j | d <t d k rU t | d  | � } nT |  j sr | |  j d k rœ | |  _ | t j | d  | � f |  _ n  |  j d } | S(   NRÛ  i   i   i    i   (   i   i   (	   Rÿ  RÛ  R   Rü  R,   R  R  R
   RÏ  (   R    RÙ  R  R  RZ  R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  3  s    		(   R¤   R¨   R¡   R  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  .  s   t   ServerProxyc           B   s   e  Z d  „  Z RS(   c   	      K   s¤   | j  d d  ƒ |  _ } | d  k	 rŠ t | ƒ \ } } | j d d ƒ } | d k r^ t } n t } | | d | ƒ| d <} | |  _ n  t j	 j
 |  | | � d  S(   NRÛ  Rþ  i    t   httpst	   transport(   RH   R,   RÛ  R   RD  R  Rý  R  R   R	  R¡   (	   R    t   uriRZ  RÛ  t   schemet   _Rþ  t   tclsR¾  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   D  s    	(   R¤   R¨   R¡   (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR	  C  s   c         K   s:   t  j d d k  r  | d 7} n
 d | d <t |  | | � S(   Ni    i   t   bR$   t   newline(   RZ   Rr   RÏ   (   RÎ  Rß   RZ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   _csv_openX  s    
t   CSVBasec           B   sG   e  Z i e d  ƒ d 6e d ƒ d 6e d ƒ d 6Z d „  Z d „  Z RS(   R  t	   delimitert   "t	   quotechars   
t   lineterminatorc         C   s   |  S(   N(    (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt	   __enter__g  s    c         G   s   |  j  j ƒ  d  S(   N(   R   RÑ   (   R    R  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __exit__j  s    (   R¤   R¨   Ró  t   defaultsR  R  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  `  s   	t	   CSVReaderc           B   s)   e  Z d  „  Z d „  Z d „  Z e Z RS(   c         K   s‚   d | k rM | d } t  j d d k rA t j d ƒ | ƒ } n  | |  _ n t | d d ƒ |  _ t j |  j |  j � |  _ d  S(   NR   i    i   s   utf-8R@   RA  (	   RZ   Rr   Rs   Rt   R   R  t   csvRH  R  (   R    RZ  R   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   o  s    
c         C   s   |  S(   N(    (   R    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __iter__z  s    c         C   sk   t  |  j ƒ } t j d d k  rg xB t | ƒ D]1 \ } } t | t ƒ s/ | j d ƒ | | <q/ q/ Wn  | S(   Ni    i   s   utf-8(   t   nextRH  RZ   Rr   R+  Rl   R   Rƒ  (   R    R6   R-  RË  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  }  s    (   R¤   R¨   R¡   R  R  t   __next__(    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR  n  s   			t	   CSVWriterc           B   s   e  Z d  „  Z d „  Z RS(   c         K   s1   t  | d ƒ |  _ t j |  j |  j � |  _ d  S(   NRÌ   (   R  R   R  t   writerR  (   R    RÎ  RZ  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   ˆ  s    c         C   su   t  j d d k  ra g  } x< | D]4 } t | t ƒ rG | j d ƒ } n  | j | ƒ q  W| } n  |  j j | ƒ d  S(   Ni    i   s   utf-8(   RZ   Rr   Rl   R   R×   RQ  R!  t   writerow(   R    t   rowRA  RË  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR"  Œ  s    	(   R¤   R¨   R¡   R"  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR   ‡  s   	t   Configuratorc           B   sH   e  Z e e j ƒ Z d  e d <d d „ Z d „  Z d „  Z d „  Z	 RS(   t   inc_convertt   incc         C   s/   t  t |  ƒ j | ƒ | p% t j ƒ  |  _ d  S(   N(   t   superR$  R¡   R?   R•   RF   (   R    t   configRF   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   Ÿ  s    c            s!  ‡  ‡ f d †  ‰  | j  d ƒ } t | ƒ s? ˆ j | ƒ } n  | j  d d  ƒ } | j  d d ƒ } | r‘ t g  | D] } ˆ  | ƒ ^ qs ƒ } n  g  | D]( } t | ƒ r˜ | ˆ  | | ƒ f ^ q˜ } t | ƒ } | | | Ž  }	 | rx3 | j ƒ  D]" \ }
 } t |	 |
 ˆ  | ƒ ƒ qô Wn  |	 S(   Nc            s±   t  |  t t f ƒ rC t |  ƒ g  |  D] } ˆ  | ƒ ^ q% ƒ } nj t  |  t ƒ rž d |  k rp ˆ j |  ƒ } q­ i  } x4 |  D] } ˆ  |  | ƒ | | <q} Wn ˆ j |  ƒ } | S(   Ns   ()(   Rl   Rõ   Rt  t   typet   dictt   configure_customt   convert(   t   oR-  R6   Rƒ   (   R,  R    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR,  ¤  s    .s   ()Rþ   s   [](    (	   RH   R  R  R,   Rt  R   R*  Rx   t   setattr(   R    R(  Rj   t   propsRY  R-  Rƒ   Rx   RZ  R6   R8  R„   (    (   R,  R    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR+  £  s    (5c         C   sI   |  j  | } t | t ƒ rE d | k rE |  j | ƒ |  j  | <} n  | S(   Ns   ()(   R(  Rl   R*  R+  (   R    Rn   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   __getitem__Â  s    c         C   sa   t  j j | ƒ s- t  j j |  j | ƒ } n  t j | d d d ƒ� } t j | ƒ } Wd QX| S(   s*   Default converter for the inc:// protocol.RA  RÍ   s   utf-8N(	   R?   R@   t   isabsR2   RF   Rs   RÏ   Rv   Rw   (   R    R‡   RÕ   R6   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR%  È  s
    N(
   R¤   R¨   R*  R   t   value_convertersR,   R¡   R+  R0  R%  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR$  š  s   
		t   SubprocessMixinc           B   s)   e  Z e d d  „ Z d „  Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   verboset   progress(   R    R4  R5  (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR¡   Õ  s    	c         C   sž   |  j  } |  j } x{ t r� | j ƒ  } | s1 Pn  | d k	 rM | | | ƒ q | sf t j j d ƒ n t j j | j d ƒ ƒ t j j	 ƒ  q W| j
 ƒ  d S(   s¨   
        Read lines from a subprocess' output stream and either pass to a progress
        callable (if specified) or write progress information to sys.stderr.
        Rþ   s   utf-8N(   R5  R4  R[   t   readlineR,   RZ   t   stderrRŽ   Rƒ  t   flushRÑ   (   R    R   Rî  R5  R4  R5   (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyRH  Ù  s    			c         K   sà   t  j | d t  j d t  j | �} t j d |  j d | j d f ƒ } | j ƒ  t j d |  j d | j d f ƒ } | j ƒ  | j	 ƒ  | j
 ƒ  | j
 ƒ  |  j d  k	 rÀ |  j d d ƒ n |  j rÜ t j j d ƒ n  | S(   Nt   stdoutR7  R½   RY  s   done.t   mains   done.
(   t
   subprocesst   Popent   PIPEt	   threadingt   ThreadRH  R9  R0  R7  t   waitR2   R5  R,   R4  RZ   RŽ   (   R    t   cmdRZ  Ri   t   t1t   t2(    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   run_commandî  s    $
$



	N(   R¤   R¨   R³   R,   R¡   RH  RD  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyR3  Ô  s   	(   s   .tar.gzs   .tar.bz2s   .tars   .zips   .tgzs   .tbzs   .whl(   R$   R   R¡  R¢  R£  R¤  (   i   i   („   Rs   t   collectionsR    t
   contextlibR  t   globR   RÈ  R–  Rv   t   loggingR?   Rã   R1  R   R˜   RÞ  R;  RZ   RŒ  R�   R>  t   ImportErrort   dummy_threadingR®  R$   R   t   compatR   R   R   R   R   R	   R
   R   R   R   R   Rð  R   R   R   R   R   R   R   R   t	   getLoggerR¤   RÁ   t   COMMARä   R3   t   IDENTt   EXTRA_IDENTt   VERSPECt   RELOPt   BARE_CONSTRAINTSt
   DIRECT_REFt   CONSTRAINTSt
   EXTRA_LISTt   EXTRASt   REQUIREMENTR-   t   RELOP_IDENTR0   R<   RV   R]   Rc   R,   Rk   Ro   Rˆ   R�   t   contextmanagerR”   R–   R�   R¢   Rž   R®   R¯   R  R  t   VERBOSER  Ry   R  R!  R#  R(  R*  R.  t   IR4  R/  R9  R;  R<  RC  RJ  RL  RN  RO  R]  t   ARCHIVE_EXTENSIONSR[   R•  RŸ  RÀ  R¥  RÇ  RÃ  RÄ  RÅ  RÏ  R÷  Rr   R   Rù  Rü  Rý  R  R	  R  R  R  R   R$  R3  (    (    (    s?   /var/www/testScraper/venv/build/pip/pip/_vendor/distlib/util.pyt   <module>   sÒ   ‚
.	%		
					$	
		¶		*					
						H‹ 6	]		!*)		: