403 Forbidden


Disable Functions:
Path : /lib/python3.6/site-packages/pip/__pycache__/
File Upload :
Command :
Current File : //lib/python3.6/site-packages/pip/__pycache__/download.cpython-36.pyc

3

�υ_�}�@sJddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZyddlZdZWnek
r�dZYnXddlmZddlmZddlZddlmZmZddlmZdd	lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd
l(m)Z)ddl*m+Z+ddl,m-Z-dd
l.m/Z/ddl0m1Z1ddl2m3Z3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;ddl<m=Z=m>Z>ddl?m@Z@mAZAddlBmCZCmDZDddlEmFZFddlGmHZHddl9mIZIddlJmKZKddlLmMZMddlNmOZOddlPmQZQdddd d!d"d#d$d%d&d'gZRejSeT�ZUd(d)�ZVGd*d+�d+e@�ZWGd,d-�d-e=�ZXGd.d/�d/eM�ZYGd0d1�d1e>�ZZGd2d3�d3e:j[�Z\dSd4d�Z]ej^d5ej_�Z`ej^d6ej_�Zad7d�Zbd8d�Zcd9d �Zdd:d!�Zed;d"�Zfd<d=�Zgd>d$�Zhd?d%�Zid@dA�ZjdBdC�ZkdDdE�ZldFdG�ZmdTdHd&�ZndUdId#�ZodJdK�ZpGdLdM�dMeQjq�ZrdVdNd'�ZsdOdP�ZtdQdR�ZudS)W�)�absolute_importNTF)�parse)�request)�InstallationError�HashMismatch)�PyPI)
�splitext�rmtree�format_size�display_path�
backup_dir�ask_path_exists�unpack_file�ARCHIVE_EXTENSIONS�consume�call_subprocess)�auto_decode)�check_path_owner)�
indent_log)�SETUPTOOLS_SHIM)�libc_ver)�DownloadProgressBar�DownloadProgressSpinner)�write_delete_marker_file)�vcs)�requests�six)�BaseAdapter�HTTPAdapter)�AuthBase�
HTTPBasicAuth)�CONTENT_CHUNK_SIZE�Response)�get_netrc_auth)�CaseInsensitiveDict)�urllib3)�CacheControlAdapter)�	FileCache)�	LockError)�
xmlrpc_client�get_file_content�is_url�url_to_path�path_to_url�is_archive_file�unpack_vcs_link�unpack_file_url�
is_vcs_url�is_file_url�unpack_http_url�
unpack_urlcCsdtjd�tj�dtj�id�}|dddkrBtj�|dd<n�|dddkr�tjjd	krntjd
d�}ntj}djd
d�|D��|dd<nB|dddkr�tj�|dd<n |dddkr�tj�|dd<tjj	d��rJddl
m}tt
dd�tdddg|j����}tt
dd�tddgt����}|�r<||d<|�rJ||d<tjj	d��r|tj�d�r|dtj�dd�|d<tj��r�tj�|jdi�d<tj��r�tj�|jdi�d<tj��r�tj�|d<t�r�tjd
d �d)k�r�tj|d"<d#j|tj|d*d&d'�d(�S)+z6
    Return a string representing the user agent.
    �pip)�name�versionr6)Z	installer�python�implementationr9ZCPythonr7ZPyPy�finalN��.cSsg|]}t|��qS�)�str)�.0�xr=r=�/usr/lib/python3.6/download.py�
<listcomp>Sszuser_agent.<locals>.<listcomp>ZJythonZ
IronPython�linuxr)�distrocSs|dS)N�r=)r@r=r=rA�<lambda>_szuser_agent.<locals>.<lambda>�idcSs|dS)NrEr=)r@r=r=rArFcs�lib�libcrD�darwinZmacOS�system�releaseZcpu��Zopenssl_versionz9{data[installer][name]}/{data[installer][version]} {json}�,�:T)Z
separatorsZ	sort_keys)�data�json)rMrN)rOrP)r5�__version__�platformZpython_versionZpython_implementation�sys�pypy_version_info�releaselevel�join�
startswith�pip._vendorrD�dict�filter�zipZlinux_distributionrZmac_verrK�
setdefaultrL�machine�HAS_TLS�version_info�sslZOPENSSL_VERSION�formatrR�dumps)rQrVrDZdistro_infosrIr=r=rA�
user_agent?sP




