Your IP : 18.220.196.68


Current Path : /opt/alt/python33/lib/python3.3/site-packages/pip/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/__pycache__/download.cpython-33.pyc

�
7�Re4Xc
@sMddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZmZmZddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd	l'm(Z(m)Z)dd
l*m+Z+ddl,m-Z-m.Z.ddl/m0Z0dd
l1m2Z2ddddddddddg
Z3dd�Z4Gdd�de(�Z5Gdd�de6�Z7Gdd�de&�Z8Gd d!�d!e#j9�Z:ddd"d�Z<ej=d#ej>�Z?ej=d$ej>�Z@d%d�ZAd&d�ZBej=d'ej>�ZCej=d(ej>�ZDd)d�ZEd*d�ZFd:d+d�ZHd,d-�ZId.d�ZJd/d�ZKd0d1�ZLd2d3�ZMd4d5�ZNd6d7�ZOddd8d�ZPdd9d�ZQdS(;iN(uurllibuurlparseu	raw_input(uInstallationErroruHashMismatch(	usplitexturmtreeuformat_sizeudisplay_pathu
backup_diruask_path_existsuunpack_fileucreate_download_cache_folderucache_download(uvcs(ulogger(urequestsusix(uBaseAdapter(uAuthBaseu
HTTPBasicAuth(uIncompleteRead(u
InvalidURLuChunkedEncodingError(uResponse(uCaseInsensitiveDictuget_file_contentuis_urluurl_to_pathupath_to_urluis_archive_fileuunpack_vcs_linkuunpack_file_urlu
is_vcs_urluis_file_urluunpack_http_urlcCs5tj�}|dkr'tj�}n�|dkr�dtjjtjjtjjf}tjjdkr�dj	|tjjg�}q�n<|dkr�tj�}n!|dkr�tj�}nd}ytj
�}tj�}Wntk
rd}d}YnXd	j	d
t
jd||fd||fg�S(u,Return a string representing the user agent.uCPythonuPyPyu%s.%s.%sufinaluuJythonu
IronPythonuUnknownu upip/%su%s/%s(uplatformupython_implementationupython_versionusysupypy_version_infoumajoruminorumicroureleaselevelujoinusystemureleaseuIOErrorupipu__version__(u_implementationu_implementation_versionup_systemu	p_release((u%/tmp/pip-zej_zi-build/pip/download.pyu
user_agent$s2	

u
user_agentcBsG|EeZdZd
dd�Zdd�Zdd�Zdd�Zd	S(uMultiDomainBasicAuthcCs||_i|_dS(N(u	promptingu	passwords(uselfu	prompting((u%/tmp/pip-zej_zi-build/pip/download.pyu__init__Hs	uMultiDomainBasicAuth.__init__cCs�tj|j�}|jjdd�d}tj|dd�|f|dd��|_|jj|d�\}}|dkr�|j|j�\}}n|s�|r�||f|j|<t	|p�d|p�d�|�}n|j
d|j�|S(Nu@iiuuresponsei����(NN(uurlparseuurlunetlocusplitu
urlunparseu	passwordsugetuNoneuparse_credentialsu
HTTPBasicAuthu
register_hooku
handle_401(uselfurequparsedunetlocuusernameupassword((u%/tmp/pip-zej_zi-build/pip/download.pyu__call__Ls1$uMultiDomainBasicAuth.__call__cKs�|jdkr|S|js |Stj|j�}td|j�}tjd�}|s`|ry||f|j|j<n|j|j	j
�t|p�d|p�d�|j�}|j
j||�}|jj|�|S(Ni�u
User for %s: u
Password: u(ustatus_codeu	promptinguurlparseuurlu	raw_inputunetlocugetpassu	passwordsucontenturawurelease_connu
HTTPBasicAuthurequestu
connectionusenduhistoryuappend(uselfurespukwargsuparseduusernameupasswordurequnew_resp((u%/tmp/pip-zej_zi-build/pip/download.pyu
handle_401hs	
$uMultiDomainBasicAuth.handle_401cCsLd|krH|jdd�d}d|kr>|jdd�S|dfSdS(Nu@iiu:(NN(ursplitusplituNone(uselfunetlocuuserinfo((u%/tmp/pip-zej_zi-build/pip/download.pyuparse_credentials�s
u&MultiDomainBasicAuth.parse_credentialsNT(u__name__u
__module__u__qualname__uTrueu__init__u__call__u
handle_401uparse_credentials(u
__locals__((u%/tmp/pip-zej_zi-build/pip/download.pyuMultiDomainBasicAuthFs"uMultiDomainBasicAuthcBsS|EeZdZdd�Zdd�Zd	d	d
dd�Zedd��Z	d	S(uLocalFSResponsecCs
||_dS(N(ufileobj(uselfufileobj((u%/tmp/pip-zej_zi-build/pip/download.pyu__init__�suLocalFSResponse.__init__cCst|j|�S(N(ugetattrufileobj(uselfuname((u%/tmp/pip-zej_zi-build/pip/download.pyu__getattr__�suLocalFSResponse.__getattr__cCs|jj|�S(N(ufileobjuread(uselfuamtudecode_contentu
cache_content((u%/tmp/pip-zej_zi-build/pip/download.pyuread�suLocalFSResponse.readcs9Gdd�dt��G�fdd�dt�}|�S(NcBs,|EeZdZdd�Zdd�ZdS(u7LocalFSResponse._original_response.<locals>.FakeMessagecSsgS(N((uselfuheader((u%/tmp/pip-zej_zi-build/pip/download.pyu
getheaders�suBLocalFSResponse._original_response.<locals>.FakeMessage.getheaderscSsgS(N((uselfuheaderudefault((u%/tmp/pip-zej_zi-build/pip/download.pyuget_all�su?LocalFSResponse._original_response.<locals>.FakeMessage.get_allN(u__name__u
__module__u__qualname__u
getheadersuget_all(u
__locals__((u%/tmp/pip-zej_zi-build/pip/download.pyuFakeMessage�suFakeMessagecs,|EeZdZe�fdd��ZdS(u8LocalFSResponse._original_response.<locals>.FakeResponsecs��S(N((uself(uFakeMessage(u%/tmp/pip-zej_zi-build/pip/download.pyumsg�su<LocalFSResponse._original_response.<locals>.FakeResponse.msgN(u__name__u
__module__u__qualname__upropertyumsg(u
__locals__(uFakeMessage(u%/tmp/pip-zej_zi-build/pip/download.pyuFakeResponse�suFakeResponse(uobject(uselfuFakeResponse((uFakeMessageu%/tmp/pip-zej_zi-build/pip/download.pyu_original_response�su"LocalFSResponse._original_responseNF(
u__name__u
__module__u__qualname__u__init__u__getattr__uNoneuFalseureadupropertyu_original_response(u
__locals__((u%/tmp/pip-zej_zi-build/pip/download.pyuLocalFSResponse�suLocalFSResponsecBs;|EeZdZddddddd�Zdd�ZdS(uLocalFSAdapterc
Cstj|j�}|jj�dkr=td|j��ntj|dd�d|dd��}t|�}	t�}
d|
_||
_t	j
|	�}tjj
|jdd�}titj|	�dp�d	d
6|jd6|d6�|
_tt|	d
��|
_|
jj|
_|
S(Nu	localhostu)Invalid URL %r: Only localhost is allowediuii�uusegmtiu
text/plainuContent-TypeuContent-Lengthu
Last-Modifiedurb(uT(uurlparseuurlunetloculoweru
InvalidURLu
urlunparseuurl_to_pathuResponseustatus_codeuosustatuemailuutilsu
formatdateust_mtimeuTrueuCaseInsensitiveDictu	mimetypesu
guess_typeust_sizeuheadersuLocalFSResponseuopenurawuclose(
uselfurequestustreamutimeoutuverifyucertuproxiesu
parsed_urlureal_urlupathnameurespustatsumodified((u%/tmp/pip-zej_zi-build/pip/download.pyusend�s$+			
uLocalFSAdapter.sendcCsdS(N((uself((u%/tmp/pip-zej_zi-build/pip/download.pyuclose�suLocalFSAdapter.closeN(u__name__u
__module__u__qualname__uNoneusenduclose(u
__locals__((u%/tmp/pip-zej_zi-build/pip/download.pyuLocalFSAdapter�suLocalFSAdaptercs>|EeZdZdZ�fdd�Z�fdd�Z�S(u
PipSessioncsLtt|�j||�t�|jd<t�|_|jdt��dS(Nu
User-Agentufile://(	usuperu
PipSessionu__init__u
user_agentuheadersuMultiDomainBasicAuthuauthumountuLocalFSAdapter(uselfuargsukwargs(u	__class__(u%/tmp/pip-zej_zi-build/pip/download.pyu__init__�suPipSession.__init__cs~tj|�}|jdkrLtj|dd�d|dd��}n|jd|j�tt|�j||||�S(Nufileiu	localhostiutimeout(u	localhost(uurlparseuschemeu
urlunparseu
setdefaultutimeoutusuperu
PipSessionurequest(uselfumethoduurluargsukwargsuparsed(u	__class__(u%/tmp/pip-zej_zi-build/pip/download.pyurequest�s
.uPipSession.requestN(u__name__u
__module__u__qualname__uNoneutimeoutu__init__urequest(u
__locals__((u	__class__u%/tmp/pip-zej_zi-build/pip/download.pyu
PipSession�su
PipSessionc

Cs�|d
krt�}ntj|�}|rq|jd�j�}|dkr||r||jd�r|td||f��n|dkr,|jdd�d}|j	dd�}t
j|�}|r�|jd�d|jdd�d}ntj
|�}|jd�r#d|jd�}n|}qq|j|�}|j�tjr^|j|jfS|j|jfSnyt|�}|j�}Wn8tk
r�tj�d}	td	t|	���YnX|j�||fS(u�Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.iufileuhttpu6Requirements file %s references URL %s, which is localu:u\u/u|u$Could not open requirements file: %sN(uNoneu
PipSessionu
_scheme_reusearchugroupuloweru
startswithuInstallationErrorusplitureplaceu_url_slash_drive_reumatchuurllibuunquoteulstripugeturaise_for_statususixuPY3uurlutextucontentuopenureaduIOErrorusysuexc_infoustruclose(
uurlu
comes_fromusessionumatchuschemeupathurespufucontentue((u%/tmp/pip-zej_zi-build/pip/download.pyuget_file_content�sB*	
	

u^(http|https|file):u/*([a-z])\|cCsId|krdS|jdd�dj�}|ddddgtjkS(	u)Returns true if the name looks like a URLu:iiuhttpuhttpsufileuftpF(uFalseusplituloweruvcsuall_schemes(unameuscheme((u%/tmp/pip-zej_zi-build/pip/download.pyuis_url scCs�|jd�std|��|td�d�jd�}tj|�}tj|�r{|dd|dd�}n
d|}|S(u(
    Convert a file: URL to a path.
    ufile:u4You can only turn file: urls into filenames (not %r)Nu/iu:i(u
startswithuAssertionErrorulenulstripuurllibuunquoteu
_url_drive_reumatch(uurlupath((u%/tmp/pip-zej_zi-build/pip/download.pyuurl_to_path(s

u	^([a-z]):u^([a-z])[:|]cCs�tjjtjj|��}tjj|�\}}|jtjj�}djdd�|D��}|s|jd�}nd||S(uh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    u/cSsg|]}tj|��qS((uurllibuquote(u.0upart((u%/tmp/pip-zej_zi-build/pip/download.pyu
<listcomp>Cs	upath_to_url.<locals>.<listcomp>ufile:///(	uosupathunormpathuabspathu
splitdriveusplitusepujoinulstrip(upathudriveufilepathuurl((u%/tmp/pip-zej_zi-build/pip/download.pyupath_to_url;scCs0d	}t|�dj�}||kr,d
SdS(u9Return True if `name` is a considered as an archive file.u.zipu.tar.gzu.tar.bz2u.tgzu.taru	.pybundleu.whli(u.zipu.tar.gzu.tar.bz2u.tgzu.taru	.pybundleu.whlTF(usplitextuloweruTrueuFalse(unameuarchivesuext((u%/tmp/pip-zej_zi-build/pip/download.pyuis_archive_fileIscCs3t|�}|r"|j|�n
|j|�dS(N(u_get_used_vcs_backenduexportuunpack(ulinkulocationu
only_downloaduvcs_backend((u%/tmp/pip-zej_zi-build/pip/download.pyuunpack_vcs_linkSscCs=x6tjD]+}|j|jkr
||j�}|Sq
WdS(N(uvcsubackendsuschemeuschemesuurl(ulinkubackenduvcs_backend((u%/tmp/pip-zej_zi-build/pip/download.pyu_get_used_vcs_backend[su_get_used_vcs_backendcCstt|��S(N(uboolu_get_used_vcs_backend(ulink((u%/tmp/pip-zej_zi-build/pip/download.pyu
is_vcs_urlbscCs|jj�jd�S(Nufile:(uurluloweru
startswith(ulink((u%/tmp/pip-zej_zi-build/pip/download.pyuis_file_urlfscCs�|jtj|j�jkrQtjd|j||jf�td|��n|j�|jkr�tjd||j�|jf�td|j|f��ndS(NuPHash digest size of the package %d (%s) doesn't match the expected hash name %s!u!Hash name mismatch for package %su?Hash of the package %s (%s) doesn't match the expected hash %s!uBad %s hash for package %s(	udigest_sizeuhashlibunewu	hash_nameuloggerufataluHashMismatchu	hexdigestuhash(u
download_hashulink((u%/tmp/pip-zej_zi-build/pip/download.pyu_check_hashjs		u_check_hashcCs�ytj|j�}Wn6ttfk
rNtjd|j|f�dSYnXt|d�}x)|j	d�}|szPn|j
|�qa|j�|S(Nu'Unsupported hash name %s for package %surbi(uhashlibunewu	hash_nameu
ValueErroru	TypeErroruloggeruwarnuNoneuopenureaduupdateuclose(utarget_fileulinku
download_hashufpuchunk((u%/tmp/pip-zej_zi-build/pip/download.pyu_get_hash_from_fileus	
u_get_hash_from_filecst|d�}d}|jro|jroytj|j�}Wqotk
rktjd|j|f�YqoXnyt	�j
d�}Wn!tttfk
r�d}YnXd}|dkp�|}|j
}z |r|r�tjd|t|�f�q tjd|�ntjd	|�tjd
|��fdd�}	x�|	d
�D]�}
|t|
�7}|r�|s�tjdt|��q�tjdd||t|�f�n|dk	r�|j|
�n|j|
�qPW|j�Wd|rtjdt|��nX|S(Nuwbu'Unsupported hash name %s for package %sucontent-lengthii(i�uDownloading %s (%s): uDownloading %s (unknown size): uDownloading %suDownloading from URL %sc3s�ydy,x%�jj|dd�D]}|VqWWn1tk
rb}zt|��WYdd}~XnXWn9tk
r�x$�jj|�}|s�Pn|VqwYnXdS(Nudecode_contentF(urawustreamuFalseuIncompleteReaduChunkedEncodingErroruAttributeErroruread(u
chunk_sizeuchunkue(uresp(u%/tmp/pip-zej_zi-build/pip/download.pyu	resp_read�s
#
u _download_url.<locals>.resp_readiu%su	%3i%%  %sidu
%s downloadedi@�(uopenuNoneuhashu	hash_nameuhashlibunewu
ValueErroruloggeruwarnuintuheadersuKeyErroru	TypeErrorushow_urlustart_progressuformat_sizeunotifyuinfoulenu
show_progressuupdateuwriteucloseuend_progress(urespulinku
temp_locationufpu
download_hashutotal_lengthu
downloadedu
show_progressushow_urlu	resp_readuchunk((urespu%/tmp/pip-zej_zi-build/pip/download.pyu
_download_url�sF
"	 (u
_download_urlcCsd}tjj||j�}tjj|�r�tdt|�d	�}|dkr^d
}q�|dkr�t	j
dt|��tj|�q�|dkr�t|�}t	j
dt|�t|�f�t
j||�q�n|rt
j||�t	jdt|��ndS(Nu/The file %s exists. (i)gnore, (w)ipe, (b)ackup uiuwubuDeleting %suBacking up %s to %suSaved %sT(uiuwubF(uTrueuosupathujoinufilenameuexistsuask_path_existsudisplay_pathuFalseuloggeruwarnuremoveu
backup_dirushutilumoveucopyunotify(ufilenameulocationucontent_typeulinkucopyudownload_locationuresponseu	dest_file((u%/tmp/pip-zej_zi-build/pip/download.pyu
_copy_file�s&		u
_copy_filec0Cs�|dkrt�}ntjdd�}d}|jjdd�d}d}d}	d}
d}|r�tjj	|t
j|d��}	|	d}
tjj|	�o�tjj|
�}tjj
|�s�t|�q�nd}|rtjj	||j�}tjj|�sd}qn|r�|}tj|�d}
tjd|�|jr�t||�}yt||�Wq�tk
r�tjd	|�d}tj|�d}Yq�Xq�n|r�|r�t|
��}|j�j�}
WdQX|	}tjd
|	�|jr�|jr�t|	|�}yt||�Wq�tk
r�tjd|�d}tj|	�tj|
�d}Yq�Xq�n|s-y#|j|dd�}|j �WnHt!j"k
r�}z%tj#d
|j$j%|f��WYdd}~XnX|j&jdd�}
|j}|j&jd�}|r^t'j(|�\}}|jd�pX|}nt)|�d}|s�tj*|
�}|r�||7}q�n|r�|j|jkr�tjj)|j�d}|r�||7}q�ntjj	||�}t+|||�}|jr-|jr-t||�q-n|rP|rPt,|||
|�nt-|||
|�|	r�|r�t.|	||
�n|p�|s�tj|�ntj/|�dS(Nu-unpackupip-u#iiuu
.content-typeuFile was already downloaded %su;Previously-downloaded file %s has bad hash, re-downloading.uUsing download cache from %su,Cached file %s has bad hash, re-downloading.ustreamuHTTP error %s while getting %sucontent-typeucontent-dispositionufilenameFT(0uNoneu
PipSessionutempfileumkdtempuurlusplituFalseuosupathujoinuurllibuquoteuexistsuisdirucreate_download_cache_folderufilenameu	mimetypesu
guess_typeuloggerunotifyuhashu_get_hash_from_fileu_check_hashuHashMismatchuwarnuunlinkuopenureadustripu	hash_nameugetuTrueuraise_for_statusurequestsu	HTTPErrorufataluresponseustatus_codeuheadersucgiuparse_headerusplitextuguess_extensionu
_download_urlu
_copy_fileuunpack_fileucache_downloadurmdir(ulinkulocationudownload_cacheudownload_dirusessionutemp_diru
temp_locationu
target_urlualready_cachedu
cache_fileucache_content_type_fileu
download_hashualready_downloadeducontent_typeufpurespuexcufilenameucontent_dispositionutypeuparamsuext((u%/tmp/pip-zej_zi-build/pip/download.pyuunpack_http_url�s�
	





		

c
Cs�t|j�}d}tjj|�r`tjj|�rFt|�ntj||dd�dS|j
r�t||�}t||�n|rMtjj
||j�}tjj|�rMtj|�d}tjd|�|j
rAt||�}yt||�d}WqGtk
r=tjd|�tj|�YqGXqJd}qMn|r\|}	n|}	tj|	�d}t|	|||�|r�|r�t|	|||�ndS(NusymlinksiuFile was already downloaded %su;Previously-downloaded file %s has bad hash, re-downloading.FT(uurl_to_pathuurl_without_fragmentuFalseuosupathuisdirurmtreeushutilucopytreeuTrueuhashu_get_hash_from_fileu_check_hashujoinufilenameuexistsu	mimetypesu
guess_typeuloggerunotifyuHashMismatchuwarnuunlinkuunpack_fileu
_copy_file(
ulinkulocationudownload_diru	link_pathualready_downloadedulink_path_hashu
download_pathucontent_typeu
download_hashu	from_path((u%/tmp/pip-zej_zi-build/pip/download.pyuunpack_file_urlRsB
		


	
F(Rucgiuemail.utilsuemailuhashlibugetpassu	mimetypesuosuplatformureushutilusysutempfileupipupip.backwardcompatuurllibuurlparseu	raw_inputupip.exceptionsuInstallationErroruHashMismatchupip.utilusplitexturmtreeuformat_sizeudisplay_pathu
backup_diruask_path_existsuunpack_fileucreate_download_cache_folderucache_downloadupip.vcsuvcsupip.loguloggerupip._vendorurequestsusixupip._vendor.requests.adaptersuBaseAdapterupip._vendor.requests.authuAuthBaseu
HTTPBasicAuthupip._vendor.requests.compatuIncompleteReadupip._vendor.requests.exceptionsu
InvalidURLuChunkedEncodingErrorupip._vendor.requests.modelsuResponseupip._vendor.requests.structuresuCaseInsensitiveDictu__all__u
user_agentuMultiDomainBasicAuthuobjectuLocalFSResponseuLocalFSAdapteruSessionu
PipSessionuNoneuget_file_contentucompileuIu
_scheme_reu_url_slash_drive_reuis_urluurl_to_pathu	_drive_reu
_url_drive_reupath_to_urluis_archive_fileuFalseuunpack_vcs_linku_get_used_vcs_backendu
is_vcs_urluis_file_urlu_check_hashu_get_hash_from_fileu
_download_urlu
_copy_fileuunpack_http_urluunpack_file_url(((u%/tmp/pip-zej_zi-build/pip/download.pyu<module>sh@	"M#,
<y

?>