ر4z 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;dIdZ< 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 ed45 G d6 d1 ZH G d7 d8e ZI dPdQd?ZJ dRdSdBZKdTdDZL G dE dFe ZM G dG dH ZNdS )UzO The main purpose of this module is to expose LinkCollector.collect_sources(). )annotationsN)IterableMutableMappingSequence) dataclass) HTMLParser)Values)Callable NamedTupleProtocol)requests)Response) RetryErrorSSLError)NetworkConnectionError)Link)SearchScope) PipSession)raise_for_status)is_archive_fileredact_auth_from_url)vcs )CandidatesFromPage LinkSourcebuild_sourceurlstrreturn 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 schemeslower startswithlen)r schemes o/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/index/collector.py_match_vcs_schemer) . sW + 99;;!!&)) c#f++.>$.F.FMMM4 c e Zd Zd fdZ xZS )_NotAPIContentcontent_typer request_descr Nonec h t || || _ || _ d S N)super__init__r- r. )selfr- r. __class__s r( r3 z_NotAPIContent.__init__: s3 |444((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-TypeUnknown)z text/htmlz#application/vnd.pypi.simple.v1+html#application/vnd.pypi.simple.v1+jsonN)headersgetr$ r% r, requestmethod)r; r- content_type_ls r( _ensure_api_headerrE @ sg #'' BBL!''))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. > httphttpsT)allow_redirectsN)urllibparseurlsplitrG headr rE )r rI r' netlocpathqueryfragmentresps r( _ensure_api_responserW Z sq -3L,A,A#,F,F)FFD% &&&jj<<T<22DTtr* c t t | j rt | | t dt | | | d g d dd }t | t | t dt | |j d d |S )aY Access an Simple API response with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML or Simple API, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotAPIContent` if it is not HTML or a Simple API. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got a Simple API response, and raise `_NotAPIContent` otherwise. rI zGetting page %sz, )r? z*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01z max-age=0)Acceptz Cache-Control)r@ zFetched page %s as %sr= r> )r r filenamerW loggerdebugr rA joinr rE r@ )r rI rV s r( _get_simple_responser_ l s tCyy)** 3S'2222 LL"$8$=$=>>>;;ii ( )+ D4 T t LLS!!33 Kr* r@ ResponseHeadersc | rSd| v rOt j }| d |d<