rec@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)�MultiDomainBasicAuthTcCs||_i|_dS)N)�	prompting�	passwords)�selfrgr=r=rA�__init__�szMultiDomainBasicAuth.__init__cCs�tj|j�}|jjdd�d}tj|dd�|f|dd��|_|jj|d�\}}|dkrn|j|j�\}}|dkr�|dkr�t	|j�}|r�|nd\}}|s�|r�||f|j|<t
|p�d|p�d�|�}|jd|j�|S)	N�@rErM��response���)NN)NN)
�urllib_parse�urlparse�url�netloc�rsplit�
urlunparserh�get�parse_credentialsr#r Z
register_hook�
handle_401)ri�req�parsedrr�username�passwordZ
netrc_authr=r=rA�__call__�s&
zMultiDomainBasicAuth.__call__cKs�|jdkr|S|js|Stj|j�}tjjd|j�}t	j	d�}|sH|rX||f|j
|j<|j|jj
�t|ppd|pvd�|j�}|jj|f|�}|jj|�|S)Ni�z
User for %s: z
Password: rl)�status_codergrorprqrZmoves�inputrr�getpassrh�content�rawZrelease_connr rZ
connection�send�history�append)ri�resp�kwargsryrzr{rxZnew_respr=r=rArw�s


zMultiDomainBasicAuth.handle_401cCs8d|kr4|jdd�d}d|kr,|jdd�S|dfSdS)NrkrErrP)NN)rs�split)rirrZuserinfor=r=rArv�sz&MultiDomainBasicAuth.parse_credentialsN)T)�__name__�
__module__�__qualname__rjr|rwrvr=r=r=rArf�s
!"rfc@seZdZddd�Zdd�ZdS)�LocalFSAdapterNc
Cs�t|j�}t�}d|_|j|_ytj|�}	Wn.tk
rZ}
zd|_|
|_WYdd}
~
XnPXtj	j
|	jdd�}tj
|�dp~d}t||	j|d��|_t|d�|_|jj|_|S)	N��i�T)Zusegmtrz
text/plain)zContent-TypezContent-Lengthz
Last-Modified�rb)r,rqr"r}�os�stat�OSErrorr��emailZutilsZ
formatdate�st_mtime�	mimetypes�
guess_typer$�st_size�headers�open�close)
rir�stream�timeout�verify�certZproxies�pathnamer�Zstats�excZmodified�content_typer=r=rAr��s$

zLocalFSAdapter.sendcCsdS)Nr=)rir=r=rAr��szLocalFSAdapter.close)NNNNN)r�r�r�r�r�r=r=r=rAr��s
r�csDeZdZdZ�fdd�Z�fdd�Z�fdd�Z�fdd	�Z�ZS)
�
SafeFileCachezw
    A file based cache which is safe to use even when the target directory may
    not be accessible or writable.
    cs4tt|�j||�t|j�s0tjd|j�d|_dS)Nz�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.)�superr�rjr�	directory�logger�warning)ri�argsr�)�	__class__r=rArj�s
zSafeFileCache.__init__c
s@|jdkrdSytt|�j||�Stttfk
r:YnXdS)N)r�r�r�rur(r��IOError)rir�r�)r�r=rArus
zSafeFileCache.getc
s@|jdkrdSytt|�j||�Stttfk
r:YnXdS)N)r�r�r��setr(r�r�)rir�r�)r�r=rAr�s
zSafeFileCache.setc
s@|jdkrdSytt|�j||�Stttfk
r:YnXdS)N)r�r�r��deleter(r�r�)rir�r�)r�r=rAr�(s
zSafeFileCache.delete)	r�r�r��__doc__rjrur�r��
__classcell__r=r=)r�rAr��s


