U
    ißŽiåe  ã                   @   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mZ d dlmZ d dlmZ d dlmZmZ d dlmZ d dlmZ 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'm(Z(m)Z)m*Z* d dl+m,Z,m-Z- d dl.m/Z/m0Z0 e�r4d dlm1Z2 nd dlm2Z2 e,�rŒd dl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< d dl=m>Z> e;e?e?e?f Z@ddddddddddddd d!gZAe BeC¡ZDd"d#„ ZEd$d%„ ZFd&d„ ZGd'd„ ZHed(d)d*�dŒd,d„ƒZId-d.„ ZJd/d0„ ZKd1d„ ZLd�d3d„ZMd4d5„ ZNd6d7„ ZOd8d„ ZPd9d:„ ZQd;d<„ ZRd=d„ ZSd>d„ ZTejUfd?d@„ZVdŽdBd„ZWdCd„ ZXdDd„ ZYdEdF„ ZZdGdH„ Z[dIdJ„ Z\dKdL„ Z]dMdN„ Z^dAe)dAd+d+dfdOdP„Z_dQdR„ Z`dSdT„ ZadUdV„ ZbG dWdX„ dXecƒZdG dYdZ„ dZe2ƒZeejfd[d\„ ƒZgd]d„ Zhd^d_„ ZiG d`da„ daecƒZjd�dbd „Zkdcdd„ Zldedf„ Zmdgdh„ Znd�djdk„Zodldm„ Zpdndo„ Zqdpdq„ Zrdrds„ Zsdtdu„ Ztdvdw„ Zudxdy„ Zvdzd!„ Zwd{d|„ ZxG d}d~„ d~ecƒZydd€„ Zzd�d‚„ Z{dƒd„„ Z|d…d†„ Z}d‘dˆd‰„Z~dŠd‹„ ZdS )’é    )Úabsolute_importN©Údeque)Úpkg_resources)Úretry)ÚPY2Ú	text_type)Úinput)Úparse)Úunquote)Ú__version__)ÚCommandError)Úget_major_minor_versionÚsite_packagesÚ	user_site)ÚWINDOWSÚ
expanduserÚstdlib_pkgsÚstr_to_display)ÚMYPY_CHECK_RUNNINGÚcast)Úrunning_under_virtualenvÚvirtualenv_no_global)ÚBytesIO)ÚStringIO)	ÚAnyÚAnyStrÚ	ContainerÚIterableÚListÚOptionalÚTextÚTupleÚUnion)ÚDistributionÚrmtreeÚdisplay_pathÚ
backup_dirÚaskÚsplitextÚformat_sizeÚis_installable_dirÚnormalize_pathÚrenamesÚget_progÚcaptured_stdoutÚ
ensure_dirÚget_installed_versionÚremove_auth_from_urlc                  C   s4   t j t j t¡dd¡} t j | ¡} d t| tƒ ¡S )Nz..zpip {} from {} (python {}))	ÚosÚpathÚjoinÚdirnameÚ__file__ÚabspathÚformatr   r   )Zpip_pkg_dir© r:   úV/var/www/html/IITS/school/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.pyÚget_pip_versionK   s      ÿÿr<   c                 C   sD   t | ƒdk r"| dt | ƒ d 7 } nt | ƒdkr:| dd… } td| ƒS )ax  
    Convert a tuple of ints representing a Python version to one of length
    three.

    :param py_version_info: a tuple of ints representing a Python version,
        or None to specify no version. The tuple can have any length.

    :return: a tuple of length three if `py_version_info` is non-None.
        Otherwise, return `py_version_info` unchanged (i.e. None).
    é   )r   NÚVersionInfo)Úlenr   )Úpy_version_infor:   r:   r;   Únormalize_version_infoW   s
    rA   c              
   C   sP   zt  | ¡ W n< tk
