7i!ddlZddlZddlZddlmZddlmZmZmZm Z m Z m Z ddl m Z mZmZmZmZmZddlmZddlmZddlmZmZddlmZej8eZeeZeeZ eegeefZ!eege"fZ#Gd d Z$d e%d e"fd Z&GddZ'Gdde$Z(Gdde$Z)Gdde$Z*Gdde$Z+de%de!de#de"de"de%d e e e%e e$ffdZ,y)N) defaultdict)CallableDictIterableListOptionalTuple)InvalidSdistFilenameInvalidVersionInvalidWheelFilenamecanonicalize_nameparse_sdist_filenameparse_wheel_filename)InstallationCandidate)Link) path_to_url url_to_path)is_urlc@eZdZedeefdZdefdZde fdZ y) LinkSourcereturnct)z,Returns the underlying link, if there's one.NotImplementedErrorselfs d/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/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_links'r"rN) __name__ __module__ __qualname__propertyrrrFoundCandidatesr! FoundLinksr$rrrrs7 $htn$$$$$J$rrfile_urlrc<tj|dddk(S)NF)strictrz text/html) mimetypes guess_type)r,s r _is_html_filer1,s    7 :k IIrcjeZdZdZdeddfdZd dZedeefdZ ede eeeffdZ y) _FlatDirectoryToUrlsz"Scans directory and caches resultspathrNcV||_g|_tt|_d|_y)NF)_path_page_candidatesrlist_project_name_to_urls_scanned_directory)rr4s r__init__z_FlatDirectoryToUrls.__init__3s& +-;Ft;L""'rctj|jD]u}t|j}t |r|j j|? t|jd}|j|j|wd|_y#ttf$r3 t|jd}n#ttf$rYYwxYwYiwxYw)zrScans directory once and populates both page_candidates and project_name_to_urls at the same time rTN)osscandirr6rr4r1r7appendrnamer r rr r9r:)rentryurlproject_filenames r_scan_directoryz$_FlatDirectoryToUrls._scan_directory9sZZ + EEejj)CS!%%,,S1 #7 #CA#F   & &'7 8 ? ? D! E"#').9 ';EJJ'G'J$,n=% s6 B  C"0C C" CC"CC"!C"cR|js|j|jSN)r:rDr7rs rr!z$_FlatDirectoryToUrls.page_candidatesPs#&&  "$$$rcR|js|j|jSrF)r:rDr9rs rproject_name_to_urlsz)_FlatDirectoryToUrls.project_name_to_urlsWs#&&  ")))r)rN) r%r&r'__doc__strr;rDr(rr!rrHr+rrr3r30sd,(S(T( '.%c%% *d3S >&:**rr3cveZdZUdZiZeeefed<de dededdfdZ e de e fd Zdefd Zdefd Zy) _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. _paths_to_urlscandidates_from_pager4 project_namerNc||_t||_||jvr|j||_yt ||_|j|j|<y)N)r4)_candidates_from_pager _project_namerM _path_to_urlsr3)rrNr4rOs rr;z_FlatDirectorySource.__init__js_ &:".|< 4&& &!%!4!4T!:D !54!@D (,(:(:D   %rcyrFr+rs rrz_FlatDirectorySource.linkzsrc#K|jjD]$}|jt|Ed{&y7wrF)rSr!rQrrrBs rr!z$_FlatDirectorySource.page_candidates~s<%%55 =C11$s)< < < = `` 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. rNrrNc ||_||_yrFrQ_linkrrNrs rr;z_LocalFileSource.__init__ &:" rc|jSrFr^rs rrz_LocalFileSource.link zzrc#Kt|jjsy|j|jEd{y7wrF)r1r^rBrQrs rr!z _LocalFileSource.page_candidatess1TZZ^^, --djj999s?A AA c#hKt|jjry|jywrF)r1r^rBrs rr$z_LocalFileSource.file_linkss#  ( jjs02r%r&r'rIrYrr;r(rrr)r!r*r$r+rrr[r[s_0  htn:: Jrr[c\eZdZdZdedededdfdZede efdZ de fd Z de fd Zy) _RemoteFileSourcez``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. rNpage_validatorrrNc.||_||_||_yrF)rQ_page_validatorr^)rrNrirs rr;z_RemoteFileSource.__init__s &:"- rc|jSrFrbrs rrz_RemoteFileSource.linkrcrc#K|j|jsy|j|jEd{y7wrF)rkr^rQrs rr!z!_RemoteFileSource.page_candidatess3##DJJ/ --djj999s;AAAc#(K|jywrFrbrs rr$z_RemoteFileSource.file_linkssjjs)r%r&r'rIrY PageValidatorrr;r(rrr)r!r*r$r+rrrhrhsi0&   htn:: JrrhcXeZdZdZdededdfdZedeefdZ de fdZ de fd Z y) _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. rNrrNc ||_||_yrFr]r_s rr;z_IndexDirectorySource.__init__r`rc|jSrFrbrs rrz_IndexDirectorySource.linkrcrc#VK|j|jEd{y7wrFr]rs rr!z%_IndexDirectorySource.page_candidatess--djj999s )')cy)Nr+r+rs rr$z _IndexDirectorySource.file_linkssrrfr+rrrqrqs_ 0  htn::JrrqlocationrNri expand_dircache_link_parsingrOcxd}d}tjj|rt|}|}n,|j dr|}t |}n t |r|}|d}tj||y|t||t||} || fStjj|r0|rt|||} || fSt|t||} || fStjj|rt|t||} || fStjd||dfS) Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)rx)rNrir)rNr4rO)rNrz?Location '%s' is ignored: it is neither a file nor a directory.)r=r4existsr startswithrrloggerwarningrhrisdirrLrqisfiler[) rvrNrirwrxrOr4rBmsgsources r build_sourcersPDC ww~~h(#   W %8$   { K  sH% |.!5)c.@A  V} ww}}T )%9)FV} +%9#2DEFV}  !!5c.@A V} NNI ;r)-loggingr/r= collectionsrtypingrrrrrr pip._vendor.packaging.utilsr r r r rrpip._internal.models.candidaterpip._internal.models.linkrpip._internal.utils.urlsrrpip._internal.vcsr getLoggerr%r|r)r*rYboolrorrJr1r3rLr[rhrqrr+rrrs8 #BBA*=$   8 $01 d^ tfh/D&EEF$&  $ $JCJDJ,*,*^%:%PzB @J4;;-;" ;  ;  ;; 8C=(:. ./;r