
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
ÝPfml  ã               @   sŽ  d dl m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d dlZd dlmZ d dlmZmZmZ d dlmZmZmZmZmZmZ d dl m!Z! d dl"m#Z# d d	l$m%Z% d d
l&m'Z' e%�rd dlm(Z) nd dlm)Z) dddddddddddddddddddd d!d"d#d$gZ*e	j+e,ƒZ-dzZ.d{Z/d|Z0d}Z1e0e. e1 e/ Z2e0e1 Z3yd dl4Z4e3e.7 Z3W n  e5k
�r²   e-j6d1ƒ Y nX yd dl7Z7e3e/7 Z3W n  e5k
�rè   e-j6d2ƒ Y nX d3d4„ Z8d5d!„ Z9d6d„ Z:e'd7d8d9�d~d;d„ƒZ;d<d=„ Z<d>d„ Z=dd@d„Z>dAdB„ Z?dCd„ Z@dDd„ ZAdEd„ ZBdFd„ ZCdGd„ ZDejEfdHdI„ZFdJd„ ZGdKd„ ZHd€dMd„ZIdNd„ ZJdOd„ ZKdPdQ„ ZLdRdS„ ZMdTdU„ ZNdVdW„ ZOdXdY„ ZPdZd[„ ZQdLedLd:d:fd\d]„ZRd^d_„ ZSd`da„ ZTdbd„ ZUdcdd„ ZVd�ded„ZWdfd„ ZXdgd„ ZYd‚did„ZZdjdk„ Z[dldm„ Z\G dndo„ doe]ƒZ^G dpdq„ dqe)ƒZ_ej`drds„ ƒZadtd „ ZbG dudv„ dve]ƒZcdƒdwd$„Zddxdy„ ZedS )„é    )Úabsolute_import)ÚdequeN)ÚInstallationError)Úconsole_to_strÚ
expanduserÚstdlib_pkgs)Úsite_packagesÚ	user_siteÚrunning_under_virtualenvÚvirtualenv_no_globalÚwrite_delete_marker_fileÚdistutils_scheme)Úpkg_resources)Úinput)ÚPY2)Úretry)ÚBytesIO)ÚStringIOÚrmtreeÚdisplay_pathÚ
backup_dirÚaskÚsplitextÚformat_sizeÚis_installable_dirÚis_svn_pageÚfile_contentsÚsplit_leading_dirÚhas_leading_dirÚnormalize_pathÚrenamesÚget_terminal_sizeÚget_progÚ
unzip_fileÚ
untar_fileÚunpack_fileÚcall_subprocessÚcaptured_stdoutÚ
ensure_dirÚARCHIVE_EXTENSIONSÚSUPPORTED_EXTENSIONSÚget_installed_versionú.tar.bz2ú.tbzú.tar.xzú.txzú.tlzú.tar.lzú	.tar.lzmaú.zipú.whlú.tar.gzú.tgzú.tarzbz2 module is not availablezlzma module is not availablec             O   s,   yt | ƒS  tk
r&   |||Ž‚Y nX d S )N)Ú
__import__ÚImportError)Zpkg_or_module_stringZExceptionTypeÚargsÚkwargs© r<   ú/usr/lib/python3.6/__init__.pyÚimport_or_raiseI   s    r>   c             C   sD   yt j| ƒ W n0 tk
r> } z|jtjkr.‚ W Y dd}~X nX dS )z os.path.makedirs without EEXIST.N)ÚosÚmakedirsÚOSErrorÚerrnoZEEXIST)ÚpathÚer<   r<   r=   r(   P   s
    c               C   sD   y$t jjtjd ƒdkr"dtj S W n tttfk
r>   Y nX dS )Nr   ú__main__.pyú-cz	%s -m pipZpip)rE   rF   )	r?   rC   ÚbasenameÚsysÚargvÚ
executableÚAttributeErrorÚ	TypeErrorÚ
IndexErrorr<   r<   r<   r=   r"   Y   s    i¸  iô  )Zstop_max_delayZ
wait_fixedFc             C   s   t j| |td� d S )N)Úignore_errorsÚonerror)Úshutilr   Úrmtree_errorhandler)ÚdirrN   r<   r<   r=   r   c   s    c             C   s2   t j|ƒjtj@ r,t j|tjƒ | |ƒ dS ‚ dS )zÑOn Windows, the files in .svn are read-only, so when rmtree() tries to
    remove them, an exception is thrown.  We catch that here, remove the
    read-only attribute, and hopefully continue without problems.N)r?   ÚstatÚst_modeÚS_IREADÚchmodÚS_IWRITE)ÚfuncrC   Úexc_infor<   r<   r=   rQ   i   s
    rQ   c             C   st   t jjt jj| ƒƒ} tjd dkrB| jtjƒ dƒ} | jtj	ƒ dƒ} | j
