B
    =)H[•m  ã               @   s€  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 d dlmZ d dlmZ d dlmZ d dlmZmZmZ d d	lm Z  d d
l!m"Z"m#Z#m$Z$m%Z%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#gZ)e *e+¡Z,d$Z-d%Z.d&Z/d'Z0e/e- e0 e. Z1e/e0 Z2yd dl3Z3e2e-7 Z2W n  e4k
�r¬   e, 5d(¡ Y nX yd dl6Z6e2e.7 Z2W n  e4k
�râ   e, 5d)¡ Y nX d*d+„ Z7d,d „ Z8d-d„ Z9ed.d/d0�dpd2d„ƒZ:d3d4„ Z;d5d„ Z<dqd7d„Z=d8d9„ Z>d:d„ Z?d;d„ Z@d<d„ ZAd=d„ ZBd>d„ ZCejDfd?d@„ZEdAd„ ZFdBd„ ZGdrdDd„ZHdEd„ ZIdFd„ ZJdGdH„ ZKdIdJ„ ZLdKdL„ ZMdMdN„ ZNdOdP„ ZOdCedCd1d1fdQdR„ZPdSdT„ ZQdUdV„ ZRdWdX„ ZSdsdYd„ZTdZd„ ZUd[d„ ZVdtd]d„ZWd^d_„ ZXd`da„ ZYG dbdc„ dceZƒZ[G ddde„ dee(ƒZ\ej]dfdg„ ƒZ^dhd„ Z_G didj„ djeZƒZ`dudkd#„Zadldm„ Zbdndo„ ZcdS )vé    )Úabsolute_importN)Údeque)Úpkg_resources)Úretry)ÚPY2)Úinput)Úconsole_to_strÚ
expanduserÚstdlib_pkgs)ÚInstallationError)Úrunning_under_virtualenvÚsite_packagesÚ	user_siteÚvirtualenv_no_globalÚwrite_delete_marker_file)Ú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_progÚ
unzip_fileÚ
untar_fileÚunpack_fileÚcall_subprocessÚcaptured_stdoutÚ
ensure_dirÚARCHIVE_EXTENSIONSÚSUPPORTED_EXTENSIONSÚget_installed_version)z.tar.bz2z.tbz)z.tar.xzz.txzz.tlzz.tar.lzz	.tar.lzma)z.zipz.whl)z.tar.gzz.tgzz.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)Úpkg_or_module_stringÚExceptionTypeÚargsÚkwargs© r0   úYC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-qz7kpjmn\pip\pip\_internal\utils\misc.pyÚimport_or_raiseL   s    r2   c          
   C   sD   yt  | ¡ W n0 tk
r> } z|jtjkr.‚ W dd}~X Y nX dS )z os.path.makedirs without EEXIST.N)ÚosÚmakedirsÚOSErrorÚerrnoÚEEXIST)ÚpathÚer0   r0   r1   r&   S   s
    c           
   C   sL   y,t j tjd ¡} | dkr&dtj S | S W n tttfk
rF   Y nX dS )Nr   )z__main__.pyz-cz	%s -m pipÚpip)	r3   r8   ÚbasenameÚsysÚargvÚ
executableÚAttributeErrorÚ	TypeErrorÚ
IndexError)Úprogr0   r0   r1   r    \   s    
i¸  iô  )Ústop_max_delayÚ
wait_fixedFc             C   s   t j| |td� d S )N)Úignore_errorsÚonerror)Úshutilr   Úrmtree_errorhandler)ÚdirrE   r0   r0   r1   r   i   s    c             C   s2   t  |¡jtj@ r,t  |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)r3   ÚstatÚst_modeÚS_IREADÚchmodÚS_IWRITE)Úfuncr8   Úexc_infor0   r0   r1   rH   o   s
    rH   c             C   st   t j t j | ¡¡} tjd dkrB|  t ¡ d¡} |  t 	¡ d¡} |  
t  ¡ t jj ¡rpd| tt  ¡ ƒd…  } | S )zTGives the display value for a given path, making it relative to cwd
    if possible.r   é   ÚreplaceÚ.N)r3   r8   ÚnormcaseÚabspathr<   Úversion_infoÚdecodeÚgetfilesystemencodingÚencodeÚgetdefaultencodingÚ
