관리-도구
편집 파일: download.cpython-311.pyc
� �܋f� � � � d Z ddlZddlZddlZddlZddlmZmZm Z ddl mZmZ ddl mZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZmZ ddlmZmZm Z ej! 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.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 �t � t | j d � � S # t t t f$ r Y d S w xY w)Nzcontent-length)�int�headers� ValueError�KeyError� TypeError)r s �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_internal/network/download.py�_get_http_response_sizer sF � ���4�<� 0�1�2�2�2����)�,� � � ��t�t����s � �7�7�link�progress_barc �B � t | � � }|j t j k r|j }n|j }t |� � }|r|� dt |� � � d�}t | � � rt � d|� � nt � d|� � t � � � t j k rd}n"t | � � rd}n|sd}n|dk 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 r 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�0�L��{�d�.�.�.��m����'��%�c�*�*�J�� C�"�B�B�k�,�&?�&?�B�B�B� ��T��� 2����%�z�2�2�2�2����$�j�1�1�1� ���!�!�G�L�0�0�� � � �t� � � �� � � � �� � � �� #� #�� � �� � �T�#5� 6� 6�F�� �� �-�|�,�W�W�W�H��8�F���� �filenamec �@ � t j � | � � S )zJ Sanitize the "filename" value from a Content-Disposition header. )�os�path�basename)r5 s r �sanitize_content_filenamer: I s � � �7���H�%�%�%r4 �content_disposition�default_filenamec � � t j � � � }| |d<