r�c@seZdZdd�ZdS)�InsecureHTTPAdaptercCsd|_d|_dS)NZ	CERT_NONE)Z	cert_reqsZca_certs)riZconnrqr�r�r=r=rA�cert_verify8szInsecureHTTPAdapter.cert_verifyN)r�r�r�r�r=r=r=rAr�6sr�cs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
PipSessionNc	s�|jdd�}|jdd�}|jdg�}tt|�j||�t�|jd<t�|_tj	|dgdd�}|rvt
t|d	d
�|d�}n
t|d�}t
|d�}|jd
|�|jd|�|jdt��x|D]}|jdj|�|�q�WdS)N�retriesr�cache�insecure_hostsz
User-Agenti�g�?)ZtotalZstatus_forcelistZbackoff_factorT)Zuse_dir_lock)r��max_retries)r�zhttps://zhttp://zfile://zhttps://{0}/)�popr�r�rjrer�rfZauthr%ZRetryr&r�rr�Zmountr�rc)	rir�r�r�r�r�Zsecure_adapterZinsecure_adapter�host)r�r=rArjAs*




zPipSession.__init__cs(|jd|j�tt|�j||f|�|�S)Nr�)r^r�r�r�r)ri�methodrqr�r�)r�r=rAr}szPipSession.request)r�r�r�r�rjrr�r=r=)r�rAr�=s<r�c
CsL|dkrtd��tj|�}|r�|jd�j�}|dkrR|rR|jd�rRtd||f��|dkr�|jdd�d}|jdd	�}t	j
|�}|r�|jd�d|jd
d�d}tj|�}|jd	�r�d	|j
d	�}|}n|j|�}|j�|j|jfSy&t|d��}t|j��}WdQRXWn4tk
�rB}	ztdt|	���WYdd}	~	XnX||fS)
z�Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.NzAget_file_content() missing 1 required keyword argument: 'session'rE�file�httpz6Requirements file %s references URL %s, which is localrP�\�/�|r�z$Could not open requirements file: %s)�	TypeError�
_scheme_re�search�group�lowerrYrr��replace�_url_slash_drive_re�matchroZunquote�lstripru�raise_for_statusrq�textr�r�readr�r>)
rqZ
comes_from�sessionr��scheme�pathr��fr�r�r=r=rAr*�s>





 z^(http|https|file):z/*([a-z])\|cCs6d|krdS|jdd�dj�}|ddddgtjkS)	z)Returns true if the name looks like a URLrPFrErr�Zhttpsr�Zftp)r�r�rZall_schemes)r6r�r=r=rAr+�scCsH|jd�std|��tj|�\}}}}}|r6d|}tj||�}|S)z(
    Convert a file: URL to a path.
    zfile:z4You can only turn file: urls into filenames (not %r)z\\)rY�AssertionErrorroZurlsplit�urllib_requestZurl2pathname)rq�_rrr�r=r=rAr,�s
cCs*tjjtjj|��}tjdtj|��}|S)zh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    zfile:)r�r��normpath�abspathroZurljoinr�Zpathname2url)r�rqr=r=rAr-�scCs t|�dj�}|tkrdSdS)z9Return True if `name` is a considered as an archive file.rETF)rr�r)r6�extr=r=rAr.�scCst|�}|j|�dS)N)�_get_used_vcs_backend�unpack)�link�location�vcs_backendr=r=rAr/�scCs.x(tjD]}|j|jkr||j�}|SqWdS)N)rZbackendsr�Zschemesrq)r�Zbackendr�r=r=rAr��s
r�cCstt|��S)N)�boolr�)r�r=r=rAr1�scCs|jj�jd�S)Nzfile:)rqr�rY)r�r=r=rAr2�scCst|j�}tjj|�S)z�Return whether a file:// Link points to a directory.

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

    )r,�url_without_fragmentr�r��isdir)r��	link_pathr=r=rA�
is_dir_url�s
r�cOs|S)Nr=)�iterabler�r�r=r=rA�_progress_indicator�sr�c

sLyt�jd�}Wntttfk
r0d}YnXt�dd�}tj�tj	krRd}n&|r\d}n|dkrjd}n|std}nd}|j
}�fdd	�}�fd
d�}	t}
|jt
jkr�|}n|j}|r�|r�tjd|t|��t|d
�j}
ntjd|�t�j}
n |�rtjd|�ntjd|�tjd|�|	|
|t�t��}|�r@|j|�nt|�dS)Nzcontent-lengthrZ
from_cacheF�(i�Tc3s\y$x�jj|dd�D]
}|VqWWn2tk
rVx�jj|�}|sHP|Vq6WYnXdS)NF)Zdecode_content)r�r��AttributeErrorr�)Z
chunk_size�chunk)r�r=rA�	resp_readsz _download_url.<locals>.resp_readc3s"x|D]}�j|�|VqWdS)N)�write)Zchunksr�)�content_filer=rA�written_chunks:s

z%_download_url.<locals>.written_chunkszDownloading %s (%s))�maxzDownloading %szUsing cached %szDownloading from URL %si@�)�intr��
ValueError�KeyErrorr��getattrr�ZgetEffectiveLevel�logging�INFO�show_urlr�rrrr��infor
r�iterr�debugr!Zcheck_against_chunksr)
r�r�r��hashesZtotal_lengthZcached_respZ
show_progressr�r�r�Zprogress_indicatorrqZdownloaded_chunksr=)r�r�rA�
_download_urlsL
%
r�cCs�d}tjj||j�}tjj|�r�tdt|�d�}|dkr@d}nj|dkrdtjdt|��tj	|�nF|dkr�t
|�}tjd	t|�t|��tj||�n|dkr�t
jd
�|r�tj||�tjdt|��dS)NTz8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort�i�w�b�aFzDeleting %szBacking up %s to %srEzSaved %s)r�r�r�r�rn)r�r�rX�filename�existsr
rr�r��remover�shutilZmoverU�exit�copyr�)r�r�r�r�Zdownload_locationrmZ	dest_filer=r=rA�
_copy_file`s.

r�c	Cs�|dkrtd��tjdd�}d}|r0t|||�}|rH|}tj|�d}nt||||�\}}t||||�|r~|r~t|||�|s�t	j
|�t|�dS)Nz@unpack_http_url() missing 1 required keyword argument: 'session'z-unpackzpip-r)r��tempfileZmkdtemp�_check_download_dirr�r��_download_http_urlrr�r��unlinkr	)	r�r��download_dirr�r��temp_dir�already_downloaded_path�	from_pathr�r=r=rAr3{s,


cCs�t|j�}t|�rHtjj|�r&t|�tj||dd�|rDt	j
d�dS|rV|j|�d}|rjt|||�}|rt|}n|}t
j|�d}t||||�|r�|r�t|||�dS)z�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.
    T)Zsymlinksz*Link is a directory, ignoring download_dirNr)r,r�r�r�r�r�r	r�Zcopytreer�r��check_against_pathr�r�r�rr�)r�r�rr�r�rrr�r=r=rAr0�s,



c
Cs�tjj|�rt|�d}tjg}|jd�|jt|�|jd�|d|g7}tj	d|�t
��t||dd�WdQRXtjj|tj
|�d	�}tj	d
||�t||ddd�dS)z�Copy distribution files in `link_path` to `location`.

    Invoked when user requests to install a local directory. E.g.:

        pip install .
        pip install ~/dev/git-repos/python-prompt-toolkit

    zsetup.pyz-c�sdistz
--dist-dirzRunning setup.py sdist for %sF)�cwdZshow_stdoutNrzUnpacking sdist %s into %s)r�r�)r�r�r�r	rU�
executabler�rr�r�rrrX�listdirr)r�r�Zsetup_pyZ
sdist_argsrr=r=rA�_copy_dist_from_dir�s

r	c@s$eZdZdZddd�Zd	dd�ZdS)
�PipXmlrpcTransportzRProvide a `xmlrpclib.Transport` implementation via a `PipSession`
    object.
    FcCs*tjj||�tj|�}|j|_||_dS)N)r)�	Transportrjrorpr��_scheme�_session)riZ	index_urlr�Zuse_datetimeZindex_partsr=r=rArj�s
zPipXmlrpcTransport.__init__c
Cs�|j||dddf}tj|�}y6ddi}|jj|||dd�}|j�||_|j|j�St	j
k
r�}	ztjd|	j
j|��WYdd}	~	XnXdS)NzContent-Typeztext/xmlT)rQr�r�zHTTP error %s while getting %s)rrortr
Zpostr��verboseZparse_responser�r�	HTTPErrorr��criticalrmr})
rir�ZhandlerZrequest_bodyr�partsrqr�rmr�r=r=rArs


zPipXmlrpcTransport.requestN)F)F)r�r�r�r�rjrr=r=r=rAr
�s
r
cCs^t|�rt||�n:t|�r.t||||d�n |dkr<t�}t|||||d�|rZt|�dS)avUnpack 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.
    )r�N)r1r/r2r0r�r3r)r�r�rZ
only_downloadr�r�r=r=rAr4scCs@|jjdd�d}y |j|ddidd�}|j�Wn8tjk
rj}ztjd|jj	|��WYd	d	}~XnX|j
jd
d�}|j}|j
jd�}	|	r�tj
|	�\}
}|jd
�p�|}t|�d}|s�tj|�}|r�||7}|o�|j|jk�rtjj|j�d}|�r||7}tjj||�}
t|
d��}t||||�Wd	QRX|
|fS)z6Download link url into temp_dir using provided session�#rErzAccept-EncodingZidentityT)r�r�zHTTP error %s while getting %sNzcontent-typerlzcontent-dispositionr��wb)rqr�rur�rrr�rrmr}r�r��cgiZparse_headerrr�Zguess_extensionr�r�rXr�r�)r�r�rr�Z
target_urlr�r�r�r�Zcontent_disposition�typeZparamsr�Z	file_pathr�r=r=rAr�;s<
r�cCsntjj||j�}tjj|�rjtjd|�|rfy|j|�Wn*tk
rdtj	d|�tj
|�dSX|SdS)z� Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    zFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.N)r�r�rXr�r�r�r�rrr�r�)r�rr�Z
download_pathr=r=rAr�vs
r�)NN)NNN)NN)NFNN)vZ
__future__rrZemail.utilsr�rrRr�r�r�rT�rer�rUr�rbr`�ImportErrorZpip._vendor.six.moves.urllibrrorr�r5Zpip.exceptionsrrZ
pip.modelsrZ	pip.utilsrr	r
rrr
rrrrZpip.utils.encodingrZpip.utils.filesystemrZpip.utils.loggingrZpip.utils.setuptools_buildrZpip.utils.glibcrZpip.utils.uirrZ
pip.locationsrZpip.vcsrrZrrZpip._vendor.requests.adaptersrrZpip._vendor.requests.authrr Zpip._vendor.requests.modelsr!r"Zpip._vendor.requests.utilsr#Zpip._vendor.requests.structuresr$r%Zpip._vendor.cachecontrolr&Zpip._vendor.cachecontrol.cachesr'Zpip._vendor.lockfiler(Zpip._vendor.six.movesr)�__all__Z	getLoggerr�r�rerfr�r�r�ZSessionr�r*�compile�Ir�r�r+r,r-r.r/r�r1r2r�r�r�r�r3r0r	rr
r4r�r�r=r=r=rA�<module>s�
0
BR!BH
)
`
&
0$
';

404 Not Found
[ LogOut ]