t jƒ t jj ƒrpd| tt jƒ ƒd…  } | S )zTGives the display value for a given path, making it relative to cwd
    if possible.r   é   ÚreplaceÚ.N)r?   rC   ÚnormcaseÚabspathrH   Úversion_infoÚdecodeÚgetfilesystemencodingÚencodeÚgetdefaultencodingÚ
startswithÚgetcwdÚsepÚlen)rC   r<   r<   r=   r   x   s    ú.bakc             C   s:   d}|}x(t jj| | ƒr0|d7 }|t|ƒ }q
W | | S )z\Figure out the name of a directory to back up the given dir to
    (adding .bak, .bak2, etc)é   )r?   rC   ÚexistsÚstr)rR   ÚextÚnÚ	extensionr<   r<   r=   r   „   s    c             C   s2   x&t jjddƒjƒ D ]}||kr|S qW t| |ƒS )NZPIP_EXISTS_ACTIONÚ )r?   ÚenvironÚgetÚsplitr   )ÚmessageÚoptionsÚactionr<   r<   r=   Úask_path_exists�   s    rv   c             C   sZ   xTt jjdƒrtd|  ƒ‚t| ƒ}|jƒ jƒ }||krNtd|dj|ƒf ƒ q|S qW dS )z@Ask the message interactively, with the given possible responsesZPIP_NO_INPUTz7No input was expected ($PIP_NO_INPUT set); question: %sz<Your response (%r) was not one of the expected responses: %sz, N)	r?   rp   rq   Ú	Exceptionr   ÚstripÚlowerÚprintÚjoin)rs   rt   Zresponser<   r<   r=   r   –   s    c             C   sL   | dkrd| d d  S | d	kr,d| d  S | dkr@d| d  S d|  S d S )
Niè  z%.1fMBg     @�@é
   z%ikBz%.1fkBz%ibytesi@B i'  r<   )Úbytesr<   r<   r=   r   ©   s    c             C   s2   t jj| ƒsdS t jj| dƒ}t jj|ƒr.dS dS )z@Return True if `path` is a directory containing a setup.py file.Fzsetup.pyT)r?   rC   Úisdirr{   Úisfile)rC   Zsetup_pyr<   r<   r=   r   ´   s    c             C   s   t jd| ƒot jd| t jƒS )zT
    Returns true if the page appears to be the index page of an svn repository
    z<title>[^<]*Revision \d+:z#Powered by (?:<a[^>]*?>)?Subversion)ÚreÚsearchÚI)Zhtmlr<   r<   r=   r   ¾   s    c          	   C   s$   t | dƒ�}|jƒ jdƒS Q R X d S )NÚrbzutf-8)ÚopenÚreadr`   )ÚfilenameÚfpr<   r<   r=   r   Æ   s    c             c   s    x| j |ƒ}|sP |V  qW dS )z7Yield pieces of data from a file-like object until EOF.N)r…   )ÚfileÚsizeÚchunkr<   r<   r=   Úread_chunksË   s
    
r‹   c             C   sh   | j dƒj dƒ} d| krHd| kr4| jdƒ| jdƒk s<d| krH| jddƒS d| kr\| jddƒS | dfS d S )Nú/ú\ri   ro   )ÚlstripÚfindrr   )rC   r<   r<   r=   r   Ô   s    $c             C   sD   d}x:| D ]2}t |ƒ\}}|s"dS |dkr0|}q
||kr
dS q
W dS )zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r   )ÚpathsZcommon_prefixrC   ÚprefixÚrestr<   r<   r=   r   ß   s    
Tc             C   s2   t | ƒ} |rtjj| ƒ} ntjj| ƒ} tjj| ƒS )zN
    Convert a path to its canonical, case-normalized, absolute version.

    )r   r?   rC   Úrealpathr^   r]   )rC   Zresolve_symlinksr<   r<   r=   r   î   s
    c             C   s@   t j| ƒ\}}|jƒ jdƒr8|dd… | }|dd… }||fS )z,Like os.path.splitext, but take off .tar tooz.taré   Néüÿÿÿr•   )Ú	posixpathr   ry   Úendswith)rC   Úbaserl   r<   r<   r=   r   û   s
    c             C   s|   t jj|ƒ\}}|r0|r0t jj|ƒ r0t j|ƒ tj| |ƒ t jj| ƒ\}}|rx|rxyt j|ƒ W n tk
