????

Your IP : 216.73.216.152


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

�
}�\]c
@@saddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZmZddlmZddlmZddlmZddlmZmZddlmZmZdd	lmZmZdd
lm Z ddl!m"Z"ddl#m$Z$dd
l%m&Z'ddl%m(Z)ddl*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKddlLmMZMddlNmOZOddlPmQZQddlRmSZSeOr"ddlTmUZUmVZVmWZWmXZXmYZYmZZZddl[m\Z\ddl]m^Z^ddl_m`Z`ddlambZbmcZceVedededfZend d!d"d#d$d%d&d'd(d)d*d+d,g
Zfejgeh�ZiyddljZjWnEekk
r�dZjn/emk
r�Zneijod-eden��dZjnXdWZpd2�Zqd3�Zrd4�Zsd5efd6��YZtd7efd8��YZud9efd:��YZvd;efd<��YZwd=ejxfd>��YZyddd?�Zze
j{d@e
j|�Z}e
j{dAe
j|�Z~dB�ZdC�Z�dD�Z�dE�Z�dF�Z�dG�Z�dH�Z�dI�Z�dJ�Z�dK�Z�dL�Z�ddddMdN�Z�dddO�Z�dPe$j�fdQ��YZ�de�dddMdR�Z�dS�Z�dT�Z�dU�Z�dV�Z�dS(Xi(tabsolute_importN(trequeststurllib3(tCacheControlAdapter(t	FileCache(t	LockError(tBaseAdaptertHTTPAdapter(tAuthBaset
HTTPBasicAuth(tCONTENT_CHUNK_SIZEtResponse(tCaseInsensitiveDict(tget_netrc_auth(t
xmlrpc_client(tparse(trequest(tHashMismatchtInstallationError(tPyPI(tHAS_TLStssl(tauto_decode(tcheck_path_owner(tlibc_ver(twrite_delete_marker_file(tARCHIVE_EXTENSIONStaskt	ask_inputtask_passwordtask_path_existst
backup_dirtconsumetdisplay_pathtformat_sizetget_installed_versiontpath_to_urltremove_auth_from_urltrmtreetsplit_auth_netloc_from_urltsplitexttunpack_file(t
TempDirectory(tMYPY_CHECK_RUNNING(tDownloadProgressProvider(tvcs(tOptionaltTupletDicttIOtTexttUnion(tValues(tLink(tHashes(tAuthInfotVersionControltget_file_contenttis_urlturl_to_pathR$tis_archive_filetunpack_vcs_linktunpack_file_urlt
is_vcs_urltis_file_urltunpack_http_urlt
unpack_urltparse_content_dispositiontsanitize_content_filenames*Keyring is skipped due to an exception: %st
BUILD_BUILDIDtBUILD_IDtCIt	PIP_IS_CIcC@std�tD��S(s?
    Return whether it looks like pip is running under CI.
    cs@s|]}|tjkVqdS(N(tostenviron(t.0tname((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pys	<genexpr>ls(tanytCI_ENVIRONMENT_VARIABLES(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt
looks_like_cidscC@s=iidd6tjd6d6tj�d6itj�d6d6}|dddkrjtj�|dd<n�|dddkr�tjjd	kr�tjd
 }n	tj}djg|D]}t	|�^q��|dd<nV|dddkrtj�|dd<n+|ddd
kr2tj�|dd<ntjj
d�r�ddlm}t
td�tdddg|j����}t
td�tddgt����}|r�||d<n|r�||d<q�ntjj
d�rtj�dridd6tj�dd6|d<ntj�rItj�|jdi�d<ntj�rttj�|jdi�d<ntj�r�tj�|d<ntr�tj|d<ntd�}|d)k	r�||d<nt�r�tnd)|d<tjj d �}|d)k	r||d!<nd"j!d#|d$t"j#|d%d*d(t��S(+s6
    Return a string representing the user agent.
    tpipRLtversiont	installertpythontimplementationtCPythontPyPytfinalit.tJythont
IronPythontlinuxi(tdistrocS@s|dS(Ni((tx((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt<lambda>�stidcS@s|dS(Ni((R]((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR^�stlibtlibcR\tdarwintmacOStsystemtreleasetcputopenssl_versiont
setuptoolstsetuptools_versiontcitPIP_USER_AGENT_USER_DATAt	user_datas9{data[installer][name]}/{data[installer][version]} {json}tdatatjsont
separatorst,t:t	sort_keysN(RpRq($RPt__version__tplatformtpython_versiontpython_implementationtsystpypy_version_infotreleaseleveltjointstrt
startswithtpip._vendorR\tdicttfiltertziptlinux_distributionRtmac_verRdt
setdefaultRetmachineRRtOPENSSL_VERSIONR#tNoneROtTrueRIRJtgettformatRntdumps(RmRxR]R\tdistro_infosRaRiRl((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt
user_agentosb
	-$
"%

	cC@s�|strdSy�y
tj}Wntk
r5n@Xtjd|�|||�}|dk	rq|j|jfSdS|r�tjd|�tj||�}|r�||fSnWn)t	k
r�}tj
dt|��nXdS(s3Return the tuple auth for a given url from keyring.s'Getting credentials from keyring for %ss$Getting password from keyring for %ss*Keyring is skipped due to an exception: %sN(tkeyringR�tget_credentialtAttributeErrortloggertdebugtusernametpasswordtget_passwordt	ExceptiontwarningR{(turlR�R�tcredR�texc((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_get_keyring_auth�s(

	tMultiDomainBasicAuthcB@sneZed
d�Zd�Zeed�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
RS(cC@s(||_||_i|_d|_dS(N(t	promptingt
index_urlst	passwordsR�t_credentials_to_save(tselfR�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt__init__�s			cC@sY|s|jrdSx=|jD]2}t|�jd�d}|j|�r|SqWdS(s�Return the original index URL matching the requested URL.

        Cached or dynamically generated credentials may work against
        the original index URL rather than just the netloc.

        The provided url should have had its username and password
        removed already. If the original index url had credentials then
        they will be included in the return value.

        Returns None if no matching index was found, or if --no-index
        was specified by the user.
        t/N(R�R�R%trstripR|(R�R�tutprefix((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_get_index_url�s
cC@sdt|�\}}}|\}}|dk	rM|dk	rMtjd|�|S|j|�}	|	r�t|	�}
|
r�|
\}	}}tjd|	�q�n|	r�|ddk	r�|\}}|dk	r�|dk	r�tjd|�|Sn|rt|�}
|
rtjd|�|
Sn|rZt|	|�p:t||�}|rZtjd|�|Sn||fS(s2Find and return credentials for the specified URL.sFound credentials in url for %ssFound index url %sis%Found credentials in index url for %ss!Found credentials in netrc for %ss#Found credentials in keyring for %sN(R'R�R�R�R�R
R�(R�toriginal_urltallow_netrct
allow_keyringR�tnetlocturl_user_passwordR�R�t	index_urlt
index_infot_tindex_url_user_passwordt
netrc_authtkr_auth((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_get_new_credentials�s:c
C@s�t|�\}}}|jj|d�\}}|dkr`|dkr`|j|�\}}n|dk	sx|dk	r�|p�d}|p�d}||f|j|<n|dk	r�|dk	s�|dkr�|dks�tdj|���|||fS(s_Return the credentials to use for the provided URL.

        If allowed, netrc and keyring may be used to obtain the
        correct credentials.

        Returns (url_without_credentials, username, password). Note
        that even if the original URL contains credentials, this
        function may return a different username and password.
        ts'Could not load credentials from url: {}N(NN(R'R�R�R�R�tAssertionErrorR�(R�R�R�R�R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_get_url_and_credentials,s
cC@sk|j|j�\}}}||_|dk	rT|dk	rTt||�|�}n|jd|j�|S(Ntresponse(R�R�R�R	t
register_hookt
handle_401(R�treqR�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt__call__Ts	cC@s]td|�}|sdSt||�}|rD|d|dtfStd�}||tfS(Ns
User for %s: iis
Password: (NN(RR�R�tFalseRR�(R�R�R�tauthR�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_prompt_for_passwordescC@s#ts
tStdddg�dkS(Ns#Save credentials to keyring [y/N]: tytn(R�R�R(R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt _should_save_password_to_keyringpsc	K@sD|jdkr|S|js |Stj|j�}|j|j�\}}}d|_|dk	r�|dk	r�||f|j	|j<|r�|j
�r�|j||f|_q�n|j|jj
�t|p�d|p�d�|j�}|jd|j�|jr|jd|j�n|jj||�}|jj|�|S(Ni�R�R�(tstatus_codeR�turllib_parseturlparseR�R�R�R�R�R�R�tcontenttrawtrelease_connR	RR�twarn_on_401tsave_credentialst
connectiontsendthistorytappend(	R�tresptkwargstparsedR�R�tsaveR�tnew_resp((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�us(		
$	cK@s,|jdkr(tjd|jj�ndS(s6Response callback to warn about incorrect credentials.i�s)401 Error, Credentials not correct for %sN(R�R�R�RR�(R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s	cK@s�tdk	std��ts"dS|j}d|_|r�|jdkr�ytjd�tj|�Wq�tk
r�tj	d�q�XndS(s1Response callback to save credentials on success.s'should never reach here without keyringNi�sSaving credentials to keyringsFailed to save credentials(
R�R�R�R�R�R�tinfotset_passwordR�t	exception(R�R�R�tcreds((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s		

N(t__name__t
__module__R�R�R�R�R�R�R�R�R�R�R�R�(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s	.	(				-	tLocalFSAdaptercB@s)eZdddddd�Zd�ZRS(c
C@s�t|j�}t�}d|_|j|_ytj|�}	Wn%tk
rg}
d|_|
|_n}Xtj	j
|	jdt�}t
j|�dp�d}ti|d6|	jd6|d6�|_t|d	�|_|jj|_|S(
Ni�i�tusegmtis
text/plainsContent-TypesContent-Lengths
Last-Modifiedtrb(R;R�RR�RItstattOSErrorR�temailtutilst
formatdatetst_mtimeR�t	mimetypest
guess_typeRtst_sizetheaderstopentclose(
R�RtstreamttimeouttverifytcerttproxiestpathnameR�tstatsR�tmodifiedtcontent_type((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s$			

cC@sdS(N((R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��sN(R�R�R�R�R�(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��st
SafeFileCachecB@s2eZdZd�Zd�Zd�Zd�ZRS(sw
    A file based cache which is safe to use even when the target directory may
    not be accessible or writable.
    cO@sKtt|�j||�t|j�sGtjd|j�d|_ndS(Ns�The directory '%s' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.(tsuperR�R�Rt	directoryR�R�R�(R�targsR�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s
cO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R�R�R�R�RR�tIOError(R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��scO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R�R�R�tsetRR�R�(R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�scO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R�R�R�tdeleteRR�R�(R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�
s(R�R�t__doc__R�R�R�R�(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��s
		
	
tInsecureHTTPAdaptercB@seZd�ZRS(cC@sd|_d|_dS(Nt	CERT_NONE(t	cert_reqsR�tca_certs(R�tconnR�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pytcert_verifys	(R�R�R�(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�st
PipSessioncB@s)eZdZd�Zd�Zd�ZRS(c
O@sS|jdd�}|jdd�}|jdg�}|jdd�}tt|�j||�t�|jd<td|�|_t	j
d|dd	d
ddgd
d�}|r�tdt|dt
�d|�}ntd|�}td|�}||_|jd|�|jd|�|jdt��x|D]}	|j|	�q8WdS(Ntretriesitcachetinsecure_hostsR�s
User-Agentttotaltstatus_forcelisti�i�iitbackoff_factorg�?tuse_dir_locktmax_retriesshttps://shttp://sfile://(tpopR�R�R�R�R�R�R�R�RtRetryRR�R�RR�t_insecure_adaptertmountR�tadd_insecure_host(
R�R�R�R�RRR�tsecure_adaptertinsecure_adapterthost((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�&s.			
cC@s |jdj|�|j�dS(Nshttps://{}/(R
R�R	(R�R((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRgscO@s2|jd|j�tt|�j||||�S(NR�(R�R�R�R�R(R�tmethodR�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRksN(R�R�R�R�R�RR(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�"s	A	c
C@s�|dkrtd��ntj|�}|r[|jd�j�}|dkr|r|jd�rtd||f��n|dkr/|jdd�d}|j	dd�}t
j|�}|r�|jd�d|jd	d�d}ntj
|�}|jd�r&d|jd�}n|}q[|j|�}|j�|j|jfSny.t|d
��}t|j��}WdQXWn)tk
r�}	tdt|	���nX||fS(
s*Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.

    :param url:         File path or url.
    :param comes_from:  Origin description of requirements.
    :param session:     Instance of pip.download.PipSession.
    sAget_file_content() missing 1 required keyword argument: 'session'itfilethttps6Requirements file %s references URL %s, which is localRqs\R�t|R�Ns$Could not open requirements file: %s(R�t	TypeErrort
_scheme_retsearchtgrouptlowerR|Rtsplittreplacet_url_slash_drive_retmatchR�tunquotetlstripR�traise_for_statusR�ttextR�RtreadR�R{(
R�t
comes_fromtsessionRtschemetpathR�tfR�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR9ss>	*	
s^(http|https|file):s/*([a-z])\|cC@sId|krtS|jdd�dj�}|ddddgtjkS(s)Returns true if the name looks like a URLRqiiRthttpsRtftp(R�RRR-tall_schemes(RLR#((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR:�scC@s�|jd�std|��tj|�\}}}}}|sP|dkrYd}n,tjdkrud|}ntd|��tj||�}|S(s(
    Convert a file: URL to a path.
    sfile:s4You can only turn file: urls into filenames (not %r)t	localhostR�twin32s\\s:non-local file URIs are not supported on this platform: %r(	R|R�R�turlsplitRwRtt
ValueErrorturllib_requestturl2pathname(R�R�R�R$((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR;�s
	

cC@s*t|�dj�}|tkr&tStS(s9Return True if `name` is a considered as an archive file.i(R(RRR�R�(RLtext((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR<�scC@s&t|�}|j|d|j�dS(NR�(t_get_used_vcs_backendtunpackR�(tlinktlocationtvcs_backend((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR=�scC@s.x'tjD]}|j|jkr
|Sq
WdS(s1
    Return a VersionControl object or None.
    N(R-tbackendsR#tschemesR�(R2R4((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR0�scC@stt|��S(N(tboolR0(R2((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR?�scC@s|jj�jd�S(Nsfile:(R�RR|(R2((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR@�scC@st|j�}tjj|�S(s�Return whether a file:// Link points to a directory.

    ``link`` must not have any other scheme but file://. Call is_file_url()
    first.

    (R;turl_without_fragmentRIR$tisdir(R2t	link_path((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt
is_dir_url�scO@s|S(N((titerableR�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt_progress_indicator�sc@s�yt�jd�}Wn tttfk
r9d}nXt�dt�}tj�t	j
krjt}n9|ryt}n*|d
kr�t}n|s�t}nt}|j}�fd�}	�fd�}
t
}|jtjkr�|}n	|j}|rAt|d|�}|r.tjd	|t|��qjtjd
|�n)|rZtjd|�ntjd
|�tjd|�|
||	t�t��}
|r�|j|
�n
t|
�dS(Nscontent-lengthit
from_cachei(i�c3@sry,x%�jj|dt�D]}|VqWWn?tk
rmx/tri�jj|�}|saPn|Vq?WnXdS(Ntdecode_content(R�R�R�R�R�R (t
chunk_sizetchunk(R�(s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt	resp_reads


	c3@s'x |D]}�j|�|VqWdS(N(twrite(tchunksRA(tcontent_file(s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pytwritten_chunks<s

tmaxsDownloading %s (%s)sDownloading %ssUsing cached %ssDownloading from URL %si@�(tintR�R,tKeyErrorRtgetattrR�R�tgetEffectiveLeveltloggingtINFOR�tshow_urlR=R�RR8R,R�R"R�R
tcheck_against_chunksR (R�R2REthashestprogress_barttotal_lengthtcached_respt
show_progressRNRBRFtprogress_indicatorR�tdownloaded_chunks((RER�s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt
_download_url�sL
					%					cC@s,t}tjj||j�}tjj|�r�tdt|�d
�}|dkr^t}q�|dkr�t	j
dt|��tj|�q�|dkr�t|�}t	j
dt|�t|��t
j||�q�|dkr�tjd�q�n|r(t
j||�t	jd	t|��ndS(Ns8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)aborttitwtbtasDeleting %ssBacking up %s to %si����sSaved %s(RXRYRZR[(R�RIR$RztfilenametexistsRR!R�R�R�tremoveRtshutiltmoveRwtexittcopyR�(R\R3R2Rbtdownload_locationR�t	dest_file((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt
_copy_filebs.		
tonc

C@s�|dkrtd��ntdd���}d}|rNt|||�}n|rp|}tj|�d}	n!t|||j||�\}}	t|||	|�|r�|r�t	|||�n|s�t
j|�nWdQXdS(Ns@unpack_http_url() missing 1 required keyword argument: 'session'tkindR1i(R�RR*t_check_download_dirR�R�t_download_http_urlR$R)ReRItunlink(
R2R3tdownload_dirR"RPRQttemp_dirtalready_downloaded_patht	from_pathR�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRA}s,	
cC@st|j�}t|�rjtjj|�r:t|�ntj||dt	�|rft
jd�ndS|r�|j|�nd}|r�t|||�}n|r�|}n|}tj|�d}t||||�|r�|r�t|||�ndS(s�Unpack link into location.

    If download_dir is provided and link points to a file, make a copy
    of the link file inside download_dir.
    tsymlinkss*Link is a directory, ignoring download_dirNi(R;R8R;RIR$R9R&R_tcopytreeR�R�R�tcheck_against_pathR�RhR�R�R)Re(R2R3RkRPR:RmRnR�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR>�s,
	
tPipXmlrpcTransportcB@s&eZdZed�Zed�ZRS(sRProvide a `xmlrpclib.Transport` implementation via a `PipSession`
    object.
    cC@s;tjj||�tj|�}|j|_||_dS(N(Rt	TransportR�R�R�R#t_schemet_session(R�R�R"tuse_datetimetindex_parts((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR��sc
C@s�|j||dddf}tj|�}yXidd6}|jj|d|d|dt�}|j�||_|j	|j
�SWn2tjk
r�}	t
jd|	jj|��nXdS(Nstext/xmlsContent-TypeRmR�R�sHTTP error %s while getting %s(RtR�R�t
urlunparseRutpostR�Rtverbosetparse_responseR�Rt	HTTPErrorR�tcriticalR�R�(
R�Rthandlertrequest_bodyRztpartsR�R�R�R�((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyR�s

	(R�R�R�R�R�R(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRr�sc	C@s�t|�rt||�n\t|�rAt|||d|�n7|dkrYt�}nt||||d|d|�|r�t|�ndS(svUnpack link.
       If link is a VCS link:
         if only_download, export into download_dir and ignore location
          else unpack into location
       for other types of link:
         - unpack into location
         - if download_dir, copy the file into download_dir
         - if only_download, mark location for deletion

    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.
    RPRQN(R?R=R@R>R�R�RAR(R2R3Rkt
only_downloadR"RPRQ((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRB�scC@stjj|�S(sJ
    Sanitize the "filename" value from a Content-Disposition header.
    (RIR$tbasename(R\((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRD.scC@sCtj|�\}}|jd�}|r9t|�}n|pB|S(s�
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    R\(tcgitparse_headerR�RD(tcontent_dispositiontdefault_filenamet_typetparamsR\((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRC6s
cC@s�|jjdd�d}y0|j|didd6dt�}|j�Wn2tjk
r}}tjd|j	j
|��nX|jjd	d
�}|j}	|jjd�}
|
r�t
|
|	�}	nt|	�d}|stj|�}|r|	|7}	qn|rI|j|jkrItjj|j�d}|rI|	|7}	qIntjj||	�}t|d��}
t|||
||�Wd
QX||fS(s6Download link url into temp_dir using provided sessiont#iiR�tidentitysAccept-EncodingR�sHTTP error %s while getting %sscontent-typeR�scontent-dispositiontwbN(R�RR�R�RRR|R�R}R�R�R�R\RCR(R�tguess_extensionRIR$RzR�RW(R2R"RlRPRQt
target_urlR�R�R�R\R�R/t	file_pathRE((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRiEs:	
		cC@s�tjj||j�}tjj|�r�tjd|�|r�y|j|�Wq�tk
r�tj	d|�tj
|�dSXn|SdS(s� Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    sFile was already downloaded %ss;Previously-downloaded file %s has bad hash. Re-downloading.N(RIR$RzR\R]R�R�RqRR�RjR�(R2RkRPt
download_path((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyRh�s

(s
BUILD_BUILDIDsBUILD_IDsCIRH(�t
__future__RR�temail.utilsR�RnRLR�RIRttreR_RwR}RRtpip._vendor.cachecontrolRtpip._vendor.cachecontrol.cachesRtpip._vendor.lockfileRtpip._vendor.requests.adaptersRRtpip._vendor.requests.authRR	tpip._vendor.requests.modelsR
Rtpip._vendor.requests.structuresRtpip._vendor.requests.utilsR
tpip._vendor.six.movesRtpip._vendor.six.moves.urllibRR�RR-RPtpip._internal.exceptionsRRtpip._internal.models.indexRtpip._internal.utils.compatRRtpip._internal.utils.encodingRtpip._internal.utils.filesystemRtpip._internal.utils.glibcRt pip._internal.utils.marker_filesRtpip._internal.utils.miscRRRRRRR R!R"R#R$R%R&R'R(R)tpip._internal.utils.temp_dirR*tpip._internal.utils.typingR+tpip._internal.utils.uiR,tpip._internal.vcsR-ttypingR.R/R0R1R2R3toptparseR4tpip._internal.models.linkR5tpip._internal.utils.hashesR6t pip._internal.vcs.versioncontrolR7R8R{tCredentialst__all__t	getLoggerR�R�R�tImportErrorR�R�R�R�RNROR�R�R�R�R�R�tSessionR�R9tcompiletIRRR:R;R<R=R0R?R@R;R=RWReRAR>RsRrR�RBRDRCRiRh(((s5/tmp/pip-install-ewDPok/pip/pip/_internal/download.pyt<module>s�j.		
		

		O	�!BQ/												f	*2 *			?