R`i d Z ddlZddlZddlZddlZddlmZmZm Z ddl mZmZ ddl mZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZmZ ddlmZmZm Z ejB e" Z#d edee$ fdZ%d edede&dee' fdZ(de&de&fdZ)de&de&de&fdZ*d edede&fdZ+dededefdZ, G d d Z- G d d Z.y)z)Download files with progress indicators. N)IterableOptionalTuple)CONTENT_CHUNK_SIZEResponse)get_download_progress_renderer)NetworkConnectionError)PyPI)Link) is_from_cache) PipSession)HEADERSraise_for_statusresponse_chunks)format_sizeredact_auth_from_urlsplitextrespreturnc h t | j d S # t t t f$ r Y y w xY w)Nzcontent-length)intheaders ValueErrorKeyError TypeError)r s /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/network/download.py_get_http_response_sizer s5 4<< 0122), s 11linkprogress_barc t | }|j t j k( r |j }n|j }t | }|rdj |t | }t | rt j d| nt j d| t j t j kD rd}nt | rd}n|sd}n |dkD rd}nd}t | t }|s|S t# || } || S )Nz{} ({})zUsing cached %szDownloading %sFTi@ )bar_typesize)r netlocr file_storage_domainshow_urlurl_without_fragmentr formatr r loggerinfogetEffectiveLevelloggingINFOr r r ) r r r total_lengthurl logged_url show_progresschunksrenderers r _prepare_downloadr3 s +40L{{d...mm''%c*J%%j+l2KL T%z2$j1 !GLL0 t # T#5 6F -|,WHF filenamec @ t j j | S )zJ Sanitize the "filename" value from a Content-Disposition header. )ospathbasename)r5 s r sanitize_content_filenamer: H s 77H%%r4 content_dispositiondefault_filenamec t j j }| |d<