rv   Y nX dS )z7Like os.renames(), but handles renaming across devices.N)	r?   rC   rr   rj   r@   rP   ZmoveÚ
removedirsrA   )ÚoldÚnewÚheadÚtailr<   r<   r=   r      s    
c             C   s   t ƒ s
dS t| ƒjttjƒƒS )z›
    Return True if path is within sys.prefix, if we're running in a virtualenv.

    If we're not in a virtualenv, all paths are considered "local."

    T)r
   r   rd   rH   r‘   )rC   r<   r<   r=   Úis_local  s    rž   c             C   s   t t| ƒƒS )z�
    Return True if given Distribution object is installed locally
    (i.e. within current virtualenv).

    Always True if we're not in a virtualenv.

    )rž   Údist_location)Údistr<   r<   r=   Údist_is_local!  s    r¡   c             C   s   t t| ƒƒ}|jt tƒƒS )zF
    Return True if given Distribution is installed in user site.
    )r   rŸ   rd   r	   )r    Ú	norm_pathr<   r<   r=   Údist_in_usersite,  s    r£   c             C   s   t t| ƒƒjt tƒƒS )ze
    Return True if given Distribution is installed in
    distutils.sysconfig.get_python_lib().
    )r   rŸ   rd   r   )r    r<   r<   r=   Údist_in_site_packages4  s    
r¤   c             C   s,   t t| ƒƒ}|jt tdƒd jdƒd ƒƒS )zf
    Return True if given Distribution is installed in
    path matching distutils_scheme layout.
    ro   ÚpurelibÚpythonr   )r   rŸ   rd   r   rr   )r    r¢   r<   r<   r=   Údist_in_install_path>  s    r§   c             C   s8   x2t jD ](}tjj|| jd ƒ}tjj|ƒrdS qW dS )z$Is distribution an editable install?z	.egg-linkTF)rH   rC   r?   r{   Úproject_namer   )r    Z	path_itemÚegg_linkr<   r<   r=   Údist_is_editableH  s
    rª   c                sl   | r
t ‰ndd„ ‰|r dd„ ‰ ndd„ ‰ |r6dd„ ‰ndd„ ‰|rHt‰nd	d
„ ‰‡ ‡‡‡‡fdd„tjD ƒS )aï  
    Return a list of installed Distribution objects.

    If ``local_only`` is True (default), only return installations
    local to the current virtualenv, if in a virtualenv.

    ``skip`` argument is an iterable of lower-case project names to
    ignore; defaults to stdlib_pkgs

    If ``editables`` is False, don't report editables.

    If ``editables_only`` is True , only report editables.

    If ``user_only`` is True , only report installations in the user
    site directory.

    c             S   s   dS )NTr<   )Údr<   r<   r=   Ú
local_testj  s    z/get_installed_distributions.<locals>.local_testc             S   s   dS )NTr<   )r«   r<   r<   r=   Úeditable_testn  s    z2get_installed_distributions.<locals>.editable_testc             S   s
   t | ƒ S )N)rª   )r«   r<   r<   r=   r­   q  s    c             S   s   t | ƒS )N)rª   )r«   r<   r<   r=   Úeditables_only_testu  s    z8get_installed_distributions.<locals>.editables_only_testc             S   s   dS )NTr<   )r«   r<   r<   r=   r®   x  s    c             S   s   dS )NTr<   )r«   r<   r<   r=   Ú	user_test~  s    z.get_installed_distributions.<locals>.user_testc                s:   g | ]2}ˆ|ƒr|j ˆkrˆ |ƒrˆ|ƒrˆ|ƒr|‘qS r<   )Úkey)Ú.0r«   )r­   r®   r¬   Úskipr¯   r<   r=   ú
<listcomp>�  s    
z/get_installed_distributions.<locals>.<listcomp>)r¡   r£   r   Úworking_set)Z
local_onlyr²   Zinclude_editablesZeditables_onlyZ	user_onlyr<   )r­   r®   r¬   r²   r¯   r=   Úget_installed_distributionsQ  s    

rµ   c             C   s„   g }t ƒ r6tƒ r|jtƒ qN|jtƒ trN|jtƒ ntrD|jtƒ |jtƒ x0|D ](}tjj|| jƒd }tjj	|ƒrT|S qTW dS )a  
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE
       (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2
    locations.

    This method will just return the first one found.
    z	.egg-linkN)