startswithÚgetcwdÚsepÚlen)r8   r0   r0   r1   r   ~   s    ú.bakc             C   s:   d}|}x(t 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)é   )r3   r8   ÚexistsÚstr)rI   ÚextÚnÚ	extensionr0   r0   r1   r   Š   s    c             C   s2   x&t j dd¡ ¡ D ]}||kr|S qW t| |ƒS )NÚPIP_EXISTS_ACTIONÚ )r3   ÚenvironÚgetÚsplitr   )ÚmessageÚoptionsÚactionr0   r0   r1   Úask_path_exists•   s    rn   c             C   sZ   xTt j d¡rtd|  ƒ‚t| ƒ}| ¡  ¡ }||krNtd|d |¡f ƒ q|S qW dS )z@Ask the message interactively, with the given possible responsesÚPIP_NO_INPUTz7No input was expected ($PIP_NO_INPUT set); question: %sz<Your response (%r) was not one of the expected responses: %sz, N)	r3   rh   ri   Ú	Exceptionr   ÚstripÚlowerÚprintÚjoin)rk   rl   Úresponser0   r0   r1   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@B z%.1fMBg     @�@iè  i'  z%ikBz%.1fkBz%ibytesr0   )Úbytesr0   r0   r1   r   ¯   s    c             C   s2   t j | ¡sdS t j | d¡}t j |¡r.dS dS )z@Return True if `path` is a directory containing a setup.py file.Fzsetup.pyT)r3   r8   Úisdirrt   Úisfile)r8   Úsetup_pyr0   r0   r1   r   º   s    c             C   s   t  d| ¡ot  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)Úhtmlr0   r0   r1   r   Ä   s    c          	   C   s$   t | dƒ�}| ¡  d¡S Q R X d S )NÚrbzutf-8)ÚopenÚreadrW   )ÚfilenameÚfpr0   r0   r1   r   Ì   s    c             c   s    x|   |¡}|sP |V  qW dS )z7Yield pieces of data from a file-like object until EOF.N)r€   )ÚfileÚsizeÚchunkr0   r0   r1   Úread_chunksÑ   s
    