rJ } z|jtjkr:|jtjkr:‚ W 5 d}~X Y nX dS )z os.path.makedirs without EEXIST.N)r3   ÚmakedirsÚOSErrorÚerrnoÚEEXISTZ	ENOTEMPTY)r4   Úer:   r:   r;   r0   k   s
    c               
   C   sP   z0t j tjd ¡} | dkr(dtj W S | W S W n tttfk
rJ   Y nX dS )Nr   )z__main__.pyz-cz	%s -m pipÚpip)	r3   r4   ÚbasenameÚsysÚargvÚ
executableÚAttributeErrorÚ	TypeErrorÚ
IndexError)Úprogr:   r:   r;   r.   v   s    
i¸  iô  )Ústop_max_delayÚ
wait_fixedFc                 C   s   t j| |td� d S )N)Úignore_errorsÚonerror)Úshutilr%   Úrmtree_errorhandler)ÚdirrR   r:   r:   r;   r%   „   s    ÿc              	   C   sX   zt  |¡jtj@  }W n ttfk
r2   Y dS X |rRt  |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_IWRITEÚIOErrorrC   Úchmod)Úfuncr4   Úexc_infoZhas_attr_readonlyr:   r:   r;   rU   ‹   s    rU   c                 C   sd   | dkrdS t | tƒr| S z|  t ¡ d¡}W n0 tk
r^   trRtd | ¡ƒ}nt	| ƒ}Y nX |S )zû
    Convert a bytes (or text) path to text (unicode in Python 2) for display
    and logging purposes.

    This function should never error out. Also, this function is mainly needed
    for Python 2 since in Python 3 str paths are already text.
    NÚstrictzb{!r})