r
   r   Úappendr   r	   r?   rC   r{   r¨   r   )r    ZsitesZsiteZegglinkr<   r<   r=   Úegg_link_pathŠ  s    



r·   c             C   s   t | ƒ}|r|S | jS )zÿ
    Get the site-packages location of this distribution. Generally
    this is dist.location, except in the case of develop-installed
    packages, where dist.location is the source code location, and we
    want to know where the egg-link file is.

    )r·   Úlocation)r    r©   r<   r<   r=   rŸ   ¯  s    rŸ   c           
   C   s’   dd„ } | dƒp| dƒp| dƒ}|sZy(t jt jƒ t jƒ}| |ƒ}t j|ƒ W n   Y nX |szt jjddƒt jjdd	ƒf}t|d ƒt|d ƒfS )
zlReturns a tuple (x, y) representing the width(x) and the height(x)
    in characters of the terminal window.c             S   sP   y4dd l }dd l}dd l}|jd|j| |jdƒƒ}W n
   d S |dkrLd S |S )Nr   ZhhZ1234)r   r   )ÚfcntlÚtermiosÚstructÚunpackZioctlZ
TIOCGWINSZ)Úfdr¹   rº   r»   Úcrr<   r<   r=   Úioctl_GWINSZÀ  s    z'get_terminal_size.<locals>.ioctl_GWINSZr   ri   rZ   ZLINESé   ZCOLUMNSéP   )r?   r„   ÚctermidÚO_RDONLYÚcloserp   rq   Úint)r¿   r¾   r½   r<   r<   r=   r!   ½  s    c              C   s   t jdƒ} t j| ƒ | S )zBGet the current umask which involves having to set it temporarily.r   )r?   Úumask)Úmaskr<   r<   r=   Úcurrent_umaskÛ  s    

rÈ   c             C   s  t |ƒ t| dƒ}zòtj|dd�}t|jƒ ƒo0|}xÎ|jƒ D ]Â}|j}|j|ƒ}|}	|rdt	|ƒd }	t
jj||	ƒ}	t
jj|	ƒ}
|	jdƒs’|	jdƒrœt |	ƒ q<t |
ƒ t|	dƒ}z|j|ƒ W d|jƒ  |jd	? }|rütj|ƒrü|d
@ rüt
j|	dtƒ  d
B ƒ X q<W W d|jƒ  X dS )aŸ  
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    rƒ   T)Z
allowZip64ri   rŒ   r�   ÚwbNé   éI   iÿ  )r(   r„   ÚzipfileZZipFiler   ZnamelistZinfolistr†   r…   r   r?   rC   r{   Údirnamer—   ÚwriterÄ   Zexternal_attrrS   ÚS_ISREGrV   rÈ   )r†   r¸   ÚflattenZzipfpÚzipÚleadingÚinfoÚnameÚdataÚfnrR   r‡   Úmoder<   r<   r=   r#   â  s0    	




 c          (   C   s@  t |ƒ | jƒ jdƒs$| jƒ jdƒr*d}nL| jƒ jtƒr>d}n8| jƒ jtƒrRd}n$| jƒ jdƒrfd}ntjd| ƒ d	}tj| |ƒ}�z¬t	d