r†   c             C   sh   |   d¡  d¡} d| krHd| kr4|  d¡|  d¡k s<d| krH|  dd¡S d| kr\|  dd¡S | dfS d S )Nú/ú\r`   rg   )ÚlstripÚfindrj   )r8   r0   r0   r1   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   )ÚpathsÚcommon_prefixr8   ÚprefixÚrestr0   r0   r1   r   å   s    
Tc             C   s2   t | ƒ} |rtj | ¡} ntj | ¡} tj | ¡S )zN
    Convert a path to its canonical, case-normalized, absolute version.

    )r	   r3   r8   ÚrealpathrU   rT   )r8   Úresolve_symlinksr0   r0   r1   r   ô   s
    c             C   s@   t  | ¡\}}| ¡  d¡r8|dd… | }|dd… }||fS )z,Like os.path.splitext, but take off .tar tooz.taréüÿÿÿN)Ú	posixpathr   rr   Úendswith)r8   Úbaserc   r0   r0   r1   r     s
    c             C   sz   t j |¡\}}|r.|r.t j |¡s.t  |¡ t | |¡ t j | ¡\}}|rv|rvyt  |¡ W n tk
rt   Y nX dS )z7Like os.renames(), but handles renaming across devices.N)	r3   r8   rj   ra   r4   rG   ÚmoveÚ
removedirsr5   )ÚoldÚnewÚheadÚtailr0   r0   r1   r   
  s    
c             C   s   t ƒ s
dS t| ƒ 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   r[   r<   r�   )r8   r0   r0   r1   Ú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)Údistr0   r0   r1   Údist_is_local'  s    rž   c             C   s   t t| ƒƒ}| t tƒ¡S )zF
    Return True if given Distribution is installed in user site.
    )r   rœ   r[   r   )r�   Ú	norm_pathr0   r0   r1   Údist_in_usersite2  s    r    c             C   s   t t| ƒƒ t tƒ¡S )z[
    Return True if given Distribution is installed in
    sysconfig.get_python_lib().
    )r   rœ   r[   r   )r�   r0   r0   r1   Údist_in_site_packages:  s    
r¡   c             C   s8   x2t jD ](}tj || jd ¡}tj |¡rdS qW dS )z$Is distribution an editable install?z	.egg-linkTF)r<   r8   r3   rt   Úproject_namerx   )r�   Ú	path_itemÚegg_linkr0   r0   r1   Údist_is_editableD  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 ``include_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 )NTr0   )Údr0   r0   r1   Ú
local_testf  s    z/get_installed_distributions.<locals>.local_testc             S   s   dS )NTr0   )r¦   r0   r0   r1   Úeditable_testj  s    z2get_installed_distributions.<locals>.editable_testc             S   s
   t | ƒ S )N)r¥   )r¦   r0   r0   r1   r¨   m  s    c             S   s   t | ƒS )N)r¥   )r¦   r0   r0   r1   Úeditables_only_testq  s    z8get_installed_distributions.<locals>.editables_only_testc             S   s   dS )NTr0   )r¦   r0   r0   r1   r©   t  s    c             S   s   dS )NTr0   )r¦   r0   r0   r1   Ú	user_testz  s    z.get_installed_distributions.<locals>.user_testc                s:   g | ]2}ˆ|ƒr|j ˆkrˆ |ƒrˆ|ƒrˆ|ƒr|‘qS r0   )Úkey)Ú.0r¦   )r¨   r©   r§   Úskiprª   r0   r1   ú
<listcomp>}  s    
z/get_installed_distributions.<locals>.<listcomp>)rž   r    r   Úworking_set)Ú
local_onlyr­   Úinclude_editablesÚeditables_onlyÚ	user_onlyr0   )r¨   r©   r§   r­   rª   r1   Úget_installed_distributionsM  s    

r´   c             C   s„   g }t ƒ r6tƒ r| t¡ qN| t¡ trN| t¡ ntrD| t¡ | t¡ x0|D ](}tj || j¡d }t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   r3   r8   rt   r¢   rx   )r�   ÚsitesÚsiteÚegglinkr0   r0   r1   Ú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¤   r0   r0   r1   rœ   «  s    rœ   c              C   s   t  d¡} t  | ¡ | S )zBGet the current umask which involves having to set it temporarily.r   )r3   Úumask)Úmaskr0   r0   r1   Úcurrent_umask¹  s    

r½   c             C   s  t |ƒ t| dƒ}zòtj|dd�}t| ¡ ƒo0|}xÎ| ¡ D ]Â}|j}| |¡}|}	|rdt	|ƒd }	t
j ||	¡}	t
j |	¡}
|	 d¡s’|	 d¡rœt |	ƒ q<t |
ƒ t|	dƒ}z| |¡ W d| ¡  |jd	? }|rüt |¡rü|d
@ rüt
 |	dtƒ  d
B ¡ X q<W W d| ¡  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)Ú
allowZip64r`   r‡   rˆ   ÚwbNé   éI   iÿ  )r&   r   ÚzipfileÚZipFiler   ÚnamelistÚinfolistr�   r€   r   r3   r8   rt   Údirnamer“   ÚwriteÚcloseÚexternal_attrrJ   ÚS_ISREGrM   r½   )r�   rº   ÚflattenÚzipfpÚzipÚleadingÚinfoÚnameÚdataÚfnrI   r‚   Úmoder0   r0   r1   r!   À  s0    	




 c             C   s  t |ƒ |  ¡  d¡s$|  ¡  d¡r*d}nL|  ¡  t¡r>d}n8|  ¡  t¡rRd}n$|  ¡  d¡rfd}nt d| ¡ d	}t | |¡}�zxt	d
