HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/site-packages/pip/_internal/network/__pycache__/download.cpython-310.pyc
o

��i��	@sjdZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZmZmZddlmZmZm Z e�!e"�Z#d
edee$fdd�Z%d
edede&dee'fdd�Z(de&de&fdd�Z)de&de&de&fdd�Z*d
edede&fdd�Z+dededefdd �Z,Gd!d"�d"�Z-Gd#d$�d$�Z.dS)%z)Download files with progress indicators.
�N)�Iterable�Optional�Tuple)�CONTENT_CHUNK_SIZE�Response)�get_download_progress_renderer)�NetworkConnectionError)�PyPI)�Link)�
is_from_cache)�
PipSession)�HEADERS�raise_for_status�response_chunks)�format_size�redact_auth_from_url�splitext�resp�returnc
Cs,zt|jd�WStttfyYdSw)Nzcontent-length)�int�headers�
ValueError�KeyError�	TypeError)r�r�I/usr/local/lib/python3.10/site-packages/pip/_internal/network/download.py�_get_http_response_sizes
�r�link�progress_barc	Cs�t|�}|jtjkr|j}n|j}t|�}|rd�|t|��}t	|�r*t
�d|�nt
�d|�t
��t
jkr:d}nt	|�rAd}n|sFd}n	|dkrMd}nd}t|t�}|sX|St||d�}||�S)Nz{} ({})zUsing cached %szDownloading %sFTi@�)�bar_type�size)r�netlocr	�file_storage_domain�show_url�url_without_fragmentr�formatrr�logger�info�getEffectiveLevel�logging�INFOrrr)	rrr�total_length�url�
logged_url�
show_progress�chunks�rendererrrr�_prepare_downloads0
r1�filenamecCstj�|�S)zJ
    Sanitize the "filename" value from a Content-Disposition header.
    )�os�path�basename)r2rrr�sanitize_content_filenameHsr6�content_disposition�default_filenamecCs4tj��}||d<|�d�}|rtt|��}|p|S)z�
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    �content-typer2)�email�message�Message�	get_paramr6�str)r7r8�mr2rrr�parse_content_dispositionOs

r@cCs�|j}|j�d�}|rt||�}t|�d}|s(t�|j�dd��}|r(||7}|s?|j|jkr?tj	�|j�d}|r?||7}|S)zoGet an ideal filename from the given HTTP response, falling back to
    the link filename if not provided.
    zcontent-disposition�r9�)
r2r�getr@r�	mimetypes�guess_extensionr,r3r4)rrr2r7�extrrr�_get_http_response_filename^s
rG�sessioncCs.|j�dd�d}|j|tdd�}t|�|S)N�#rArT)r�stream)r,�splitrCr
r)rHr�
target_urlrrrr�_http_get_downloadssrMc@s@eZdZdededdfdd�Zdededeeeffd	d
�ZdS)�
DownloaderrHrrNcC�||_||_dS�N��_session�
_progress_bar��selfrHrrrr�__init__{�
zDownloader.__init__r�locationc
Cs�zt|j|�}Wnty%}z|jdusJ�t�d|jj|��d}~wwt||�}tj	�
||�}t|||j�}t
|d��}|D]}	|�|	�qAWd�n1sSwY|j�dd�}
||
fS)z.Download the file given by link into location.N�HTTP error %s while getting %s�wb�Content-TyperB�rMrRr�responser&�critical�status_coderGr3r4�joinr1rS�open�writerrC)rUrrXr�er2�filepathr/�content_file�chunk�content_typerrr�__call__�s(
���
��zDownloader.__call__)	�__name__�
__module__�__qualname__rr>rVr
rrhrrrrrNzs��
�"rNc@sPeZdZdededdfdd�Zdeededeeeeeefffd	d
�Z	dS)�BatchDownloaderrHrrNcCrOrPrQrTrrrrV�rWzBatchDownloader.__init__�linksrXccs��|D]h}zt|j|�}Wnty*}z|jdusJ�t�d|jj|��d}~wwt||�}tj	�
||�}t|||j�}t
|d��}	|D]}
|	�|
�qFWd�n1sXwY|j�dd�}|||ffVqdS)z0Download the files given by links into location.NrYrZr[rBr\)rUrmrXrrrcr2rdr/rerfrgrrrrh�s2����
	���zBatchDownloader.__call__)
rirjrkrr>rVrr
rrhrrrrrl�s��
����rl)/�__doc__�
email.messager:r)rDr3�typingrrrZpip._vendor.requests.modelsrr�pip._internal.cli.progress_barsr�pip._internal.exceptionsr�pip._internal.models.indexr	�pip._internal.models.linkr
�pip._internal.network.cacher�pip._internal.network.sessionr�pip._internal.network.utilsr
rr�pip._internal.utils.miscrrr�	getLoggerrir&rrr>�bytesr1r6r@rGrMrNrlrrrr�<module>s@
���
�*