관리-도구
편집 파일: download.cpython-312.pyc
� G��e� � � � d Z ddlZddlZddlZddlZddlmZmZm Z ddl mZmZ ddl mZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZmZ ddlmZmZm Z ejB e"� Z#d edee$ fd�Z%d edede&dee' fd�Z(de&de&fd�Z)de&de&de&fd�Z*d edede&fd�Z+dededefd�Z, G d� d� Z- G d� d� Z.y)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 �h � t | j d � S # t t t f$ r Y y w xY w)Nzcontent-length)�int�headers� ValueError�KeyError� TypeError)r s ��/builddir/build/BUILDROOT/alt-python312-pip-23.3.1-1.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/network/download.py�_get_http_response_sizer s5 � ���4�<�<� 0�1�2�2����)�,� ���s � �1�1�link�progress_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_type�size)r �netlocr �file_storage_domain�show_url�url_without_fragmentr �formatr r �logger�info�getEffectiveLevel�logging�INFOr r r ) r r r �total_length�url� logged_url� show_progress�chunks�renderers r �_prepare_downloadr3 s� � � +�4�0�L��{�{�d�.�.�.��m�m���'�'��%�c�*�J���%�%�j�+�l�2K�L� ��T�����%�z�2����$�j�1� ���!�G�L�L�0�� � �t� �� � �� � �� #�� �� � �T�#5� 6�F��� �-�|�,�W�H��F��� �filenamec �@ � t j j | � S )zJ Sanitize the "filename" value from a Content-Disposition header. )�os�path�basename)r5 s r �sanitize_content_filenamer: H s � � �7�7���H�%�%r4 �content_disposition�default_filenamec � � t j j � }| |d<