ok

Mini Shell

Direktori : /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/lazy_wheel.pyc

�
x�_c@sZdZddgZddlmZmZddlmZddlmZddl	m
Z
mZddlm
Z
dd	lmZdd
lmZmZmZddlmZddlmZer!dd
lmZmZmZmZmZmZddlm Z ddlm!Z!ddl"m#Z#nde$fd��YZ%d�Z&de'fd��YZ(dS(sLazy ZIP over HTTPtHTTPRangeRequestUnsupportedtdist_from_wheel_urli����(tbisect_lefttbisect_right(tcontextmanager(tNamedTemporaryFile(t
BadZipfiletZipFile(tCONTENT_CHUNK_SIZE(trange(tHEADERStraise_for_statustresponse_chunks(tMYPY_CHECK_RUNNING(t$pkg_resources_distribution_for_wheel(tAnytDicttIteratortListtOptionaltTuple(tDistribution(tResponse(t
PipSessioncBseZRS((t__name__t
__module__(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyRscCs;t||��&}t|�}t|||j�SWdQXdS(s%Return a pkg_resources.Distribution from the given wheel URL.

    This uses HTTP range requests to only fetch the potion of the wheel
    containing metadata, just enough for the object to be constructed.
    If such requests are not supported, HTTPRangeRequestUnsupported
    is raised.
    N(tLazyZipOverHTTPRRtname(Rturltsessiontwheeltzip_file((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR"s	RcBs�eZdZed�Zed��Zed��Zd�Zd�Z	ed��Z
dd�Zd	�Zd
d�Z
d�Zdd
�Zd�Zd�Zd�Zed��Zd�Zed�Zd�Zd�ZRS(sFile-like object mapped to a ZIP file over HTTP.

    This uses HTTP range requests to lazily fetch the file's content,
    which is supposed to be fed to ZipFile.  If such requests are not
    supported by the server, raise HTTPRangeRequestUnsupported
    during initialization.
    cCs�|j|dt�}t|�|jdks4t�||||_|_|_t|j	d�|_
t�|_|j
|j
�g|_g|_d|j	jdd�kr�td��n|j�dS(Ntheadersi�sContent-Lengthtbytess
Accept-Rangestnonesrange request is not supported(theadR
Rtstatus_codetAssertionErrort_sessiont_urlt_chunk_sizetintR t_lengthRt_filettruncatet_leftt_righttgetRt
_check_zip(tselfRRt
chunk_sizeR#((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyt__init__=s
		cCsdS(s!Opening mode, which is always rb.trb((R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pytmodeLscCs
|jjS(sPath to the underlying file.(R+R(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyRRscCstS(s9Return whether random access is supported, which is True.(tTrue(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pytseekableXscCs|jj�dS(sClose the file.N(R+tclose(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR8]scCs
|jjS(sWhether the file is closed.(R+tclosed(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR9bsi����cCs�t||j�}|j�|j}}|dkr:|nt|||�}td||�}|j||d�|jj|�S(s�Read up to size bytes from the object and return them.

        As a convenience, if size is unspecified or -1,
        all bytes until EOF are returned.  Fewer than
        size bytes may be returned if EOF is reached.
        ii(tmaxR(ttellR*tmint	_downloadR+tread(R1tsizet
download_sizetstarttlengthtstop((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR>hs%cCstS(s3Return whether the file is readable, which is True.(R6(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pytreadablewsicCs|jj||�S(s-Change stream position and return the new absolute position.

        Seek to offset relative position indicated by whence:
        * 0: Start of stream (the default).  pos should be >= 0;
        * 1: Current position - pos may be negative;
        * 2: End of stream - pos usually negative.
        (R+tseek(R1toffsettwhence((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyRE|s	cCs
|jj�S(sReturn the current possition.(R+R;(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR;�scCs|jj|�S(s�Resize the stream to the given size in bytes.

        If size is unspecified resize to the current position.
        The current stream position isn't changed.

        Return the new file size.
        (R+R,(R1R?((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR,�s	cCstS(s
Return False.(tFalse(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pytwritable�scCs|jj�|S(N(R+t	__enter__(R1((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyRJ�s
cGs|jj|�S(N(R+t__exit__(R1texc((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyRK�sccs*|j�}z	dVWd|j|�XdS(syReturn a context manager keeping the position.

        At the end of the block, seek back to original position.
        N(R;RE(R1tpos((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyt_stay�s	c
Cs}|jd}xittd||j��D]L}|j||�|j��(yt|�Wntk
rmnXPWdQXq)WdS(s1Check and download until the file is a valid ZIP.iiN(R*treversedR	R(R=RNRR(R1tendRA((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR0�s
"

cCsK|j�}dj||�|d<d|d<|jj|jd|dt�S(s:Return HTTP response to a range request from start to end.sbytes={}-{}tRangesno-caches
Cache-ControlR tstream(tcopytformatR&R/R'R6(R1RARPtbase_headersR ((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyt_stream_response�s
c
cs�|j||!|j||!}}t|g|d �}}t|g|d�}xEt||�D]4\}}	||kr�||dfVn|	d}qcW||kr�||fVn|g|g|j||+|j||+dS(s/Return an iterator of intervals to be fetched.

        Args:
            start (int): Start of needed interval
            end (int): End of needed interval
            left (int): Index of first overlapping downloaded data
            right (int): Index after last overlapping downloaded data
        ii����N(R-R.R<R:tzip(
R1RARPtlefttrighttlslicetrslicetitjtk((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyt_merge�s
!c	Cs�|j���t|j|�}t|j|�}x||j||||�D]b\}}|j||�}|j�|j|�x*t	||j
�D]}|jj|�q�WqJWWdQXdS(s-Download bytes from start to end inclusively.N(
RNRR.RR-R_RVRRERR(R+twrite(R1RARPRXRYtresponsetchunk((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR=�s
%

N(RRt__doc__RR3tpropertyR5RR7R8R9R>RDRER;tNoneR,RIRJRKRRNR0R
RVR_R=(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyR4s(							
			N()Rct__all__tbisectRRt
contextlibRttempfileRtzipfileRRtpip._vendor.requests.modelsRtpip._vendor.six.movesR	tpip._internal.network.utilsR
RRtpip._internal.utils.typingR
tpip._internal.utils.wheelRttypingRRRRRRtpip._vendor.pkg_resourcesRRtpip._internal.network.sessionRt	ExceptionRRtobjectR(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/network/lazy_wheel.pyt<module>s$.	

Zerion Mini Shell 1.0