d„ |j
ƒ D ƒƒ}�xŽ|j
ƒ D �]€}|j}|dkr¾q¨|rÎt|ƒd }tjj||ƒ}ytj|j|d�|ƒ W n tjk
�r   Y nX |jƒ �r"t |ƒ q¨|jƒ �rxy|j||ƒ W n8 tk
�rt } ztjd| |j|ƒ w¨W Y dd}~X nX q¨y|j|ƒ}	W n< ttfk
�rÂ } ztjd| |j|ƒ w¨W Y dd}~X nX t tjj|ƒƒ t|dƒ�}
tj|	|
ƒ W dQ R X |	jƒ  |j||ƒ |jd@ r¨tj |dt!ƒ  dB ƒ q¨W W d|jƒ  X dS )aŸ  
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*c             S   s   g | ]}|j d kr|j ‘qS )Úpax_global_header)rÔ   )r±   Úmemberr<   r<   r=   r³   (  s    zuntar_file.<locals>.<listcomp>rÙ   ri   )rÔ   z/In the tar file %s the member %s is invalid: %sNrÉ   rË   iÿ  )"r(   ry   r—   ÚBZ2_EXTENSIONSÚXZ_EXTENSIONSÚloggerÚwarningÚtarfiler„   r   Z
getmembersrÔ   r   r?   rC   r{   Zdata_filterr[   ZLinkOutsideDestinationErrorr~   ZissymZ_extract_memberrw   ZextractfileÚKeyErrorrK   rÍ   rP   ZcopyfileobjrÄ   Úutimer×   rV   rÈ   )r†   r¸   r×   ZtarrÒ   rÚ   rÖ   rC   Úexcr‡   Zdestfpr<   r<   r=   r$     sh    	



c             C   sÔ   t jj| ƒ} |dks,| jƒ jtƒs,tj| ƒrDt| || jdƒ d� nŒ|dkslt	j
| ƒsl| jƒ jtt t ƒrxt| |ƒ nX|r´|jdƒr´tt| ƒƒr´ddlm} |d|j ƒj|ƒ ntjd	| ||ƒ td
| ƒ‚d S )Nzapplication/zipz.whl)rÐ   zapplication/x-gzipz	text/htmlr   )Ú
Subversionzsvn+zZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of %s)r?   rC   r“   ry   r—   ÚZIP_EXTENSIONSrÌ   Z
is_zipfiler#   rß   Z
is_tarfileÚTAR_EXTENSIONSrÛ   rÜ   r$   rd   r   r   Zpip.vcs.subversionrã   Zurlr¼   rÝ   Úcriticalr   )r†   r¸   Zcontent_typeÚlinkrã   r<   r<   r=   r%   `  s,    


Úraisec             C   s,  |r
d }nt j}|d krng }xF| D ]>}	d|	ksFd|	ksFd|	ksFd|	krVd|	jddƒ }	|j|	ƒ q"W dj|ƒ}tjd|ƒ tjj	ƒ }
|r’|
j
|ƒ yt j| t jd |||
d�}W n2 tk
rà } ztjd	||ƒ ‚ W Y d d }~X nX |d k	�rNg }x\t|jjƒ ƒ}|�sP |jƒ }|j|d ƒ tjƒ tjk�r:tj|ƒ qò|d k	rò|jƒ  qòW |jƒ  |d k	�r~|j�rt|jd
ƒ n
|jdƒ |j�r|dk�rÞtjƒ tjk�rÈ| �rÈtjd|ƒ tjdj|ƒd ƒ td||j|f ƒ‚n:|dk�rütjd||j|ƒ n|dk�rntdt|ƒ ƒ‚|�s(dj|ƒS d S )Nú Ú
ú"ú'z"%s"z\"zRunning command %s)ÚstderrÚstdinÚstdoutÚcwdÚenvz#Error %s while executing command %sÚerrorÚdonerè   z Complete output from command %s:ro   z)
----------------------------------------z,Command "%s" failed with error code %s in %sÚwarnz$Command "%s" had error code %s in %sÚignorezInvalid value: on_returncode=%s)Ú
subprocessÚPIPEr[   r¶   r{   rÝ   Údebugr?   rp   ÚcopyÚupdateÚPopenZSTDOUTrw   ræ   r   rï   ÚreadlineÚrstripZgetEffectiveLevelÚstd_loggingÚDEBUGZspinÚwaitÚ
returncodeZfinishrÓ   r   rÞ   Ú
ValueErrorÚrepr)ÚcmdZshow_stdoutrð   Zon_returncodeZcommand_descZextra_environZspinnerrï   Z	cmd_partsÚpartrñ   Úprocrâ   Z
all_outputÚliner<   r<   r=   r&   �  sz    
 










c             C   sh   t | dƒ�}|jƒ }W dQ R X dtjdƒdg}x4|D ],}y|j|ƒ}W n tk
r\   w4Y nX P q4W |S )aR  Return the contents of *filename*.

    Try to decode the file contents with utf-8, the preferred system encoding
    (e.g., cp1252 on some Windows machines), and latin1, in that order.
    Decoding a byte string with latin1 will never raise an error. In the worst
    case, the returned string will contain some garbage characters.

    rƒ   Nzutf-8FÚlatin1)r„   r…   ÚlocaleÚgetpreferredencodingr`   ÚUnicodeDecodeError)r†   r‡   rÕ   Z	encodingsÚencr<   r<   r=   Úread_text_fileã  s    	
