File: D:/Python311/Lib/site-packages/pip/_internal/index/__pycache__/collector.cpython-311.pyc
�
�mi9? � �� � d Z ddlmZ ddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddl
ZddlmZmZmZ ddlmZ ddlmZ ddlmZ ddlmZmZmZ dd lmZ dd
lmZ ddl m!Z!m"Z" ddl#m$Z$ dd
l%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5m6Z6 e j7 e8� � Z9ee:e:f Z;dId�Z< G d� de=� � Z>dJd �Z? G d!� d"e=� � Z@dKd%�ZAdLd&�ZBdMd)�ZC G d*� d+� � ZD G d,� d-e� � ZEdNd/�ZFeFdOd3�� � ZG ed4�5� � G d6� d1� � � � ZH G d7� d8e� � ZI dPdQd?�ZJ dRdSdB�ZKdTdD�ZL G dE� dFe� � ZM G dG� dH� � ZNdS )UzO
The main purpose of this module is to expose LinkCollector.collect_sources().
� )�annotationsN)�Iterable�MutableMapping�Sequence)� dataclass)�
HTMLParser)�Values)�Callable�
NamedTuple�Protocol)�requests)�Response)�
RetryError�SSLError)�NetworkConnectionError)�Link)�SearchScope)�
PipSession)�raise_for_status)�is_archive_file��redact_auth_from_url)�vcs� )�CandidatesFromPage�
LinkSource�build_source�url�str�return�
str | Nonec � � t j D ]D}| � � � � |� � r| t |� � dv r|c S �EdS )zgLook for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match.
z+:N)r �schemes�lower�
startswith�len)r �schemes �?D:\Python311\Lib\site-packages\pip/_internal/index/collector.py�_match_vcs_schemer) . sY � �
�+� � ���9�9�;�;�!�!�&�)�)� �c�#�f�+�+�.>�$�.F� ��M�M�M���4� c � � � e Zd Zd� fd�Z� xZS )�_NotAPIContent�content_typer �request_descr �Nonec �h �� t � � � ||� � || _ || _ d S �N)�super�__init__r- r. )�selfr- r. � __class__s �r( r3 z_NotAPIContent.__init__: s3 �� �
������|�4�4�4�(���(����r* )r- r r. r r r/ )�__name__�
__module__�__qualname__r3 �
__classcell__�r5 s @r( r, r, 9 s= �� � � � � �)� )� )� )� )� )� )� )� )� )r* r, �responser r/ c �� � | j � dd� � }|� � � }|� d� � rdS t || j j � � �)z�
Check the Content-Type header to ensure the response contains a Simple
API Response.
Raises `_NotAPIContent` if the content type is not a valid content-type.
�Content-Type�Unknown)z text/htmlz#application/vnd.pypi.simple.v1+html�#application/vnd.pypi.simple.v1+jsonN)�headers�getr$ r% r, �request�method)r; r- �content_type_ls r( �_ensure_api_headerrE @ sg � � �#�'�'�� �B�B�L�!�'�'�)�)�N�� � �
�� � � ��
��x�'7�'>�
?�
?�?r* c � � e Zd ZdS )�_NotHTTPN)r6 r7 r8 � r* r( rG rG V s � � � � � ��Dr* rG �sessionr c �� � t j � | � � \ }}}}}|dvrt � � �|� | d�� � }t |� � t
|� � dS )z�
Send a HEAD request to the URL, and ensure the response contains a simple
API Response.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotAPIContent` if the content type is not a valid content type.
> �http�httpsT)�allow_redirectsN)�urllib�parse�urlsplitrG �headr rE )r rI r'