Your IP : 18.223.158.29


Current Path : /opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyc

�
�Rec@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZmZmZdd	lmZmZmZdd
lmZerddlmZmZddlmZdd
lmZddlm Z nej!e"�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)de*fd��YZ+de*fd��YZ,dS(s)Download files with progress indicators.
i����N(tCONTENT_CHUNK_SIZE(tDownloadProgressProvider(tNetworkConnectionError(tPyPI(t
is_from_cache(tHEADERStraise_for_statustresponse_chunks(tformat_sizetredact_auth_from_urltsplitext(tMYPY_CHECK_RUNNING(tIterabletOptional(tResponse(tLink(t
PipSessioncCs7yt|jd�SWntttfk
r2dSXdS(Nscontent-length(tinttheaderst
ValueErrortKeyErrort	TypeErrortNone(tresp((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt_get_http_response_size%scCst|�}|jtjkr*|j}n	|j}t|�}|r`dj|t|��}nt	|�rt
jd|�nt
jd|�t
j�t
jkr�t}n?t	|�r�t}n*|s�t}n|dkr�t}nt}t|t�}|s|St|d|�|�S(Ns{} ({})sUsing cached %ssDownloading %si(i�tmaxi@�(RtnetlocRtfile_storage_domaintshow_urlturl_without_fragmentR	tformatRRtloggertinfotgetEffectiveLeveltloggingtINFOtFalsetTrueRRR(Rtlinktprogress_barttotal_lengthturlt
logged_urlt
show_progresstchunks((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt_prepare_download-s2					cCstjj|�S(sJ
    Sanitize the "filename" value from a Content-Disposition header.
    (tostpathtbasename(tfilename((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pytsanitize_content_filenameYscCsCtj|�\}}|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.
    R1(tcgitparse_headertgetR2(tcontent_dispositiontdefault_filenamet_typetparamsR1((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pytparse_content_dispositionas
cCs�|j}|jjd�}|r3t||�}nt|�d}|s}tj|jjdd��}|r}||7}q}n|r�|j|jkr�tj	j|j�d}|r�||7}q�n|S(soGet an ideal filename from the given HTTP response, falling back to
    the link filename if not provided.
    scontent-dispositioniscontent-typet(
R1RR5R:R
t	mimetypestguess_extensionR)R.R/(RR&R1R6text((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt_get_http_response_filenameps	cCsB|jjdd�d}|j|dtdt�}t|�|S(Nt#iiRtstream(R)tsplitR5RR%R(tsessionR&t
target_urlR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt_http_get_download�s
tDownloadcBseZd�ZRS(cCs||_||_||_dS(N(tresponseR1R,(tselfRGR1R,((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt__init__�s		(t__name__t
__module__RI(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyRF�st
DownloadercBseZd�Zd�ZRS(cCs||_||_dS(N(t_sessiont
_progress_bar(RHRCR'((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyRI�s	cCs�yt|j|�}WnDtk
r\}|jdk	s=t�tjd|jj|��nXt	|t
||�t|||j��S(NsHTTP error %s while getting %s(
RERMRRGRtAssertionErrorRtcriticaltstatus_codeRFR?R-RN(RHR&Rte((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt__call__�s(RJRKRIRS(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyRL�s		(-t__doc__R3R"R<R.tpip._vendor.requests.modelsRtpip._internal.cli.progress_barsRtpip._internal.exceptionsRtpip._internal.models.indexRtpip._internal.network.cacheRtpip._internal.network.utilsRRRtpip._internal.utils.miscRR	R
tpip._internal.utils.typingRttypingRR
Rtpip._internal.models.linkRtpip._internal.network.sessionRt	getLoggerRJRRR-R2R:R?REtobjectRFRL(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/download.pyt<module>s4		,				

?>