Ú
isinstancer   ÚdecoderI   ÚgetfilesystemencodingÚUnicodeDecodeErrorr   r   r9   Úascii)r4   r&   r:   r:   r;   Úpath_to_displayŸ   s    	
rd   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   r4   Únormcaser8   rI   Úversion_infor`   ra   ÚencodeÚgetdefaultencodingÚ
startswithÚgetcwdÚsepr?   )r4   r:   r:   r;   r&   Á   s    ú.bakc                 C   s6   d}|}t j | | ¡r.|d7 }|t|ƒ }q| | S )z\Figure out the name of a directory to back up the given dir to
    (adding .bak, .bak2, etc)é   )r3   r4   ÚexistsÚstr)rV   ÚextÚnÚ	extensionr:   r:   r;   r'   Î   s    c                 C   s2   t j dd¡ ¡ D ]}||kr|  S qt| |ƒS )NZPIP_EXISTS_ACTIONÚ )r3   ÚenvironÚgetÚsplitr(   )ÚmessageÚoptionsÚactionr:   r:   r;   Úask_path_existsÚ   s    
r}   c                 C   s   t j d¡rtd|  ƒ‚dS )z&Raise an error if no input is allowed.ZPIP_NO_INPUTz7No input was expected ($PIP_NO_INPUT set); question: %sN)r3   rw   rx   Ú	Exception©rz   r:   r:   r;   Ú_check_no_inputâ   s    ÿÿr€   c                 C   sF   t | ƒ t| ƒ}| ¡  ¡ }||kr<td|d |¡f ƒ q |S q dS )z@Ask the message interactively, with the given possible responsesz<Your response (%r) was not one of the expected responses: %sz, N)r€   r	   ÚstripÚlowerÚprintr5   )rz   r{   Úresponser:   r:   r;   r(   ì   s    ÿÿc                 C   s   t | ƒ t| ƒS )zAsk for input interactively.)r€   r	   r   r:   r:   r;   Ú	ask_inputü   s    r…   c                 C   s   t | ƒ t | ¡S )z!Ask for a password interactively.)r€   Úgetpassr   r:   r:   r;   Úask_password  s    r‡   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%.1f MBg     @�@iè  i'  z%i kBz%.1f kBz%i bytesr:   )Úbytesr:   r:   r;   r*   
  s    c                 C   sP   t j | ¡sdS t j | d¡}t j |¡r.dS t j | d¡}t j |¡rLdS dS )zBIs path is a directory containing setup.py or pyproject.toml?
    Fzsetup.pyTzpyproject.toml)r3   r4   Úisdirr5   Úisfile)r4   Zsetup_pyZpyproject_tomlr:   r:   r;   r+     s    c                 c   s   |   |¡}|sq|V  q dS )z7Yield pieces of data from a file-like object until EOF.N)Úread)ÚfileÚsizeÚchunkr:   r:   r;   Úread_chunks%  s    
r�   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   r4   Úrealpathr8   rh   )r4   Zresolve_symlinksr:   r:   r;   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)   r‚   Úendswith)r4   Úbasers   r:   r:   r;   r)   <  s
    c                 C   sz   t j |¡\}}|r.|r.t j |¡s.t  |¡ t | |¡ t j | ¡\}}|rv|rvzt  |¡ W n tk
rt   Y nX dS )z7Like os.renames(), but handles renaming across devices.N)	r3   r4   ry   rq   rB   rT   ÚmoveÚ
removedirsrC   )ÚoldÚnewÚheadÚtailr:   r:   r;   r-   F  s    
c                 C   sp   t | ƒ} t tjƒ}tƒ r(|  t tjƒ¡S ddlm} |  |¡rh|dƒ ¡ D ]}|  t |ƒ¡rJ dS qJdS dS dS )a£  
    Return True if this is a path pip is allowed to modify.

    If we're in a virtualenv, sys.prefix points to the virtualenv's
    prefix; only sys.prefix is considered local.

    If we're not in a virtualenv, in general we can modify anything.
    However, if the OS vendor has configured distutils to install
    somewhere other than sys.prefix (which could be a subdirectory of
    sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal
    and the domain of the OS vendor. (In other words, everything _other
    than_ sys.prefix is considered local.)

    Caution: this function assumes the head of path has been normalized
    with normalize_path.
    r   )Údistutils_schemerv   TFN)r,   rI   Úprefixr   rl   Úpip._internal.locationsr›   Úvalues)r4   rœ   r›   Z
local_pathr:   r:   r;   Úis_localX  s    

rŸ   c                 C   s   t t| ƒƒS )zh
    Return True if given Distribution object is installed somewhere pip
    is allowed to modify.

    )rŸ   Údist_location©Údistr:   r:   r;   Údist_is_local{  s    r£   c                 C   s   t | ƒ ttƒ¡S )zF
    Return True if given Distribution is installed in user site.
    )r    rl   r,   r   r¡   r:   r:   r;   Údist_in_usersite…  s    r¤   c                 C   s   t | ƒ ttƒ¡S )z[
    Return True if given Distribution is installed in
    sysconfig.get_python_lib().
    )r    rl   r,   r   r¡   r:   r:   r;   Údist_in_site_packages�  s    r¥   c                 C   s6   t jD ]*}tj || jd ¡}tj |¡r dS qdS )zC
    Return True if given Distribution is an editable install.
    ú	.egg-linkTF)rI   r4   r3   r5   Úproject_namerŠ   )r¢   Ú	path_itemÚegg_linkr:   r:   r;   Údist_is_editable–  s
    
rª   c                    s€   |rt  |¡}nt j}| r t‰ndd„ ‰|r6dd„ ‰ ndd„ ‰ |rLdd„ ‰ndd„ ‰|r^t‰nd	d
„ ‰‡ ‡‡‡‡fdd„|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.

    If ``paths`` is set, only report the distributions present at the
    specified list of locations.
    c                 S   s   dS ©NTr:   ©Údr:   r:   r;   Ú
local_testÆ  s    z/get_installed_distributions.<locals>.local_testc                 S   s   dS r«   r:   r¬   r:   r:   r;   Úeditable_testÊ  s    z2get_installed_distributions.<locals>.editable_testc                 S   s
   t | ƒ S ©N©rª   r¬   r:   r:   r;   r¯   Í  s    c                 S   s   t | ƒS r°   r±   r¬   r:   r:   r;   Úeditables_only_testÑ  s    z8get_installed_distributions.<locals>.editables_only_testc                 S   s   dS r«   r:   r¬   r:   r:   r;   r²   Ô  s    c                 S   s   dS r«   r:   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   Ú
WorkingSetÚworking_setr£   r¤   )Ú
local_onlyr·   Zinclude_editablesZeditables_onlyZ	user_onlyÚpathsrº   r:   r¶   r;   Úget_installed_distributions¢  s     

r½   c                 C   sx   g }t ƒ r*| t¡ tƒ sBtrB| t¡ ntr8| t¡ | t¡ |D ],}tj || j¡d }tj 	|¡rF|  S qFd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.
    r¦   N)
r   Úappendr   r   r   r3   r4   r5   r§   rŠ   )r¢   ZsitesÚsiteZegglinkr:   r:   r;   Úegg_link_pathæ  s    




rÀ   c                 C   s   t | ƒ}|rt|ƒS t| jƒS )aO  
    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.

    The returned location is normalized (in particular, with symlinks removed).
    )rÀ   r,   Úlocation)r¢   r©   r:   r:   r;   r    
  s    
r    c                 G   s   t j| f|žŽ  d S r°   )ÚloggerÚinfo)ÚmsgÚargsr:   r:   r;   Úwrite_output  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 r°   r:   )rµ   Úlr:   r:   r;   Ú	<genexpr>#  s     z$FakeFile.__init__.<locals>.<genexpr>©Ú_gen)ÚselfÚlinesr:   r:   r;   Ú__init__"  s    zFakeFile.__init__c                 C   sP   z4zt | jƒW W S  tk
r0   | j  ¡  Y W S X W n tk
rJ   Y dS X d S )Nrv   )ÚnextrË   Ú	NameErrorÚStopIteration©rÌ   r:   r:   r;   Úreadline%  s    zFakeFile.readlinec                 C   s   | j S r°   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 r°   )Úorig_stream)ÚclsrÚ   r:   r:   r;   Úfrom_stream4  s    zStreamWrapper.from_streamc                 C   s   | j jS r°   )rÚ   ÚencodingrÒ   r:   r:   r;   rÝ   :  s    zStreamWrapper.encodingN)rÕ   rÖ   r×   ÚclassmethodrÜ   ÚpropertyrÝ   r:   r:   r:   r;   rÙ   2  s   
rÙ   c              
   c   s@   t t| ƒ}tt| t |¡ƒ zt t| ƒV  W 5 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)ÚgetattrrI   ÚsetattrrÙ   rÜ   )Zstream_nameÚ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.
    Ústdout©rã   r:   r:   r:   r;   r/   N  s    	c                   C   s   t dƒS )z 
    See captured_stdout().
    Ústderrrå   r:   r:   r:   r;   Úcaptured_stderrZ  s    rç   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Ø   r\   )rÌ   r\   r:   r:   r;   rÎ   i  s    zcached_property.__init__c                 C   s(   |d kr| S |   |¡ }|j| j j< |S r°   )r\   Ú__dict__rÕ   )rÌ   ÚobjrÛ   Úvaluer:   r:   r;   Ú__get__m  s    zcached_property.__get__N)rÕ   rÖ   r×   rØ   rÎ   rì   r:   r:   r:   r;   rè   a  s   rè   c                 C   s4   t j | ¡}|dkrt  ¡ }| |¡}|r0|jS dS )zCGet the installed version of dist_name avoiding pkg_resources cacheN)r   ÚRequirementr
   r¹   ÚfindÚversion)Ú	dist_namerº   Úreqr¢   r:   r:   r;   r1   u  s
    
c                 C   s   t | dd� dS )zConsume an iterable at C speed.r   )ÚmaxlenNr   )Úiteratorr:   r:   r;   Úconsume‡  s    rô   c                  O   s@   t t| tt| ƒƒƒf|Ž}dd„ | ¡ D ƒ}||d< tdd|ƒS )Nc                 S   s   i | ]\}}||“qS r:   r:   )rµ   r´   rë   r:   r:   r;   Ú
<dictcomp>�  s      zenum.<locals>.<dictcomp>Zreverse_mappingÚEnumr:   )ÚdictÚzipÚranger?   ÚitemsÚtype)Z
sequentialÚnamedÚenumsÚreverser:   r:   r;   Úenum�  s    rÿ   c                 C   s*   |dkr| S d| krd  | ¡} d  | |¡S )z.
    Build a netloc from a host-port pair
    Nú:ú[{}]z{}:{})r9   )ÚhostÚportr:   r:   r;   Úbuild_netloc”  s
    
r  Úhttpsc                 C   s4   |   d¡dkr(d| kr(d| kr(d | ¡} d || ¡S )z)
    Build a full URL from a netloc.
    r   re   ú@ú[r  z{}://{})Úcountr9   )ÚnetlocÚschemer:   r:   r;   Úbuild_url_from_netloc¡  s    
r  c                 C   s   t | ƒ}t |¡}|j|jfS )z2
    Return the host-port pair from a netloc.
    )r  Úurllib_parseÚurlparseÚhostnamer  )r	  ÚurlÚparsedr:   r:   r;   Úparse_netloc¬  s    
r  c                 C   sX   d| kr| dfS |   dd¡\}} d|kr6| dd¡}n|df}tdd„ |D ƒƒ}| |fS )zp
    Parse out and remove the auth information from a netloc.

    Returns: (netloc, (username, password)).
    r  )NNrp   r   Nc                 s   s"   | ]}|d krd nt |ƒV  qd S r°   )Úurllib_unquote)rµ   Úxr:   r:   r;   rÉ   Ë  s    z)split_auth_from_netloc.<locals>.<genexpr>)Úrsplitry   Útuple)r	  ÚauthÚ	user_passr:   r:   r;   Úsplit_auth_from_netloc¶  s    ÿr  c                 C   sL   t | ƒ\} \}}|dkr| S |dkr.d}d}nt |¡}d}dj||| d�S )zÞ
    Replace the sensitive data in a netloc with "****", if it exists.

    For example:
        - "user:pass@example.com" returns "user:****@example.com"
        - "accesstoken@example.com" returns "****@example.com"
    Nú****rv   z:****z{user}{password}@{netloc})ÚuserÚpasswordr	  )r  r  Úquoter9   )r	  r  r  r:   r:   r;   Úredact_netlocÒ  s    	
þr  c                 C   s@   t  | ¡}||jƒ}|j|d |j|j|jf}t  |¡}||fS )aR  Transform and replace netloc in a url.

    transform_netloc is a function taking the netloc and returning a
    tuple. The first element of this tuple is the new netloc. The
    entire tuple is returned.

    Returns a tuple containing the transformed url as item 0 and the
    original tuple returned by transform_netloc as item 1.
    r   )r  Úurlsplitr	  r
  r4   ÚqueryÚfragmentÚ
urlunsplit)r  Ztransform_netlocZpurlZnetloc_tupleZ
url_piecesZsurlr:   r:   r;   Ú_transform_urlé  s    


    ÿ
r"  c                 C   s   t | ƒS r°   )r  ©r	  r:   r:   r;   Ú_get_netlocý  s    r$  c                 C   s
   t | ƒfS r°   )r  r#  r:   r:   r;   Ú_redact_netloc  s    r%  c                 C   s   t | tƒ\}\}}|||fS )z†
    Parse a url into separate netloc, auth, and url with no auth.

    Returns: (url_without_auth, netloc, (username, password))
    ©r"  r$  )r  Zurl_without_authr	  r  r:   r:   r;   Úsplit_auth_netloc_from_url  s    r'  c                 C   s   t | tƒd S )z7Return a copy of url with 'username:password@' removed.r   r&  ©r  r:   r:   r;   r2     s    c                 C   s   t | tƒd S )z.Replace the password in a given url with ****.r   )r"  r%  r(  r:   r:   r;   Úredact_auth_from_url  s    r)  c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú
HiddenTextc                 C   s   || _ || _d S r°   )ÚsecretÚredacted)rÌ   r+  r,  r:   r:   r;   rÎ     s    zHiddenText.__init__c                 C   s   d  t| ƒ¡S )Nz<HiddenText {!r}>)r9   rr   rÒ   r:   r:   r;   Ú__repr__(  s    zHiddenText.__repr__c                 C   s   | j S r°   ©r,  rÒ   r:   r:   r;   Ú__str__,  s    zHiddenText.__str__c                 C   s    t | ƒt |ƒkrdS | j|jkS )NF)rû   r+  ©rÌ   Úotherr:   r:   r;   Ú__eq__1  s    zHiddenText.__eq__c                 C   s
   | |k S r°   r:   r0  r:   r:   r;   Ú__ne__<  s    zHiddenText.__ne__N)rÕ   rÖ   r×   rÎ   r-  r/  r2  r3  r:   r:   r:   r;   r*    s
   	r*  c                 C   s   t | dd�S )Nr  r.  )r*  )rë   r:   r:   r;   Ú
hide_valueA  s    r4  c                 C   s   t | ƒ}t| |d�S )Nr.  )r)  r*  )r  r,  r:   r:   r;   Úhide_urlF  s    r5  c                 C   sz   dd  tjd ¡dj tjdd… Ž g}| oBtoBtj tjd ¡|k}|rvtjddgtjd	d…  }t	d
  d 
|¡¡ƒ‚dS )z�Protection of pip.exe from modification on Windows

    On Windows, any operation modifying pip should be run as:
        python -m pip ...
    zpip.exez	pip{}.exer   zpip{}.{}.exeNre   z-mrG   rp   z3To modify pip, please run the following command:
{}ú )r9   rI   ri   r   r3   r4   rH   rJ   rK   r   r5   )Zmodifying_pipZ	pip_namesZshould_show_use_python_msgZnew_commandr:   r:   r;   Ú(protect_pip_from_modification_on_windowsL  s*    ýÿý  ÿþÿÿr7  c                   C   s   t jdk	ot j ¡ S )z!Is this console interactive?
    N)rI   ÚstdinÚisattyr:   r:   r:   r;   Úis_console_interactivej  s    r:  é   c              	   C   sR   t  ¡ }d}t| dƒ�.}t||d�D ]}|t|ƒ7 }| |¡ q$W 5 Q R X ||fS )z:Return (hash, length) for path using hashlib.sha256()
    r   Úrb)r�   )ÚhashlibÚsha256Úopenr�   r?   Úupdate)r4   Ú	blocksizeÚhÚlengthÚfÚblockr:   r:   r;   Ú	hash_fileq  s    rF  c                  C   s(   zddl } W n tk
r"   Y dS X dS )z8
    Return whether the wheel package is installed.
    r   NFT)ÚwheelÚImportError)rG  r:   r:   r;   Úis_wheel_installed  s
    rI  )F)ro   )T)N)r  )r;  )€Ú
__future__r   Ú
contextlibrD   r†   r=  ÚioÚloggingr3   r’   rT   rW   rI   Úcollectionsr   Zpip._vendorr   Zpip._vendor.retryingr   Zpip._vendor.sixr   r   Zpip._vendor.six.movesr	   Zpip._vendor.six.moves.urllibr
   r  Z"pip._vendor.six.moves.urllib.parser   r  rG   r   Úpip._internal.exceptionsr   r�   r   r   r   Úpip._internal.utils.compatr   r   r   r   Úpip._internal.utils.typingr   r   Úpip._internal.utils.virtualenvr   r   r   r   Útypingr   r   r   r   r   r    r!   r"   r#   Zpip._vendor.pkg_resourcesr$   Úintr>   Ú__all__Ú	getLoggerrÕ   rÂ   r<   rA   r0   r.   r%   rU   rd   r&   r'   r}   r€   r(   r…   r‡   r*   r+   ÚDEFAULT_BUFFER_SIZEr�   r,   r)   r-   rŸ   r£   r¤   r¥   rª   r½   rÀ   r    rÆ   ÚobjectrÇ   rÙ   Úcontextmanagerrã   r/   rç   rè   r1   rô   rÿ   r  r  r  r  r  r"  r$  r%  r'  r2   r)  r*  r4  r5  r7  r:  rF  rI  r:   r:   r:   r;   Ú<module>   sÚ   ,     ú	

"

	

#
	ú
D$



#