d„ | 
¡ D ƒƒ}�xZ| 
¡ D �]L}|j}|dkr¾q¨|rÎt|ƒd }tj ||¡}| ¡ rît |ƒ q¨| ¡ �rDy| ||¡ W n8 tk
�r@ } zt d| |j|¡ w¨W dd}~X Y nX q¨y| |¡}	W n< ttfk
�rŽ } zt d| |j|¡ w¨W dd}~X Y nX t tj |¡ƒ t|dƒ�}
t |	|
¡ W dQ R X |	 ¡  | ||¡ |jd@ r¨t |dtƒ  dB ¡ q¨W W d| ¡  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¬   Úmemberr0   r0   r1   r®     s    zuntar_file.<locals>.<listcomp>rÕ   r`   z/In the tar file %s the member %s is invalid: %sNr¿   rÁ   iÿ  )r&   rr   r“   ÚBZ2_EXTENSIONSÚXZ_EXTENSIONSÚloggerÚwarningÚtarfiler   r   Ú
getmembersrÐ   r   r3   r8   rt   rw   ÚissymÚ_extract_memberrp   ÚextractfileÚKeyErrorr?   rÆ   rG   ÚcopyfileobjrÈ   ÚutimerÓ   rM   r½   )r�   rº   rÓ   ÚtarrÎ   rÖ   rÒ   r8   Úexcr‚   Údestfpr0   r0   r1   r"   ë  s`    	


c             C   sÔ   t j | ¡} |dks,|  ¡  t¡s,t | ¡rDt| ||  d¡ d� nŒ|dkslt	 
| ¡sl|  ¡  tt t ¡rxt| |ƒ nX|r´| d¡r´tt| ƒƒr´ddlm} |d|j ƒ |¡ nt 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)r3   r8   r�   rr   r“   ÚZIP_EXTENSIONSrÂ   Ú
is_zipfiler!   rÛ   Ú
is_tarfileÚTAR_EXTENSIONSr×   rØ   r"   r[   r   r   Úpip._internal.vcs.subversionræ   ÚurlÚunpackrÙ   Úcriticalr   )r�   rº   Úcontent_typeÚlinkræ   r0   r0   r1   r#   7  s,    


Úraisec          
   C   s|  |dkrg }|rd}nt j}|dkrzg }	xF| D ]>}
d|
ksRd|
ksRd|
ksRd|
krbd|
 dd¡ }
