o ai @ sj d Z ddlZddlZddlZddlZddlmZmZmZ ddl m Z mZ ddlm Z ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZmZ ddlmZmZmZ e e!Z"d edee# fddZ$d edede%dee& fddZ'de%de%fddZ(de%de%de%fddZ)d edede%fddZ*dededefdd Z+G d!d" d"Z,G d#d$ d$Z-dS )%z)Download files with progress indicators. N)IterableOptionalTuple)CONTENT_CHUNK_SIZEResponse)DownloadProgressProvider)NetworkConnectionError)PyPI)Link) is_from_cache) PipSession)HEADERSraise_for_statusresponse_chunks)format_sizeredact_auth_from_urlsplitextrespreturnc C s, zt | jd W S tttfy Y d S w )Nzcontent-length)intheaders ValueErrorKeyError TypeError)r r /builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/network/download.py_get_http_response_size s r linkprogress_barc C s 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|S t||d|S )Nz{} ({})zUsing cached %szDownloading %sFTi@ )max)r netlocr file_storage_domainshow_urlurl_without_fragmentr formatr r loggerinfogetEffectiveLevelloggingINFOr r r )r r r total_lengthurl logged_url show_progresschunksr r r _prepare_download s. r/ filenamec C s t j| S )zJ Sanitize the "filename" value from a Content-Disposition header. )ospathbasename)r0 r r r sanitize_content_filenameG s r4 content_dispositiondefault_filenamec C s, t | \}}|d}|rt|}|p|S )z Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. r0 )cgiparse_headergetr4 )r5 r6 _typeparamsr0 r r r parse_content_dispositionN s r<