????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/utils/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/utils/misc.pyc

�
}�\]c@@stddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZddlmZddlmZddlmZmZddlmZmZddlmZdd	lm Z!dd
l"m#Z$ddl%m&Z&ddl'm(Z(m)Z)dd
l*m+Z+m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9er�ddlm:Z;nddlm;Z;e6r�ddl<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHddlImJZJddlKmLZLddlMmNZNeFeOeOeOfZPn	d�ZHdddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZQejReS�ZTejRd2�ZUd3ZVd4ZWd�ZXd�ZYd<eWfZZd�Z[eZeXe[eYZ\eZe[Z]yddl^Z^e]eX7Z]Wne_k
r�eTj`d@�nXyddlaZae]eY7Z]Wne_k
r�eTj`dA�nXdB�ZbdC�ZcdD�ZddE�ZeedFdGdHdI�efdJ��ZgdK�ZhdL�ZidM�ZjdNdO�ZkdP�ZldQ�ZmdR�ZndS�ZodT�ZpdU�ZqdV�ZrdW�ZsdX�ZtejudY�ZvdZ�Zwd[�Zxeyd\�Zzd]�Z{d^�Z|d_�Z}d`�Z~da�Zdb�Z�dc�Z�eye1eyefefddd�Z�de�Z�df�Z�dg�Z�eydh�Z�di�Z�dj�Z�dk�Z�dl�Z�efddmddddddn�Z�do�Z�dpe�fdq��YZ�dre;fds��YZ�ej�dt��Z�du�Z�dv�Z�dwe�fdx��YZ�ddy�Z�dz�Z�d{�Z�d|�Z�d}�Z�d~�Z�d�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�dS(�i(tabsolute_importN(tdeque(t
pkg_resources(tretry(tPY2t	text_type(tinputtshlex_quote(tparse(trequest(tunquote(t__version__(tCommandErrortInstallationError(t
site_packagest	user_site(tWINDOWStconsole_to_strt
expandusertstdlib_pkgststr_to_display(twrite_delete_marker_file(tMYPY_CHECK_RUNNING(trunning_under_virtualenvtvirtualenv_no_global(tBytesIO(tStringIO(tAnytAnyStrt	ContainertIterabletListtMappingtMatchtOptionaltTexttTupletUniontcast(tDistribution(tLink(tSpinnerInterfacecC@s|S(N((ttype_tvalue((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR&=strmtreetdisplay_patht
backup_dirtasktsplitexttformat_sizetis_installable_dirtis_svn_paget
file_contentstsplit_leading_dirthas_leading_dirtnormalize_pathtrenamestget_progt
unzip_filet
untar_filetunpack_filetcall_subprocesstcaptured_stdoutt
ensure_dirtARCHIVE_EXTENSIONStSUPPORTED_EXTENSIONStWHEEL_EXTENSIONtget_installed_versiontremove_auth_from_urlspip.subprocessors(----------------------------------------s.whls.tar.bz2s.tbzs.tar.xzs.txzs.tlzs.tar.lzs	.tar.lzmas.zips.tar.gzs.tgzs.tarsbz2 module is not availableslzma module is not availablecC@sPtjjtjjt�dd�}tjj|�}djt|tj	d �S(Ns..spip {} from {} (python {})i(
tostpathtjointdirnamet__file__tabspathtformatRtsystversion(tpip_pkg_dir((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytget_pip_versionjs$cC@sYt|�dkr-|dt|�d7}nt|�dkrL|d }ntd|�S(sx
    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).
    iitVersionInfo(i(tlenR&(tpy_version_info((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytnormalize_version_infovs

cC@sCytj|�Wn+tk
r>}|jtjkr?�q?nXdS(s os.path.makedirs without EEXIST.N(REtmakedirstOSErrorterrnotEEXIST(RFte((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR?�s
cC@sYy8tjjtjd�}|dkr3dtjS|SWntttfk
rTnXdS(Nis__main__.pys-cs	%s -m piptpip(s__main__.pys-c(	RERFtbasenameRLtargvt
executabletAttributeErrort	TypeErrort
IndexError(tprog((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR9�ststop_max_delayi�t
wait_fixedi�cC@stj|d|dt�dS(Nt
ignore_errorstonerror(tshutilR,trmtree_errorhandler(tdirRc((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR,�scC@sAtj|�jtj@r:tj|tj�||�dS�dS(s�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(REtstattst_modetS_IREADtchmodtS_IWRITE(tfuncRFtexc_info((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRf�s

cC@s�|dkrdSt|t�r#|Sy|jtj�d�}Wn;tk
r|trmtdj	|��}q}t
|�}nX|S(s�
    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.
    tstrictsb{!r}N(tNonet
isinstanceRtdecodeRLtgetfilesystemencodingtUnicodeDecodeErrorRRRKtascii(RFR-((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytpath_to_display�s	
cC@s�tjjtjj|��}tjddkrd|jtj�d�}|jtj	�d�}n|j
tj�tjj�r�d|t
tj��}n|S(sTGives the display value for a given path, making it relative to cwd
    if possible.iitreplacet.(RERFtnormcaseRJRLtversion_infoRrRstencodetgetdefaultencodingt
startswithtgetcwdtsepRQ(RF((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR-�ss.bakcC@sKd}|}x4tjj||�rB|d7}|t|�}qW||S(s\Figure out the name of a directory to back up the given dir to
    (adding .bak, .bak2, etc)i(RERFtexistststr(Rgtexttnt	extension((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR.�s
cC@sCx3tjjdd�j�D]}||kr|SqWt||�S(NtPIP_EXISTS_ACTIONt(REtenvirontgettsplitR/(tmessagetoptionstaction((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytask_path_exists�s"cC@s)tjjd�r%td|��ndS(s&Raise an error if no input is allowed.tPIP_NO_INPUTs7No input was expected ($PIP_NO_INPUT set); question: %sN(RER�R�t	Exception(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt_check_no_input�scC@s]xVt|�t|�}|j�j�}||krRd|dj|�fGHq|SqdS(s@Ask the message interactively, with the given possible responsess<Your response (%r) was not one of the expected responses: %ss, N(R�RtstriptlowerRG(R�R�tresponse((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR/s
cC@st|�t|�S(sAsk for input interactively.(R�R(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt	ask_inputs
cC@st|�tj|�S(s!Ask for a password interactively.(R�tgetpass(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytask_passwords
cC@sX|dkrd|ddS|d	kr4d|dS|dkrLd|dSd|SdS(
Ni�s%.1fMBg@�@i
s%ikBs%.1fkBs%ibytesi@Bi'((tbytes((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR1#scC@sptjj|�stStjj|d�}tjj|�rAtStjj|d�}tjj|�rltStS(sBIs path is a directory containing setup.py or pyproject.toml?
    ssetup.pyspyproject.toml(RERFtisdirtFalseRGtisfiletTrue(RFtsetup_pytpyproject_toml((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR2/scC@s(tjd|�o'tjd|tj�S(sT
    Returns true if the page appears to be the index page of an svn repository
    s<title>[^<]*Revision \d+:s#Powered by (?:<a[^>]*?>)?Subversion(tretsearchtI(thtml((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR3>scC@s/t|d��}|j�jd�SWdQXdS(Ntrbsutf-8(topentreadRr(tfilenametfp((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR4Gscc@s/x(tr*|j|�}|s"Pn|VqWdS(s7Yield pieces of data from a file-like object until EOF.N(R�R�(tfiletsizetchunk((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytread_chunksMs
	cC@s�|jd�jd�}d|krjd|krN|jd�|jd�ksZd|krj|jdd�Sd|kr�|jdd�S|dgSdS(Nt/s\iR�(tlstriptfindR�(RF((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR5Vs6cC@s\d}xO|D]G}t|�\}}|s/tS|dkrD|}q
||kr
tSq
WtS(syReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)N(RpR5R�R�(tpathst
common_prefixRFtprefixtrest((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR6bs
	cC@sIt|�}|r'tjj|�}ntjj|�}tjj|�S(sN
    Convert a path to its canonical, case-normalized, absolute version.

    (RRERFtrealpathRJRy(RFtresolve_symlinks((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR7rs
cC@sOtj|�\}}|j�jd�rE|d|}|d }n||fS(s,Like os.path.splitext, but take off .tar toos.tari����(t	posixpathR0R�tendswith(RFtbaseR�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR0�s

cC@s�tjj|�\}}|rG|rGtjj|�rGtj|�ntj||�tjj|�\}}|r�|r�ytj|�Wq�tk
r�q�XndS(s7Like os.renames(), but handles renaming across devices.N(	RERFR�R�RTRetmovet
removedirsRU(toldtnewtheadttail((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR8�s
cC@s)t�s
tSt|�jttj��S(s�
    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."

    (RR�R7R}RLR�(RF((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytis_local�s	cC@stt|��S(s�
    Return True if given Distribution object is installed locally
    (i.e. within current virtualenv).

    Always True if we're not in a virtualenv.

    (R�t
dist_location(tdist((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
dist_is_local�s	cC@s%tt|��}|jtt��S(sF
    Return True if given Distribution is installed in user site.
    (R7R�R}R(R�t	norm_path((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytdist_in_usersite�scC@stt|��jtt��S(s[
    Return True if given Distribution is installed in
    sysconfig.get_python_lib().
    (R7R�R}R(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytdist_in_site_packages�scC@sJxCtjD]8}tjj||jd�}tjj|�r
tSq
WtS(sC
    Return True if given Distribution is an editable install.
    s	.egg-link(RLRFRERGtproject_nameR�R�R�(R�t	path_itemtegg_link((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytdist_is_editable�s
cC@s�|rtj|�}n	tj}|r0t}n	d�}|rKd�}n	d�}|rfd�}	n	d�}	|r~t}
n	d�}
g|D]K}||�r�|j|kr�||�r�|	|�r�|
|�r�|^q�S(s^
    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.
    cS@stS(N(R�(td((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
local_test�scS@stS(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
editable_test�scS@st|�S(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR�scS@s
t|�S(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyteditables_only_testscS@stS(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR�scS@stS(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt	user_test
s(Rt
WorkingSettworking_setR�R�tkey(t
local_onlytskiptinclude_editablesteditables_onlyt	user_onlyR�R�R�R�R�R�R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytget_installed_distributions�s*							
cC@s�g}t�rNt�r(|jt�qq|jt�trq|jt�qqn#trd|jt�n|jt�x@|D]8}tjj||j�d}tjj	|�rx|SqxWdS(s
    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.
    s	.egg-linkN(RRtappendRRRERFRGR�R�Rp(R�tsitestsitetegglink((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
egg_link_paths		


cC@st|�}|r|S|jS(s�
    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�tlocation(R�R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR�As	cC@s tjd�}tj|�|S(sBGet the current umask which involves having to set it temporarily.i(REtumask(tmask((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
current_umaskPs
c
C@s�t|�t|d�}z_tj|dt�}t|j��oF|}x+|j�D]}|j}|}|r�t	|�d}nt
jj||�}t
jj
|�}	|jd�s�|jd�r�t|�qVt|	�|j|�}
z,t|d��}tj|
|�WdQXWd|
j�|jd?}|rrtj|�rr|d	@rrt
j|d
t�d	B�nXqVWWd|j�XdS(s�
    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
allowZip64iR�s\twbNiiIi�(R?R�tzipfiletZipFileR�R6tnamelisttinfolistR�R5RERFRGRHR�Retcopyfileobjtcloset
external_attrRhtS_ISREGRkR�(
R�R�tflattentzipfptziptleadingtinfotnametfnRgR�tdestfptmode((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR:Ws0

	



'c	C@s�t|�|j�jd�s4|j�jd�r=d}np|j�jt�r[d}nR|j�jt�ryd}n4|j�jd�r�d}ntjd|�d	}tj||�}z�t	g|j
�D]}|j^q��}x�|j
�D]y}|j}|rt|�d
}nt
jj||�}|j�rMt|�q�|j�r�y|j||�Wqptk
r�}tjd||j|�q�qpXq�y|j|�}	Wn5ttfk
r�}tjd||j|�q�nXtt
jj|��t|d��}
tj|	|
�Wd
QX|	j�|j||�|jd@r�t
j|dt�dB�q�q�WWd
|j�Xd
S(s�
    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.
    s.gzs.tgzsr:gzsr:bz2sr:xzs.tartrs-Cannot determine compression type for file %ssr:*is/In the tar file %s the member %s is invalid: %sR�NiIi�(R?R�R�tBZ2_EXTENSIONSt
XZ_EXTENSIONStloggertwarningttarfileR�R6t
getmembersR�R5RERFRGR�tissymt_extract_memberR�textractfiletKeyErrorR]RHReR�R�tutimeR�RkR�(R�R�R�ttartmemberR�R�RFtexcR�R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR;�s\

*				
%	



&cC@s1tjj|�}|dksB|j�jt�sBtj|�rbt||d|jd��n�|dks�t	j
|�s�|j�jttt
�r�t||�n�|r|jd�rtt|��rddlm}d|j}|�j|d	|�n&tjd
|||�td|��dS(Nsapplication/zipR�s.whlsapplication/x-gzips	text/htmli(t
Subversionssvn+turlsZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formats%Cannot determine archive format of %s(RERFR�R�R�tZIP_EXTENSIONSR�t
is_zipfileR:R�t
is_tarfiletTAR_EXTENSIONSR�R�R;R}R3R4tpip._internal.vcs.subversionRRtunpackR�tcriticalR
(R�R�tcontent_typetlinkRR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR<�s.

cC@sdjd�|D��S(s/
    Format command arguments for display.
    t cs@s|]}t|�VqdS(N(R(t.0targ((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pys	<genexpr>�s(RG(targs((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytformat_command_args�sc	
C@sst|�}t|dd�}t|�}dj|�}djd|d|d|dt|�d	|d
t�}|S(s�
    Create and return the error message to use to log a subprocess error
    with command output.

    :param lines: A list of lines, each ending with a newline.
    tdescs
command bytesR�u�Command errored out with exit status {exit_status}:
 command: {command_display}
     cwd: {cwd_display}
Complete output ({line_count} lines):
{output}{divider}texit_statustcommand_displaytcwd_displayt
line_counttoutputtdivider(RRRvRGRKRQtLOG_DIVIDER(	tcmd_argstcwdtlinesRtcommandRRRtmsg((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytmake_subprocess_output_errors
		traisec	
C@s|d	krg}n|d	kr*g}n|rEtj}	tj}
ntj}	tj}
tj�|
k}|oy|d	k	}|d	kr�t|�}n|	d|�t	j
j�}
|r�|
j|�nx|D]}|
j
|d	�q�WyGtj|dtjdtjdtjd|d|
�}|jj�Wn)tk
r\}tjd||��nXg}xctr�t|jj��}|s�Pn|j�}|j|d�|	|�|rf|j�qfqfWz|j�Wd	|jr�|jj�nX|jo	|j|k}|r8|r(|jd
�q8|jd�n|r�|dkr�|s�t d
|d|d|d|j�}tj!|�ndj"|j|�}t#|��q�|dkr�tj$d||j|�q�|dkr�q�t%dt&|���ndj'|�S(s�
    Args:
      show_stdout: if true, use INFO to log the subprocess's stderr and
        stdout streams.  Otherwise, use DEBUG.  Defaults to False.
      extra_ok_returncodes: an iterable of integer return codes that are
        acceptable, in addition to 0. Defaults to None, which means [].
      unset_environ: an iterable of environment variable names to unset
        prior to calling subprocess.Popen().
    sRunning command %ststderrtstdintstdoutRtenvs#Error %s while executing command %ss
NterrortdoneRRRRsSCommand errored out with exit status {}: {} Check the logs for full command output.twarns$Command "%s" had error code %s in %stignoresInvalid value: on_returncode=%sR�((Rptsubprocess_loggerR�tstd_loggingtINFOtdebugtDEBUGtgetEffectiveLevelRRER�tcopytupdatetpopt
subprocesstPopentSTDOUTtPIPER!R�R�R	R�RR"treadlinetrstripR�tspintwaitt
returncodetfinishRR$RKR
R�t
ValueErrortreprRG(tcmdtshow_stdoutRt
on_returncodetextra_ok_returncodestcommand_desct
extra_environt
unset_environtspinnertlog_subprocesst
used_leveltshowing_subprocesstuse_spinnerR#R�tprocRt
all_outputtlinetproc_had_errorRtexc_msg((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR=+s�					


	
	cC@stj|�t|�dS(N(RERTR(t	build_dir((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt_make_build_dir�s
tFakeFilecB@s)eZdZd�Zd�Zd�ZRS(sQWrap a list of lines in an object with readline() to make
    ConfigParser happy.cC@sd�|D�|_dS(Ncs@s|]}|VqdS(N((R
tl((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pys	<genexpr>�s(t_gen(tselfR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt__init__�scC@sLy3yt|j�SWntk
r1|jj�SXWntk
rGdSXdS(NR�(tnextRRt	NameErrort
StopIteration(RS((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR5�s

cC@s|jS(N(RR(RS((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt__iter__�s(t__name__t
__module__t__doc__RTR5RX(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRP�s			t
StreamWrappercB@s&eZed��Zed��ZRS(cC@s||_|�S(N(torig_stream(tclsR]((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytfrom_stream�s	cC@s
|jjS(N(R]tencoding(RS((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR`�s(RYRZtclassmethodR_tpropertyR`(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR\�scc@sRtt|�}tt|tj|��ztt|�VWdtt||�XdS(s�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(tgetattrRLtsetattrR\R_(tstream_nametorig_stdout((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytcaptured_output�s
cC@s
td�S(s�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"(Rg(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyR>�s	cC@s
td�S(s 
    See captured_stdout().
    R (Rg(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytcaptured_stderr�stcached_propertycB@s eZdZd�Zd�ZRS(s�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
    cC@st|d�|_||_dS(NR[(RcR[Rm(RSRm((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRTscC@s4|dkr|S|j|�}|j|jj<|S(N(RpRmt__dict__RY(RStobjR^R+((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt__get__s (RYRZR[RTRl(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRi�s	cC@sMtjj|�}|dkr-tj�}n|j|�}|rI|jSdS(sCGet the installed version of dist_name avoiding pkg_resources cacheN(RtRequirementRRpR�R�RM(t	dist_nameR�treqR�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRCs
cC@st|dd�dS(sConsume an iterable at C speed.tmaxleniN(R(titerator((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytconsumescO@sTtt|tt|���|�}d�|j�D�}||d<tdd|�S(NcS@si|]\}}||�qS(((R
R�R+((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pys
<dictcomp>&s	treverse_mappingtEnum((tdictR�trangeRQtitemsttype(t
sequentialtnamedtenumstreverse((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytenum$s$
cC@s=tjjtjj|��}tjdtj|��}|S(sh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    sfile:(RERFtnormpathRJturllib_parseturljointurllib_requesttpathname2url(RFR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytpath_to_url+scC@s{d|kr|dfS|jdd�\}}d|krO|jdd�}n|df}td�|D��}||fS(sp
    Parse out and remove the auth information from a netloc.

    Returns: (netloc, (username, password)).
    t@it:cs@s-|]#}|dkrdn	t|�VqdS(N(Rpturllib_unquote(R
tx((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pys	<genexpr>LsN(NN(RptrsplitR�ttuple(tnetloctautht	user_pass((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytsplit_auth_from_netloc6s
cC@set|�\}\}}|dkr(|S|dkr:dnd}djdtj|�d|d|�S(s�
    Replace the password in a netloc with "****", if it exists.

    For example, "user:pass@example.com" returns "user:****@example.com".
    R�s:****s{user}{password}@{netloc}tusertpasswordR�N(R�RpRKRtquote(R�R�R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt
redact_netlocRscC@s\tj|�}||j�}|j|d|j|j|jf}tj|�}||fS(sRTransform 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.
    i(RturlsplitR�tschemeRFtquerytfragmentt
urlunsplit(Rttransform_netloctpurltnetloc_tuplet
url_piecestsurl((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt_transform_urlbs

%cC@s
t|�S(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt_get_netlocvscC@s
t|�fS(N(R�(R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt_redact_netloczscC@s(t|t�\}\}}|||fS(s�
    Parse a url into separate netloc, auth, and url with no auth.

    Returns: (url_without_auth, netloc, (username, password))
    (R�R�(Rturl_without_authR�R�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytsplit_auth_netloc_from_url~scC@st|t�dS(s7Return a copy of url with 'username:password@' removed.i(R�R�(R((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyRD�scC@st|t�dS(s.Replace the password in a given url with ****.i(R�R�(R((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pytredact_password_from_url�scC@s�ddjtjd�djtjd �g}|oWtoWtjjtjd�|k}|r�tjddgtjd}t	d	jd
j
|����ndS(s�Protection of pip.exe from modification on Windows

    On Windows, any operation modifying pip should be run as:
        python -m pip ...
    spip.exes	pip{}.exeispip{}.{}.exeis-mRYis3To modify pip, please run the following command:
{}RN(RKRLRzRRERFRZR[R\RRG(t
modifying_pipt	pip_namestshould_show_use_python_msgtnew_command((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt(protect_pip_from_modification_on_windows�s(s.tar.bz2s.tbz(s.tar.xzs.txzs.tlzs.tar.lzs	.tar.lzma(s.tar.gzs.tgzs.tar(�t
__future__Rt
contextlibRVR�tiotloggingR)RER�R�ReRhR1RLR�R�tcollectionsRtpip._vendorRtpip._vendor.retryingRtpip._vendor.sixRRtpip._vendor.six.movesRRtpip._vendor.six.moves.urllibRRR	R�t"pip._vendor.six.moves.urllib.parseR
R�RYRtpip._internal.exceptionsRR
tpip._internal.locationsRRtpip._internal.utils.compatRRRRRt pip._internal.utils.marker_filesRtpip._internal.utils.typingRtpip._internal.utils.virtualenvRRRRttypingRRRRRR R!R"R#R$R%R&tpip._vendor.pkg_resourcesR'tpip._internal.models.linkR(tpip._internal.utils.uiR)tintRPt__all__t	getLoggerRYR�R(RRBR�R�RRR@RAtbz2tImportErrorR+tlzmaRORSR?R9R�R,RfRvR-R.R�R�R/R�R�R1R2R3R4tDEFAULT_BUFFER_SIZER�R5R6R�R7R0R8R�R�R�R�R�RpR�R�R�R�R:R;R<RRR=ROtobjectRPR\tcontextmanagerRgR>RhRiRCRrR}R�R�R�R�R�R�R�RDR�R�(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/utils/misc.pyt<module>s(R			


			
			"	
		
												
		
					
?	'		.	L	(		,}