{addlZddlZddlZddlZddlmZmZmZmZddl m Z ddl m Z ddl mZmZddlmZejeZee Zee Zee gee fZee gefZGddZd ed efd ZGd d eZGddeZGddeZGddeZ dededededed eeeeeff dZ!dS)N)CallableIterableOptionalTuple)InstallationCandidate)Link) path_to_url url_to_path)is_urlcNeZdZedeefdZdefdZde fdZ dS) LinkSourcereturnct)z,Returns the underlying link, if there's one.NotImplementedErrorselfs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/index/sources.pylinkzLinkSource.links"###ct)z9Candidates found by parsing an archive listing HTML file.rrs rpage_candidateszLinkSource.page_candidates!###rct)z,Links found by specifying archives directly.rrs r file_linkszLinkSource.file_linksrrN) __name__ __module__ __qualname__propertyrrrFoundCandidatesr FoundLinksrrrr r ss $htn$$$X$$$$$$$J$$$$$$rr file_urlrcBtj|dddkS)NF)strictrz text/html) mimetypes guess_type)r#s r _is_html_filer(#s"   7 7 7 :k IIrcfeZdZdZdededdfdZedee fdZ de fdZ de fd ZdS) _FlatDirectorySourcezLink source specified by ``--find-links=``. This looks the content of the directory, and returns: * ``page_candidates``: Links listed on each HTML file in the directory. * ``file_candidates``: Archives in the directory. candidates_from_pagepathrNc||_tjtj||_dSN)_candidates_from_pagepathlibPathosr,realpath_path)rr+r,s r__init__z_FlatDirectorySource.__init__0s1 &:"\"'"2"24"8"899 rcdSr.r"rs rrz_FlatDirectorySource.link8strc#K|jD]V}tt|}t |s.|t |Ed{VWdSr.)r4iterdirr strr(r/rrr,urls rrz$_FlatDirectorySource.page_candidates<sJ&&(( = =Dc$ii((C %% 11$s))<< < < < < < < < <  = =rc#K|jD]?}tt|}t |r.t |V@dSr.)r4r8r r9r(rr:s rrz_FlatDirectorySource.file_linksCsdJ&&((  Dc$ii((CS!! s))OOOO   r)rrr__doc__CandidatesFromPager9r5rrrrr rr!rr"rrr*r*'s:0::  ::::htnX=====Jrr*cfeZdZdZdededdfdZedeefdZ de fdZ de fd Z dS) _LocalFileSourceaC``--find-links=`` or ``--[extra-]index-url=``. If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to the option, it is converted to a URL first. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. r+rrNc"||_||_dSr.r/_linkrr+rs rr5z_LocalFileSource.__init__U &:" rc|jSr.rCrs rrz_LocalFileSource.link] zrc#Kt|jjsdS||jEd{VdSr.)r(rCr;r/rs rrz _LocalFileSource.page_candidatesasMTZ^,,  F--dj99999999999rc#RKt|jjrdS|jVdSr.)r(rCr;rs rrz_LocalFileSource.file_linksfs3  ( (  Fjrrrrr=r>rr5rrrr rr!rr"rrr@r@Ks0  htnX::::: Jrr@cjeZdZdZdedededdfdZede efdZ de fd Z de fd ZdS) _RemoteFileSourcez``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. r+page_validatorrrNc0||_||_||_dSr.)r/_page_validatorrC)rr+rNrs rr5z_RemoteFileSource.__init__us &:"- rc|jSr.rGrs rrz_RemoteFileSource.linkrHrc#K||jsdS||jEd{VdSr.)rPrCr/rs rrz!_RemoteFileSource.page_candidatessQ##DJ//  F--dj99999999999rc#K|jVdSr.rGrs rrz_RemoteFileSource.file_linkssjr)rrrr=r> PageValidatorrr5rrrr rr!rr"rrrMrMls0&   htnX::::: JrrMcfeZdZdZdededdfdZedeefdZ de fdZ de fd Z dS) _IndexDirectorySourcez``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. r+rrNc"||_||_dSr.rBrDs rr5z_IndexDirectorySource.__init__rErc|jSr.rGrs rrz_IndexDirectorySource.linkrHrc#JK||jEd{VdSr.rBrs rrz%_IndexDirectorySource.page_candidatess4--dj99999999999rcdS)Nr"r"rs rrz _IndexDirectorySource.file_linkssrrrKr"rrrVrVs 0  htnX:::::JrrVlocationr+rN expand_dircache_link_parsingcd}d}tj|rt|}|}n8|dr|}t |}nt |r|}|d}t||dS|%t||t||}||fStj |r8|rt||}n t|t||}||fStj|r$t|t||}||fStd||dfS) Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)r])r+rNr)r+r,)r+rz?Location '%s' is ignored: it is neither a file nor a directory.)r2r,existsr startswithr r loggerwarningrMrisdirr*rVisfiler@) r[r+rNr\r]r,r;msgsources r build_sourcergsDC w~~h(##   W % %8$$    { K  sH%%%| |.!5)c.@AAA    V} w}}T  )%9FF +%9#2DEEEFV}   !!5c.@AAA   V} NNI ;r)"loggingr&r2r0typingrrrrpip._internal.models.candidaterpip._internal.models.linkrpip._internal.utils.urlsr r pip._internal.vcsr getLoggerrrar r!r>boolrTr r9r(r*r@rMrVrgr"rrrpsR 666666666666@@@@@@******========$$$$$$  8 $ $01 d^ tfh/D&EEF$&  $ $ $ $ $ $ $ $JCJDJJJJ!!!!!:!!!HzB @J4::-:" :  :  : 8C=(:. ./::::::r