File: D:/Python311/Lib/site-packages/pip/_internal/network/__pycache__/download.cpython-311.pyc
�
�mi�1 � � � d Z ddlmZ ddlZddlZddlZddlZddlm Z m
Z
ddlmZ ddl
mZ ddlmZ ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3 ej4 e5� � Z6d/d�Z7d0d�Z8 d1d2d#�Z9d3d&�Z:d4d)�Z;d5d*�Z<e G d+� d,� � � � Z= G d-� d.� � Z>dS )6z(Download files with progress indicators.� )�annotationsN)�Iterable�Mapping)� dataclass)�
HTTPStatus)�BinaryIO)�PreparedRequest)�Response)�HTTPResponse)�HTTPHeaderDict)�ReadTimeoutError)�BarType�get_download_progress_renderer)�IncompleteDownloadError�NetworkConnectionError)�PyPI)�Link)�
SafeFileCache�
is_from_cache)�CacheControlAdapter�
PipSession)�HEADERS�raise_for_status�response_chunks)�format_size�redact_auth_from_url�splitext�respr
�return�
int | Nonec �t � t | j d � � S # t t t f$ r Y d S w xY w)N�content-length)�int�headers�
ValueError�KeyError� TypeError�r s �@D:\Python311\Lib\site-packages\pip/_internal/network/download.py�_get_http_response_sizer* sF � ���4�<� 0�1�2�2�2����)�,� � � ��t�t����s � �7�7�
str | Nonec �h � | j � d| j � d� � � � S )z�
Return either the ETag or Last-Modified header (or None if neither exists).
The return value can be used in an If-Range header.
�etagz
last-modified)r$ �getr( s r) �(_get_http_response_etag_or_last_modifiedr/ '