r  c             C   s   t j| ƒ t| ƒ d S )N)r?   r@   r   )Z	build_dirr<   r<   r=   Ú_make_build_dirû  s    
r  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚFakeFilezQWrap a list of lines in an object with readline() to make
    ConfigParser happy.c             C   s   dd„ |D ƒ| _ d S )Nc             s   s   | ]
}|V  qd S )Nr<   )r±   Úlr<   r<   r=   ú	<genexpr>  s    z$FakeFile.__init__.<locals>.<genexpr>)Ú_gen)ÚselfÚlinesr<   r<   r=   Ú__init__  s    zFakeFile.__init__c             C   sD   y*y
t | jƒS  tk
r&   | jj ƒ S X W n tk
r>   dS X d S )Nro   )Únextr  Ú	NameErrorÚStopIteration)r  r<   r<   r=   rü     s    
zFakeFile.readlinec             C   s   | j S )N)r  )r  r<   r<   r=   Ú__iter__  s    zFakeFile.__iter__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r  rü   r  r<   r<   r<   r=   r     s   	r  c               @   s$   e Zd Zedd„ ƒZedd„ ƒZdS )ÚStreamWrapperc             C   s   || _ | ƒ S )N)Úorig_stream)Úclsr  r<   r<   r=   Úfrom_stream  s    zStreamWrapper.from_streamc             C   s   | j jS )N)r  Úencoding)r  r<   r<   r=   r"    s    zStreamWrapper.encodingN)r  r  r  Úclassmethodr!  Úpropertyr"  r<   r<   r<   r=   r    s   r  c             c   s@   t t| ƒ}tt| tj|ƒƒ zt t| ƒV  W dtt| |ƒ X dS )zËReturn a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.

    Taken from Lib/support/__init__.py in the CPython repo.
    N)ÚgetattrrH   Úsetattrr  r!  )Zstream_nameZorig_stdoutr<   r<   r=   Úcaptured_output   s
    
r'  c               C   s   t dƒS )zÜCapture the output of sys.stdout:

       with captured_stdout() as stdout:
           print('hello')
       self.assertEqual(stdout.getvalue(), 'hello
')

    Taken from Lib/support/__init__.py in the CPython repo.
    rï   )r'  r<   r<   r<   r=   r'   /  s    	c               @   s    e Zd ZdZdd„ Zdd„ ZdS )Úcached_propertyzôA property that is only computed once per instance and then replaces
       itself with an ordinary attribute. Deleting the attribute resets the
       property.

       Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175
    c             C   s   t |dƒ| _|| _d S )Nr  )r%  r  rX   )r  rX   r<   r<   r=   r  C  s    zcached_property.__init__c             C   s(   |d kr| S | j |ƒ }|j| j j< |S )N)rX   Ú__dict__r  )r  Úobjr   Úvaluer<   r<   r=   Ú__get__G  s    zcached_property.__get__N)r  r  r  r  r  r,  r<   r<   r<   r=   r(  ;  s   r(  c             C   s@   t jj| ƒ}|dkrt jƒ }n
t j|ƒ}|j|ƒ}|r<|jS dS )zCGet the installed version of dist_name avoiding pkg_resources cacheN)r   ZRequirementÚparseZ
WorkingSetr�   Úversion)Z	dist_nameZlookup_dirsZreqr´   r    r<   r<   r=   r+   O  s    


c             C   s   t | dd� dS )zConsume an iterable at C speed.r   )ÚmaxlenN)r   )Úiteratorr<   r<   r=   Úconsumec  s    r1  )r,   r-   )r.   r/   r0   r1   r2   )r3   r4   )r5   r6   r7   )F)rh   )T)T)TNrè   NNN)N)fZ
__future__r   Úcollectionsr   Ú
contextlibrB   Úior	  Zloggingrþ   r€   r?   r–   rP   rS   rö   rH   rß   rÌ   Zpip.exceptionsr   Z
pip.compatr   r   r   Zpip.locationsr   r	   r
   r   r   r   Zpip._vendorr   Zpip._vendor.six.movesr   Zpip._vendor.sixr   Zpip._vendor.retryingr   r   r   Ú__all__Z	getLoggerr  rÝ   rÛ   rÜ   rä   rå   r)   r*   Úbz2r9   rø   Zlzmar>   r(   r"   r   rQ   r   r   rv   r   r   r   r   r   ÚDEFAULT_BUFFER_SIZEr‹   r   r   r   r   r    rž   r¡   r£   r¤   r§   rª   rµ   r·   rŸ   r!   rÈ   r#   r$   r%   r&   r  r  Úobjectr  r  Úcontextmanagerr'  r'   r(  r+   r1  r<   r<   r<   r=   Ú<module>   sÐ    
	



	
	

	5%
+S!   
_
