ó
^\kdc           @   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 m Z d d l m	 Z	 m
 Z
 m Z m Z d d l m Z m Z m Z m Z m Z d d l m Z m Z d d l m Z m Z m Z d d l m Z m Z d d	 l m Z m Z m  Z  d d
 l! m" Z" m# Z# m$ Z$ d d l% m& Z& d g Z' d Z( i d g d 6Z) d e* f d „  ƒ  YZ+ d e* f d „  ƒ  YZ, d e* f d „  ƒ  YZ- d e* f d „  ƒ  YZ. e. e	 ƒ Z/ d „  Z0 d „  Z1 d S(   s!   Routines related to PyPI, indexesiÿÿÿÿN(   t   logger(   t   Inft   normalize_namet   splitextt   is_prerelease(   t   DistributionNotFoundt   BestVersionAlreadyInstalledt   InstallationErrort   InvalidWheelFilenamet   UnsupportedWheel(   t   urlparset   url2pathname(   t
   PipSessiont   url_to_patht   path_to_url(   t   Wheelt	   wheel_ext(   t   supported_tagst   supported_tags_noarcht   get_platform(   t   html5libt   requestst   pkg_resources(   t   SSLErrort   PackageFinders   last.pypi.python.orgt   httpst   httpc           B   sÔ   e  Z d  Z e g  g  e e e d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z e j d	 ƒ Z e j d
 e j ƒ Z e j d ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sŸ   This finds packages.

    This is meant to match easy_install's technique for looking for
    packages, by reading pages and looking for appropriate links
    c
   
      C   sÌ   | |  _  | |  _ g  |  _ t ƒ  |  _ t ƒ  |  _ | |  _ t d „  | Dƒ ƒ |  _ t d „  | Dƒ ƒ |  _	 |  j |  j	 O_ | |  _
 t |  _ t |  _ | |  _ | |  _ t |  _ |	 pÂ t ƒ  |  _ d  S(   Nc         s   s   |  ] } t  | ƒ Vq d  S(   N(   R   (   t   .0t   n(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pys	   <genexpr>4   s    c         s   s   |  ] } t  | ƒ Vq d  S(   N(   R   (   R   R   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pys	   <genexpr>8   s    (   t
   find_linkst
   index_urlst   dependency_linkst	   PageCachet   cachet   sett   logged_linkst	   use_wheelt   allow_externalt   allow_unverifiedt   allow_all_externalt   Falset   need_warn_externalt   need_warn_unverifiedt   allow_all_prereleasest   process_dependency_linkst   _have_warned_dependency_linksR   t   session(
   t   selfR   R   R$   R%   R&   R'   R+   R,   R.   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __init__&   s"    										c         C   sE   |  j  rA |  j s. t j d d ƒ t |  _ n  |  j j | ƒ n  d  S(   Ns   1.6sp   Dependency Links processing has been deprecated with an accelerated time schedule and will be removed in pip 1.6(   R,   R-   R    t
   deprecatedt   TrueR   t   extend(   R/   t   links(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   add_dependency_linksS   s    		c   	         sG  g  ‰  g  ‰ ‡  ‡ f d †  } x| D]} t  j j | ƒ } | j d ƒ } | |  j k } | sg | r,| rv | } n t | ƒ } | râ t  j j | ƒ râ t  j j | ƒ } xz t  j | ƒ D] } | t  j j	 | | ƒ ƒ q¼ Wq9| r
t  j j | ƒ r
ˆ j
 | ƒ q9t  j j | ƒ r9| | ƒ q9q% ˆ j
 | ƒ q% Wˆ  ˆ f S(   st   
        Sort locations into "files" (archives) and "urls", and return
        a pair of lists (files,urls)
        c            sL   t  |  ƒ } t j | d t ƒd d k r; ˆ j | ƒ n ˆ  j | ƒ d  S(   Nt   stricti    s	   text/html(   R   t	   mimetypest
   guess_typeR(   t   append(   t   patht   url(   t   filest   urls(    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt	   sort_pathk   s    s   file:(   t   osR:   t   existst
   startswithR   R   t   isdirt   realpatht   listdirt   joinR9   t   isfile(	   R/   t	   locationsR>   R;   t   is_local_patht   is_file_urlt   is_find_linkR:   t   item(    (   R<   R=   s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   _sort_locationsb   s*    	 c         C   s¢   | \ } } } |  j  rš t t ƒ } | t k r9 d } nW | j t k r‰ t | j ƒ } | j ƒ  sy t	 d | j ƒ ‚ n  | j
 ƒ  } n | } | | f S| Sd S(   sL  
        Function used to generate link sort key for link tuples.
        The greater the return value, the more preferred it is.
        If not finding wheels, then sorted by version only.
        If finding wheels, then the sort order is by version, then:
          1. existing installs
          2. wheels ordered via Wheel.support_index_min()
          3. source archives
        Note: it was considered to embed this logic into the Link
              comparison operators, but then different sdist links
              with the same version, would have to be considered equal
        i   sB   %s is not a supported wheel for this platform. It can't be sorted.N(   R$   t   lenR   t   INSTALLED_VERSIONt   extR   R   t   filenamet	   supportedR	   t   support_index_min(   R/   t
   link_tuplet   parsed_versiont   linkt   _t   support_numt   prit   wheel(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   _link_sort_keyŠ   s    		
c         C   s   t  | d |  j d t ƒS(   sí   
        Bring the latest version (and wheels) to the front, but maintain the existing ordering as secondary.
        See the docstring for `_link_sort_key` for details.
        This function is isolated for easier unit testing.
        t   keyt   reverse(   t   sortedRZ   R2   (   R/   t   applicable_versions(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   _sort_versions§   s    c            sÕ  ‡  f d †  } | j  ‰  d  } |  j r› t | |  j d ƒ d t ƒ} |  j | | ƒ } | d  k r› |  j t |  j d d t ƒˆ  | ƒ p’ | j  ‰  q› n  ˆ  d  k	 rÓ g  |  j D] } | | ƒ ^ q± |  j } n t |  j ƒ } xH | j	 D]= } ˆ  d  k	 rì | d  k	 rì t
 j | j | ƒ g | } qì qì W|  j | ƒ \ }	 }
 |  j |  j ƒ \ } } |	 j | ƒ g  |
 D] } t | d t ƒ^ qn} | j g  | D] } t | ƒ ^ q™ƒ t j d | ƒ xü | D]ô } t j d | ƒ t j t | ƒ ƒ } | j t k rÊt | j } t | ƒ d k rT| | j | d | j f } t j d | ƒ q¾t | ƒ d k r›| | j d j | ƒ | j f } t j d	 | ƒ q¾| | j f } t j d
 | ƒ qÊqÊWg  } | j |  j g  |  j D] } t | d d t ƒ^ qÞ| j j ƒ  ƒ ƒ g  } xy |  j | | ƒ D]e } t j d | j ƒ t j d 7_ z) | j |  j | j | j j ƒ  ƒ ƒ Wd  t j d 8_ Xq(Wt |  j g  |  j D] } t | ƒ ^ q¤| j j ƒ  ƒ ƒ } | rt j d d j g  | D] \ } } } | j ^ qêƒ ƒ n  t |  j g  |	 D] } t | ƒ ^ q | j j ƒ  ƒ ƒ } | rÊ| rÊ| rÊ| rÊt j  d | ƒ |  j! r—t j d | j ƒ n  |  j" r·t j d | j ƒ n  t# d | ƒ ‚ n  g  } | j$ d  k	 r | j$ j% t& | j$ j' f g } n  | rX| j( d t ƒ t j d d j g  | D] \ } } } t) | j ƒ ^ q,ƒ ƒ n  | | | | | } g  } xÒ | D]Ê \ } } } | | j* k rät j d | | d j g  | j* j+ D] } d j | ƒ ^ q»ƒ f ƒ q{nK t, | ƒ r/|  j- pÿ| j. r/| t& k	 r/t j d | | f ƒ q{q/n  | j/ | | | f ƒ q{W|  j0 | ƒ } t1 g  | D]! \ } } } | t& k rb| ^ qbƒ } | rð| rð| d d t& k rÇt j d | j$ j' ƒ n% t j d | j$ j' | d d f ƒ d  S| s~t j  d | d j g  | D] \ } } } | ^ qƒ f ƒ |  j! rKt j d ƒ n  |  j" rkt j d | j ƒ n  t# d | ƒ ‚ n  | d d t& k rçt j d | j$ j' d j g  | d D] \ } } } | ^ qµƒ pÖd f ƒ t2 ‚ n  t | ƒ d k r@t j d  | d d d j g  | D] \ } } } | ^ qƒ f ƒ n  | d d } | j3 d  k	 r~| j3 r~t j d! | j ƒ n  | j4 d  k	 r®| j4 r®t j d" | j ƒ n  | j5 rÑt j6 d# d$ | j ƒ n  | S(%   Nc            s2   t  j |  ˆ  ƒ } | j d ƒ s. | d } n  | S(   Nt   /(   t	   posixpathRE   t   endswith(   R;   t   loc(   t   url_name(    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   mkurl_pypi_url±   s    i    t   trusteds#   URLs to search for versions for %s:s   * %si   sS   %s uses an insecure transport scheme (%s). Consider using %s if %s has it availables   , sc   %s uses an insecure transport scheme (%s). Consider using one of %s if %s has any of them availables*   %s uses an insecure transport scheme (%s).s   -fs   Analyzing links from page %si   s   dependency_links found: %ss<   Could not find any downloads that satisfy the requirement %ssM   Some externally hosted files were ignored (use --allow-external %s to allow).sW   Some insecure and unverifiable files were ignored (use --allow-unverified %s to allow).s$   No distributions at all found for %sR\   s   Local files found: %ss-   Ignoring link %s, version %s doesn't match %st   ,t    sC   Ignoring link %s, version %s is a pre-release (use --pre to allow).sL   Existing installed version (%s) is most up-to-date and satisfies requirementsU   Existing installed version (%s) satisfies requirement (most up-to-date version is %s)sN   Could not find a version that satisfies the requirement %s (from versions: %s)sJ   Some externally hosted files were ignored (use --allow-external to allow).s,   No distributions matching the version for %ss=   Installed version (%s) is most up-to-date (past versions: %s)t   nones)   Using version %s (newest of versions: %s)s2   %s an externally hosted file and may be unreliables,   %s is potentially insecure and unverifiable.s   1.7sa   %s discovered using a deprecated method of parsing, in the future it will no longer be discovered(7   Rd   t   NoneR   t   LinkR2   t	   _get_paget   _find_url_nameR   t   listt   absolute_versionsRa   RE   R;   RL   R   R3   R    t   debugR
   t   strt   schemet   INSECURE_SCHEMESRM   t   netloct   warnt   _package_versionst   namet   lowert
   _get_pagest   indentR4   t   infot   fatalR)   R*   R   t   satisfied_byRT   RN   t   versiont   sortR   t   reqt   specsR   R+   t   prereleasesR9   R_   t   boolR   t   internalt
   verifiablet   _deprecated_regexR1   (   R/   R€   t   upgradeRe   t   main_index_urlt   pageR;   RG   R~   t   file_locationst   url_locationst   _flocationst   _ulocationst   locationt   parsedt   secure_schemest   ctxt   found_versionst   page_versionst   dependency_versionsRU   t   file_versionst   installed_versiont   all_versionsR^   RT   t   st   existing_applicablet   selected_version(    (   Rd   s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   find_requirement¯   sö    
		7)#%&			;)	4<	1				!B	<	4			3				C		>
	
		c         C   sÆ   | j  j d ƒ s$ | j  d 7_  n  |  j | | ƒ } | d k rW t j d | ƒ d St | j ƒ } xY | j D]N } t	 j
 | j j d ƒ ƒ } | t | ƒ k rp t j d | | f ƒ | Sqp Wd S(   sŒ   Finds the true URL name of a package, when the given name isn't quite correct.
        This is usually used to implement case-insensitivity.R`   s   Cannot fetch index base URL %sNs!   Real name of requirement %s is %s(   R;   Rb   Rl   Rj   R    R|   R   Rd   R4   Ra   t   basenameR:   t   rstript   notify(   R/   t	   index_urlRd   R€   R‰   t	   norm_nameRU   t   base(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRm   b  s    c   	      c   s7  t  | ƒ } t ƒ  } x| r2| j d ƒ } | | k r? q n  | j | ƒ |  j | | ƒ } | d k rp q n  | Vx· | j ƒ  D]© } t | j ƒ j	 ƒ  } | |  j
 k rÖ |  j rÖ t |  _ t j d | ƒ q‚ n  | j d k	 r| j r| |  j k rt j d | ƒ t |  _ q‚ n  | j | ƒ q‚ Wq Wd S(   s“   
        Yields (page, page_url) from the given locations, skipping
        locations that have errors, and adding download/homepage links
        i    s@   Not searching %s for files because external urls are disallowed.s_   Not searching %s for urls, it is an untrusted link and cannot produce safe or verifiable files.N(   Rn   R"   t   popt   addRl   Rj   t	   rel_linksR   Rw   Rx   R%   R'   R2   R)   R    Rp   Rf   R&   R*   R9   (	   R/   RG   R€   t   all_locationst   seenRŽ   R‰   RU   t
   normalized(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRy   u  s6    		
		
		s   #egg=([^&]*)s   ([a-z0-9_.]+)-([a-z0-9_.-]+)s   -py([123]\.?[0-9]?)$c         C   sq   g  g  } } t  ƒ  } xP | D]H } | | k r | j | ƒ | j rU | j | ƒ qe | j | ƒ q q W| | S(   sg   Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates(   R"   R£   t   egg_fragmentR9   (   R/   R4   t   eggst   no_eggsR¦   RU   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   _sort_links¢  s    		c         c   s@   x9 |  j  | ƒ D]( } x |  j | | ƒ D] } | Vq) Wq Wd  S(   N(   R«   t   _link_package_versions(   R/   R4   t   search_nameRU   t   v(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRv   ¯  s    c         C   s   d } |  j  r | t f S| S(   Ns   .tar.gzs   .tar.bz2s   .tars   .tgzs   .zip(   s   .tar.gzs   .tar.bz2s   .tars   .tgzs   .zip(   R$   R   (   R/   t
   extensions(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   _known_extensions´  s    	c         C   sí  t  ƒ  } d } | j r$ | j } nD| j ƒ  \ } } | ss | |  j k ro t j d | ƒ |  j j | ƒ n  g  S| j d ƒ r™ | d  } d | } n  | |  j	 ƒ  k rè | |  j k rä t j d | | f ƒ |  j j | ƒ n  g  Sd | j
 k r:| d k r:| |  j k r6t j d | ƒ |  j j | ƒ n  g  S| t k rhy t | j ƒ } Wn# t k
 r~t j d | ƒ g  SX| j j ƒ  | j ƒ  k rµt j d	 | | f ƒ g  S| j ƒ  sÖt j d
 | ƒ g  St | d d ƒ } | j d ƒ r\| j d ƒ r\| d k	 r\t j | j ƒ j j d ƒ r\| j d t ƒ s\t j d | ƒ g  Sn  | j } n  | s†|  j | | | ƒ } n  | d k r­t j d	 | | f ƒ g  S| j d k	 r	| j r	t | ƒ j ƒ  |  j k r	|  j r	t j d | ƒ t |  _ g  S| j  d k	 r[| j  r[t | ƒ j ƒ  |  j! k r[t j d | ƒ t |  _" g  S|  j# j$ | ƒ }	 |	 r½| |	 j% ƒ   } |	 j& d ƒ }
 |
 t' j d  k r½t j d | ƒ g  Sn  t j d | | f ƒ t( j) | ƒ | | f g S(   sâ   
        Return an iterable of triples (pkg_resources_version_key,
        link, python_version) that can be extracted from the given
        link.

        Meant to be overridden by subclasses, not called by clients.
        s   Skipping link %s; not a files   .tariüÿÿÿs,   Skipping link %s; unknown archive format: %st   macosx10s   .zips   Skipping link %s; macosx10 ones1   Skipping %s because the wheel filename is invalids-   Skipping link %s; wrong project name (not %s)s9   Skipping %s because it is not compatible with this Pythont
   comes_fromt   wint   macosxs   pypi.python.orgt   tagssO   Skipping %s because it is a pypi-hosted binary Wheel on an unsupported platforms,   Skipping %s because it is externally hosted.s<   Skipping %s because it is an insecure and unverifiable file.i   i   s/   Skipping %s because Python version is incorrects   Found link %s, version: %sN(*   R   Rj   R¨   R   R#   R    Rp   R£   Rb   R°   R:   R   R   RP   R   Rw   Rx   RQ   t   getattrRA   R
   R;   Rt   R   R~   t   _egg_info_matchesR„   R   R%   R'   R2   R)   R…   R&   R*   t   _py_version_ret   searcht   startt   groupt   sysR   t   parse_version(   R/   RU   R­   t   platformR~   t   egg_infoRO   RY   R²   t   matcht
   py_version(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR¬   º  sœ    		
	

	
		c         C   s’   |  j  j | ƒ } | s- t j d | ƒ d  S| j d ƒ j ƒ  } | j d d ƒ } | j ƒ  d } | j | ƒ rŠ | j d ƒ t	 | ƒ Sd  Sd  S(   Ns%   Could not parse version from link: %si    RV   t   -(
   t   _egg_info_reR¹   R    Rp   Rj   R»   Rx   t   replaceRA   RM   (   R/   R¿   R­   RU   RÀ   Rw   t   look_for(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR·   &  s    c         C   s"   t  j | | d |  j d |  j ƒS(   NR!   R.   (   t   HTMLPaget   get_pageR!   R.   (   R/   RU   R€   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRl   5  s    	N(   t   __name__t
   __module__t   __doc__R2   R(   Rj   R0   R5   RL   RZ   R_   R›   Rm   Ry   t   ret   compilet   _egg_fragment_ret   IRÃ   R¸   R«   Rv   R°   R¬   R·   Rl   (    (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR      s(   	*		(			³		)				l	R    c           B   sV   e  Z d  Z d Z d „  Z d „  Z d „  Z d „  Z e d „ Z	 d „  Z
 d „  Z RS(	   s   Cache of HTML pagesi   c         C   s   i  |  _  i  |  _ i  |  _ d  S(   N(   t	   _failurest   _pagest	   _archives(   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR0   A  s    		c         C   s   |  j  j | d ƒ |  j k S(   Ni    (   RÏ   t   gett   failure_limit(   R/   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   too_many_failuresF  s    c         C   s   |  j  j | ƒ S(   N(   RÐ   RÒ   (   R/   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRÇ   I  s    c         C   s   |  j  j | t ƒ S(   N(   RÑ   RÒ   R(   (   R/   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt
   is_archiveL  s    c         C   s   | |  j  | <d  S(   N(   RÑ   (   R/   R;   t   value(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   set_is_archiveO  s    c         C   s$   |  j  j | d ƒ | |  j  | <d  S(   Ni    (   RÏ   RÒ   (   R/   R;   t   level(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   add_page_failureR  s    c         C   s"   x | D] } | |  j  | <q Wd  S(   N(   RÐ   (   R/   R=   R‰   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   add_pageU  s    (   RÈ   RÉ   RÊ   RÓ   R0   RÔ   RÇ   RÕ   R2   R×   RÙ   RÚ   (    (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR    <  s   					RÆ   c           B   s  e  Z d  Z e j d e j ƒ Z e j d e j ƒ Z e j d e j e j Bƒ Z	 d d d „ Z d „  Z e d e d d „ ƒ Z e d d d d „ ƒ Z e d d	 „ ƒ Z e d
 „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z d d „ Z d „  Z e j d e j ƒ Z d „  Z RS(   s'   Represents one page, along with its URLs   <th>\s*home\s*pages   <th>\s*download\s+urls(   href=(?:"([^"]*)"|'([^']*)'|([^>\s\n]*))c         C   sC   | |  _  t j |  j  d t ƒ|  _ | |  _ | |  _ | |  _ d  S(   Nt   namespaceHTMLElements(   t   contentR   t   parseR(   R�   R;   t   headersRf   (   R/   RÜ   R;   RÞ   Rf   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR0   b  s
    			c         C   s   |  j  S(   N(   R;   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __str__i  s    c         C   s%  | d  k r t ƒ  } n  | j } | j d d ƒ d } | j | ƒ rJ d  Sd d l m } xT | j D]I } | j ƒ  j	 | ƒ rd | t
 | ƒ d k rd t j d t ƒ  ƒ d  Sqd W| d  k	 rß | j | ƒ }	 |	 d  k	 rß |	 Sn  y| r­| d  k	 r
| j | ƒ r
d  Sn  | j }
 x— d d	 d
 d d g D]} } |
 j | ƒ r)|  j | d | ƒ} | j ƒ  j	 d ƒ rlPq¦t j d | | f ƒ | d  k	 rŸ| j | ƒ n  d  Sq)q)Wn  t j d | ƒ t j | ƒ \ } } } } } } | d k rEt j j t | ƒ ƒ rE| j d ƒ s| d 7} n  t j | d ƒ } t j d | ƒ n  | j | d i d d 6ƒ} | j ƒ  | j j d d ƒ } | j ƒ  j	 d ƒ sÌt j d | | f ƒ | d  k	 rÈ| j | ƒ n  d  S|  | j | j | j d | j ƒ}	 Wnt j  k
 rI} | j! j" d k rd n d } |  j# | | | | d | d | ƒnØ t j$ k
 r~} |  j# | | d | | d | ƒn£ t j% k
 r­|  j# | | d | d | ƒnt t& k
 rô} d  | } |  j# | | | | d | d d d! t j' ƒn- X| d  k	 r| j( | | j g |	 ƒ n  |	 Sd  S("   Nt   #i   i    iÿÿÿÿ(   t
   VcsSupports   +:s&   Cannot look at %(scheme)s URL %(link)ss   .tars   .tar.gzs   .tar.bz2s   .tgzs   .zipR.   s	   text/htmls,   Skipping page %s because of Content-Type: %ss   Getting page %st   fileR`   s
   index.htmls#    file: URL is directory, getting %sRÞ   t   Accepts   Content-Typet   unknownRf   i”  i   R!   RØ   s   connection error: %ss	   timed outs6   There was a problem confirming the ssl certificate: %st   meth()   Rj   R   R;   t   splitRÔ   t   pip.vcsRá   t   schemesRx   RA   RM   R    Rp   t   localsRÇ   RÕ   RP   Rb   t   _get_content_typeR×   R
   R?   R:   RB   R   t   urljoinRÒ   t   raise_for_statusRÞ   t   textRf   R   t	   HTTPErrort   responset   status_codet   _handle_failt   ConnectionErrort   TimeoutR   Rž   RÚ   (   t   clsRU   R€   R!   t   skip_archivesR.   R;   Rá   Rr   t   instRP   t   bad_extt   content_typeRt   R:   t   paramst   queryt   fragmentt   respt   excRØ   t   reason(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRÇ   l  s†    	+		!$
		(%
i   c         C   sb   | d  k r t j } n  | d | | ƒ | d | j |  f ƒ | d  k	 r^ | j | | ƒ n  d  S(   Ns   Could not fetch URL %s: %ss7   Will skip URL %s when looking for download links for %s(   Rj   R    R{   R;   RÙ   (   R€   RU   Rþ   R;   R!   RØ   Rå   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRñ   È  s    c         C   sx   | d k r t ƒ  } n  t j |  ƒ \ } } } } } | d	 k rF d S| j |  d t ƒ} | j ƒ  | j j d d ƒ S(
   s;   Get the Content-Type of the given url, using a HEAD requestR   R   t   ftpt   ftpsRh   t   allow_redirectss   Content-TypeN(   s   https   httpss   ftps   ftps(	   Rj   R   R
   t   urlsplitt   headR2   Rì   RÞ   RÒ   (   R;   R.   Rr   Rt   R:   Rú   Rû   Rü   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRê   Ô  s    
c         C   s´   t  |  d ƒ s­ d  } g  |  j j d ƒ D]* } | j d d ƒ j ƒ  d k r( | ^ q( } | r¡ y  t | d j d d  ƒ ƒ } Wq¡ t t f k
 r� d  } q¡ Xn  | |  _	 n  |  j	 S(   Nt   _api_versions   .//metaRw   Rh   s   api-versioni    RÖ   (
   t   hasattrRj   R�   t   findallRÒ   Rx   t   intt	   TypeErrort
   ValueErrorR  (   R/   R  t   xt   metas(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   api_versionå  s    * c         C   sg   t  |  d ƒ s` |  j j d ƒ } | d  k	 rQ | j d ƒ rQ | j d ƒ |  _ q` |  j |  _ n  |  j S(   Nt	   _base_urls   .//baset   href(   R  R�   t   findRj   RÒ   R  R;   (   R/   R¡   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   base_urlô  s    c         c   sÅ   x¾ |  j  j d ƒ D]ª } | j d ƒ r | j d ƒ } |  j t j |  j | ƒ ƒ } d } |  j r¦ |  j d k r¦ t	 | j d ƒ o� d | j d ƒ j
 ƒ  k ƒ } n  t | |  d | ƒVq q Wd S(   s   Yields all links in the pages   .//aR  i   t   relR„   N(   R�   R  RÒ   t
   clean_linkR
   Rë   R  Rj   R  Rƒ   Ræ   Rk   (   R/   t   anchorR  R;   R„   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR4   þ  s    !c         c   s<   x |  j  ƒ  D] } | Vq Wx |  j ƒ  D] } | Vq) Wd  S(   N(   t   explicit_rel_linkst   scraped_rel_links(   R/   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR¤     s    	t   homepaget   downloadc         c   s·   t  | ƒ } x¤ |  j j d ƒ D]� } | j d ƒ r | j d ƒ r t  | j d ƒ j ƒ  ƒ } | | @r¯ | j d ƒ } |  j t j |  j | ƒ ƒ } t	 | |  d t
 ƒVq¯ q q Wd S(   s)   Yields all links with the given relationss   .//aR  R  Rf   N(   R"   R�   R  RÒ   Ræ   R  R
   Rë   R  Rk   R(   (   R/   t   relsR  t
   found_relsR  R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR    s    
c      
   c   sÝ   xÖ |  j  |  j f D]Â } | j |  j ƒ } | s7 q n  |  j j |  j d | j ƒ  ƒ} | sd q n  | j d ƒ pŽ | j d ƒ pŽ | j d ƒ } | s� q n  |  j t j	 |  j
 | ƒ ƒ } t | |  d t d t ƒVq Wd  S(   Nt   posi   i   i   Rf   R†   (   t   _homepage_ret   _download_reR¹   RÜ   t   _href_ret   endR»   R  R
   Rë   R  Rk   R(   R2   (   R/   t   regexRÀ   t
   href_matchR;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR  &  s    !-s   [^a-z0-9$&+,/:;=?@.#%_\\|-]c         C   s   |  j  j d „  | ƒ S(   s¨   Makes sure a link is fully encoded.  That is, if a ' ' shows up in
        the link, it will be rewritten to %20 (while not over-quoting
        % or other characters).c         S   s   d t  |  j d ƒ ƒ S(   Ns   %%%2xi    (   t   ordR»   (   RÀ   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   <lambda><  s    (   t	   _clean_ret   sub(   R/   R;   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR  7  s    	N(   s   homepages   download(   RÈ   RÉ   RÊ   RË   RÌ   RÎ   R  R  t   SR  Rj   R0   Rß   t   classmethodR2   RÇ   t   staticmethodRñ   Rê   t   propertyR  R  R4   R¤   R  R  R#  R  (    (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRÆ   Z  s(   	[
		Rk   c           B   s+  e  Z d d d e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z e d
 „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z e d „  ƒ Z e d „  ƒ Z e j d ƒ Z e d „  ƒ Z e j d ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z RS(   c         C   s1   | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R;   R²   R„   Rf   R†   (   R/   R;   R²   R„   Rf   R†   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR0   A  s
    				c         C   s.   |  j  r d |  j |  j  f St |  j ƒ Sd  S(   Ns   %s (from %s)(   R²   R;   Rq   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRß   I  s    	c         C   s   d |  S(   Ns	   <Link %s>(    (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __repr__O  s    c         C   s   |  j  | j  k S(   N(   R;   (   R/   t   other(    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __eq__R  s    c         C   s   |  j  | j  k S(   N(   R;   (   R/   R*  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __ne__U  s    c         C   s   |  j  | j  k  S(   N(   R;   (   R/   R*  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __lt__X  s    c         C   s   |  j  | j  k S(   N(   R;   (   R/   R*  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __le__[  s    c         C   s   |  j  | j  k S(   N(   R;   (   R/   R*  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __gt__^  s    c         C   s   |  j  | j  k S(   N(   R;   (   R/   R*  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __ge__a  s    c         C   s   t  |  j ƒ S(   N(   t   hashR;   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   __hash__d  s    c         C   s\   t  j |  j ƒ \ } } } } } t j | j d ƒ ƒ p< | } | sX t d |  j ƒ ‚ | S(   NR`   s   URL %r produced no filename(   R
   R  R;   Ra   Rœ   R�   t   AssertionError(   R/   RV   Rt   R:   Rw   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRP   g  s    !c         C   s   t  j |  j ƒ d S(   Ni    (   R
   R  R;   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRr   n  s    c         C   s   t  j |  j ƒ d S(   Ni   (   R
   R  R;   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR:   r  s    c         C   s   t  t j |  j j d ƒ ƒ ƒ S(   NR`   (   R   Ra   Rœ   R:   R�   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR   v  s    c         C   s   |  j  ƒ  d S(   Ni   (   R   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRO   y  s    c         C   s=   t  j |  j ƒ \ } } } } } t  j | | | | d  f ƒ S(   N(   R
   R  R;   t
   urlunsplitRj   (   R/   Rr   Rt   R:   Rú   Rû   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   url_without_fragment}  s    !s   #egg=([^&]*)c         C   s,   |  j  j |  j ƒ } | s d  S| j d ƒ S(   Ni   (   RÍ   R¹   R;   Rj   R»   (   R/   RÀ   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR¨   „  s    s2   (sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)c         C   s,   |  j  j |  j ƒ } | r( | j d ƒ Sd  S(   Ni   (   t   _hash_reR¹   R;   R»   Rj   (   R/   RÀ   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR1  �  s    c         C   s,   |  j  j |  j ƒ } | r( | j d ƒ Sd  S(   Ni   (   R6  R¹   R;   R»   Rj   (   R/   RÀ   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt	   hash_name”  s    c         C   s0   t  j |  j j d d ƒ d j d d ƒ d ƒ S(   NRà   i   i    t   ?(   Ra   Rœ   R;   Ræ   (   R/   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   show_url›  s    c         C   s¹   |  j  p t |  j d d ƒ } | d k	 r¥ | r¥ y% t |  j d d ƒ } t | ƒ } Wn t t f k
 rt d } n X| d k s� | d k r‘ d S|  j rž t St	 Sn | d k	 rµ t	 Sd S(   sˆ   
        Returns True if this link can be verified after download, False if it
        cannot, and None if we cannot determine.
        Rf   R  i   N(
   Rf   R¶   R²   Rj   R  R	  R  R1  R2   R(   (   R/   Rf   R  (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR…   Ÿ  s    
	N(   RÈ   RÉ   Rj   R(   R0   Rß   R)  R+  R,  R-  R.  R/  R0  R2  R(  RP   Rr   R:   R   RO   R5  RË   RÌ   RÍ   R¨   R6  R1  R7  R9  R…   (    (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyRk   ?  s0   											c         C   s;   t  |  ƒ } | j } | s1 t | j ƒ d } n  t | ƒ S(   sP   Get a requirement from the URL, if possible.  This looks for #egg
    in the URLi    (   Rk   R¨   R   RP   t   package_to_requirement(   R;   RU   R¿   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   get_requirement_from_urlÈ  s
    	c         C   sa   t  j d |  ƒ } | r9 | j d ƒ } | j d ƒ } n |  } d } | rY d | | f S| Sd S(   s)   Translate a name like Foo-1.2 to Foo==1.3s   ^(.*?)-(dev|\d.*)i   i   Rh   s   %s==%sN(   RË   R¹   R»   (   t   package_nameRÀ   Rw   R~   (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyR:  Ò  s    (2   RÊ   R¼   R?   RË   R7   Ra   t   pip.logR    t   pip.utilR   R   R   R   t   pip.exceptionsR   R   R   R   R	   t   pip.backwardcompatR
   R   t   pip.downloadR   R   R   t	   pip.wheelR   R   t   pip.pep425tagsR   R   R   t   pip._vendorR   R   R   t   pip._vendor.requests.exceptionsR   t   __all__t   DEFAULT_MIRROR_HOSTNAMERs   t   objectR   R    RÆ   Rk   RN   R;  R:  (    (    (    s0   /var/www/testScraper/venv/build/pip/pip/index.pyt   <module>   s6   "(	ÿ ÿ å†	
