I i!ddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZmZmZddlmZddlmZdd lmZmZdd lmZej4eZeeZeeZe egeefZe ege fZ!Gd d Z"dd Z#GddZ$Gdde"Z%Gdde"Z&Gdde"Z'Gdde"Z( ddZ)y)) annotationsN) defaultdict)Iterable)Callable)InvalidSdistFilenameInvalidWheelFilenamecanonicalize_nameparse_sdist_filenameparse_wheel_filename)InstallationCandidate)Link) path_to_url url_to_path)is_urlc.eZdZeddZddZddZy) LinkSourcect)z,Returns the underlying link, if there's one.NotImplementedErrorselfs a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pip/_internal/index/sources.pylinkzLinkSource.link s "##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)rrNreturnz Link | Noner!FoundCandidatesr! FoundLinks)__name__ __module__ __qualname__propertyrrrrrrrs $$$$rrc<tj|dddk(S)NF)strictrz text/html) mimetypes guess_type)file_urls r _is_html_filer0.s    7 :k IIrcDeZdZdZddZddZed dZed dZy) _FlatDirectoryToUrlsz"Scans directory and caches resultscV||_g|_tt|_d|_y)NF)_path_page_candidatesrlist_project_name_to_urls_scanned_directory)rpaths r__init__z_FlatDirectoryToUrls.__init__5s& +-;Ft;L""'rctj|jD]u}t|j}t |r|j j|? t|jd}|j|j|wd|_y#t$r- t|jd}n#t$rYYwxYwY]wxYw)zrScans directory once and populates both page_candidates and project_name_to_urls at the same time rTN)osscandirr4rr9r0r5appendr namerr rr7r8)rentryurlproject_filenames r_scan_directoryz$_FlatDirectoryToUrls._scan_directory;sZZ + EEejj)CS!%%,,S1 #7 #CA#F   & &'7 8 ? ? D! E"#'( ';EJJ'G'J$+% s6 B  C*CC C CCCCcR|js|j|jSN)r8rCr5rs rrz$_FlatDirectoryToUrls.page_candidatesRs#&&  "$$$rcR|js|j|jSrE)r8rCr7rs rproject_name_to_urlsz)_FlatDirectoryToUrls.project_name_to_urlsYs#&&  ")))rN)r9strr!None)r!rI)r!z list[str])r!zdict[str, list[str]]) r&r'r(__doc__r:rCr)rrGr*rrr2r22s7,( '.%% **rr2cZeZdZUdZiZded< d dZed dZd dZ d dZ y) _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. zdict[str, _FlatDirectoryToUrls]_paths_to_urlsc||_t||_||jvr|j||_yt ||_|j|j|<y)N)r9)_candidates_from_pager _project_namerM _path_to_urlsr2)rcandidates_from_pager9 project_names rr:z_FlatDirectorySource.__init__ls_ &:".|< 4&& &!%!4!4T!:D !54!@D (,(:(:D   %rcyrEr*rs rrz_FlatDirectorySource.link|src#K|jjD]$}|jt|Ed{&y7wrE)rQrrOr rrAs rrz$_FlatDirectorySource.page_candidatess<%%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. c ||_||_yrErO_linkrrRrs rr:z_LocalFileSource.__init__ &:" rc|jSrEr^rs rrz_LocalFileSource.link zzrc#Kt|jjsy|j|jEd{y7wrE)r0r^rArOrs rrz _LocalFileSource.page_candidatess1TZZ^^, --djj999s?A AA c#hKt|jjry|jywrE)r0r^rArs rrz_LocalFileSource.file_linkss#  ( jjs02NrRrXrr r!rIr r"r$ r&r'r(rJr:r)rrrr*rrr[r[sF0  : rr[cJeZdZdZ ddZeddZd dZd dZy) _RemoteFileSourcez``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. c.||_||_||_yrE)rO_page_validatorr^)rrRpage_validatorrs rr:z_RemoteFileSource.__init__s &:"- rc|jSrErbrs rrz_RemoteFileSource.linkrcrc#K|j|jsy|j|jEd{y7wrE)rkr^rOrs rrz!_RemoteFileSource.page_candidatess3##DJJ/ --djj999s;AAAc#(K|jywrErbrs rrz_RemoteFileSource.file_linkssjjsN)rRrXrl PageValidatorrr r!rIr r"r$rgr*rrririsP0&   : rricFeZdZdZ ddZeddZd dZd dZy) _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. c ||_||_yrEr]r_s rr:z_IndexDirectorySource.__init__r`rc|jSrErbrs rrz_IndexDirectorySource.linkrcrc#VK|j|jEd{y7wrEr]rs rrz%_IndexDirectorySource.page_candidatess--djj999s )')cy)Nr*r*rs rrz _IndexDirectorySource.file_linkssrNrfr r"r$rgr*rrrrrrsF 0  :rrrcxd}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)cache_link_parsing)rRrlr)rRr9rS)rRrz?Location '%s' is ignored: it is neither a file nor a directory.)r<r9existsr startswithrrloggerwarningrir isdirrLrrisfiler[) locationrRrl expand_dirrxrSr9rAmsgsources r build_sourcersPDC ww~~h(#   W %8$   { K  sH% |.!5)c.@A  V} ww}}T )%9)FV} +%9#2DEFV}  !!5c.@A V} NNI ;r)r/rHr!bool)rrHrRrXrlrprrrxrrSrHr!z$tuple[str | None, LinkSource | None])* __future__rloggingr-r< collectionsrcollections.abcrtypingrpip._vendor.packaging.utilsrrr r r pip._internal.models.candidater pip._internal.models.linkr pip._internal.utils.urlsrrpip._internal.vcsr getLoggerr&r{r#r%rXrrprr0r2rLr[rirrrr*rrrs" #$A*=$   8 $01 d^ tfh/D&EEF$&  $ $J,*,*^%:%PzB @J4;;-;" ;  ;  ;;*;r