|	 |
¡ q.W d |	¡}t d|¡ tj 	¡ }|rž| 
|¡ x|D ]}| |d¡ q¤W y(t j| t jt j|||d	�}|j ¡  W n4 tk
�r } zt d
||¡ ‚ W dd}~X Y nX g }|dk	�r†x`t|j ¡ ƒ}|�s<P | ¡ }| |d ¡ t ¡ tjk�rnt |¡ n|dk	�r&| ¡  �q&W z| ¡  W d|j�r¦|j ¡  X |dk	�rÐ|j�rÆ| d¡ n
| d¡ |j�rh|dk�r.t ¡ tjk�r|�st d|¡ t d |¡d ¡ td||j|f ƒ‚n:|dk�rLt d||j|¡ n|dk�rXnt dt!|ƒ ƒ‚|�sxd |¡S dS )z„
    Args:
      unset_environ: an iterable of environment variable names to unset
        prior to calling subprocess.Popen().
    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:rg   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ÚPIPErR   rµ   rt   rÙ   Údebugr3   rh   ÚcopyÚupdateÚpopÚPopenÚSTDOUTr÷   rÈ   rp   rî   r   rø   ÚreadlineÚrstripÚgetEffectiveLevelÚstd_loggingÚDEBUGÚspinÚwaitÚ
returncodeÚfinishrÏ   r   rÚ   Ú
ValueErrorÚrepr)ÚcmdÚshow_stdoutrù   Úon_returncodeÚcommand_descÚextra_environÚunset_environÚspinnerrø   Ú	cmd_partsÚpartrú   rÐ   Úprocrä   Ú
all_outputÚliner0   r0   r1   r$   X  sŠ    	
 












c          	   C   sx   t | dƒ�}| ¡ }W dQ R X dt d¡dg}x4|D ],}y| |¡}W n tk
r\   w4Y nX P q4W t|ƒtkstt‚|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ÚgetpreferredencodingrW   ÚUnicodeDecodeErrorÚtyperv   ÚAssertionError)r�   r‚   rÑ   Ú	encodingsÚencr0   r0   r1   Úread_text_fileÉ  s    	
r&  c             C   s   t  | ¡ t| ƒ d S )N)r3   r4   r   )Ú	build_dirr0   r0   r1   Ú_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 )Nr0   )r¬   Úlr0   r0   r1   ú	<genexpr>ê  s    z$FakeFile.__init__.<locals>.<genexpr>)Ú_gen)ÚselfÚlinesr0   r0   r1   Ú__init__é  s    zFakeFile.__init__c             C   sD   y*y
t | jƒS  tk
r&   | j  ¡ S X W n tk
r>   dS X d S )Nrg   )Únextr,  Ú	NameErrorÚStopIteration)r-  r0   r0   r1   r  ì  s    
zFakeFile.readlinec             C   s   | j S )N)r,  )r-  r0   r0   r1   Ú__iter__õ  s    zFakeFile.__iter__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r/  r  r3  r0   r0   r0   r1   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)Úclsr9  r0   r0   r1   Úfrom_streamû  s    zStreamWrapper.from_streamc             C   s   | j jS )N)r9  Úencoding)r-  r0   r0   r1   r<    s    zStreamWrapper.encodingN)r4  r5  r6  Úclassmethodr;  Úpropertyr<  r0   r0   r0   r1   r8  ù  s   r8  c          
   c   s@   t t| ƒ}tt| t |¡ƒ 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)Úgetattrr<   Úsetattrr8  r;  )Ústream_nameÚorig_stdoutr0   r0   r1   Úcaptured_output  s
    
rC  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ø   )rC  r0   r0   r0   r1   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 )Nr7  )r?  r7  rO   )r-  rO   r0   r0   r1   r/  )  s    zcached_property.__init__c             C   s(   |d kr| S |   |¡ }|j| j j< |S )N)rO   Ú__dict__r4  )r-  Úobjr:  Úvaluer0   r0   r1   Ú__get__-  s    zcached_property.__get__N)r4  r5  r6  r7  r/  rH  r0   r0   r0   r1   rD  !  s   rD  c             C   s@   t j | ¡}|dkrt  ¡ }n
t  |¡}| |¡}|r<|jS dS )zCGet the installed version of dist_name avoiding pkg_resources cacheN)r   ÚRequirementÚparseÚ
WorkingSetrŠ   Úversion)Ú	dist_nameÚlookup_dirsÚreqr¯   r�   r0   r0   r1   r)   5  s    


c             C   s   t | dd� dS )zConsume an iterable at C speed.r   )ÚmaxlenN)r   )Úiteratorr0   r0   r1   ÚconsumeI  s    rR  c              O   s@   t t| tt| ƒƒƒf|Ž}dd„ | ¡ D ƒ}||d< tdd|ƒS )Nc             S   s   i | ]\}}||“qS r0   r0   )r¬   r«   rG  r0   r0   r1   ú
<dictcomp>Q  s    zenum.<locals>.<dictcomp>Úreverse_mappingÚEnumr0   )ÚdictrÍ   Úranger^   Úitemsr"  )Ú
sequentialÚnamedÚenumsÚreverser0   r0   r1   ÚenumO  s    r]  )F)r_   )T)T)TNrñ   NNNN)N)dÚ
__future__r   Ú
contextlibr6   Úior  Úloggingr
  r3   r’   rz   rG   rJ   rÿ   r<   rÛ   rÂ   Úcollectionsr   Úpip._vendorr   Úpip._vendor.retryingr   Úpip._vendor.sixr   Úpip._vendor.six.movesr   Úpip._internal.compatr   r	   r
   Úpip._internal.exceptionsr   Úpip._internal.locationsr   r   r   r   r   r   r   Ú__all__Ú	getLoggerr4  rÙ   r×   rØ   rç   rê   r'   r(   Úbz2r+   r  Úlzmar2   r&   r    r   rH   r   r   rn   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(  Úobjectr)  r8  ÚcontextmanagerrC  r%   rD  r)   rR  r]  r0   r0   r0   r1   Ú<module>   sÎ   
	


	
	
	5%
+L!   
n
