7f" ^dZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZddlmZddlmZddlmZddlmZmZdd lmZdd lmZmZmZm Z dd l!m"Z"m#Z#dd l$m%Z%dd l&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddlm?Z?ddl@mAZAe rddlBmCZCgdZDe5eEZFeedeeGeHffZIeeGeGeGee eGeIfZJ d8de)d eeGeGeGfd!eKd"eKfd#ZLGd$d%ejMZNGd&d'ZOd(e e%d)e e9d*eHd"e e%fd+ZPeGd,d-ZQGd.d/ZRGd0d1ZSGd2d3ZTd4eHd5eHd"eGfd6ZUd4eHd5eHd"e eHfd7ZVdS)9z!Routines related to PyPI, indexesN) dataclass) TYPE_CHECKING FrozenSetIterableListOptionalSetTupleUnion) specifiers)Tag)canonicalize_name)InvalidVersion _BaseVersion)parse)BestVersionAlreadyInstalledDistributionNotFoundInvalidWheelFilenameUnsupportedWheel) LinkCollector parse_links)InstallationCandidate) FormatControl)Link) SearchScope)SelectionPreferences) TargetPython)Wheel)InstallRequirement) getLogger)WHEEL_EXTENSION)Hashes) indent_log) build_netloc)check_requires_python)SUPPORTED_EXTENSIONS) TypeGuard)rBestCandidateResult PackageFinderFlink version_infoignore_requires_pythonreturnc t|j|}|spdtt|}|s$t d||j|dSt d||j|n6#tj $r$t d|j|YnwxYwdS)aa Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. )r,.z4Link requires a different Python (%s not in: %r): %sFzBIgnoring failed Requires-Python check (%s not in: %r) for link: %sz2Ignoring invalid Requires-Python (%r) for link: %sT) r%requires_pythonjoinmapstrloggerverbosedebugr InvalidSpecifier)r+r,r- is_compatibleversions /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/index/package_finder.py_check_link_requires_pythonr<4s-  %    hhs3 5566G) J(  u LLT$    %  &    @        2 4sB 0B>=B>ceZdZejZejZejZejZejZ ejZ ejZ dS)LinkTypeN) __name__ __module__ __qualname__enumauto candidatedifferent_projectyankedformat_unsupportedformat_invalidplatform_mismatchrequires_python_mismatchr*r;r>r>cso I!  TY[[F"TY[[N! (ty{{rKr>ceZdZdZejdZ ddededeede de d e e d dfd Z d e d eeeffd ZdS) LinkEvaluatorzD Responsible for evaluating links for a particular project. z-py([123]\.?[0-9]?)$N project_namecanonical_nameformats target_python allow_yankedr-r.cb|d}||_||_||_||_||_||_dS)a :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. NF) _allow_yanked_canonical_name_ignore_requires_python_formats_target_pythonrN)selfrNrOrPrQrRr-s r;__init__zLinkEvaluator.__init__xsE4 " )%* ")-'=$ +(rKr+cd}|jr!|js|jpd}tjd|fS|jr|j}|j}no|\}}|stjdfS|tvrtjd|fSd|j vr#|tkrd|j }tj|fSd|j vr|d krtjd fS|tkr t|j}n#t $rtjd fcYSwxYwt%|j|jkrd |j d }tj|fS|j}||s;d|}d|d}tj|fS|j}d|j vr#|tkrd|j }tj|fS|st;||j}|sd|j }tj|fS|j|} | rO|d| }| !d} | |jj"krtjdfStG||jj$|j%} | s|d|j&}tj'|fStP)d||tj*|fS)a Determine whether a link is a candidate for installation. :return: A tuple (result, detail), where *result* is an enum representing whether the evaluation found a candidate, or the reason why one is not found. If a candidate is found, *detail* will be the candidate's version string; if one is not found, it contains the reason the link fails to qualify. Nz zyanked for reason: z not a filezunsupported archive format: binaryzNo binaries permitted for macosx10z.zipz macosx10 onezinvalid wheel filenamezwrong project name (not ), znone of the wheel's tags (zB) are compatible (run pip debug --verbose to show compatible tags)sourcezNo sources permitted for zMissing project version for zPython version is incorrect)r,r-z Requires-Python zFound link %s, version: %s)+ is_yankedrT yanked_reasonr>rF egg_fragmentextsplitextrGr&rWr!rNpathrfilenamerrHrnamerUrErXget_unsorted_tags supportedr2get_formatted_file_tagsrIr:_extract_version_from_fragment_py_version_researchstartgroup py_versionr<py_version_inforVr1rJr5r7rD) rYr+r:reasonegg_inforewheelsupported_tags file_tagsmatchrrsupports_pythons r; evaluate_linkzLinkEvaluator.evaluate_linksz > E$"4 E'9>FO%C6%C%CD D  ( ((H(CC MMOOMHc C 3\BB.../8388t},,1G1GId6GII 3V<<TY&&3&== 3^DDo%%!$-00EE+ /0 %UZ00D4HHHL8ILLLF$6??!%!4!F!F!H!H~66@!% %*G*G*I*I J JIMYMMM%6??- 4= ( (SO-C-CD1BDDF/8 8 4$G 5GD4EGGF+V4 4#**733  o o.GQJT0;;;.1 6 ,<#'#?     ?HH$2FHHF5v> > 14AAA"G,,sC--DDN)r?r@rA__doc__recompilernr4rrboolrrZrr r>r{r*rKr;rMrMms RZ 788N26#)#)#)#)3 #) $ #)  #)!)#) #)#)#)#)J\-$\-53+?\-\-\-\-\-\-rKrM candidateshashesrNc |s8tdt||t|Sg}g}d}|D]X}|j}|jsn2||r|dz }n||C||Y|r|}nt|}t|t|krd} n@dt|d d|D} td t|||j |t||z | |S) a Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). zJGiven no hashes to check %s links for project %r: discarding no candidatesr)rrazdiscarding no candidateszdiscarding {} non-matches: {}z c3>K|]}t|jVdSr|)r4r+).0rDs r; z*filter_unallowed_hashes..5s,II IN++IIIIIIrKzPChecked %s links for project %r against %s hashes (%s matches, %s no digest): %s) r5r7lenlistr+has_hashis_hash_allowedappendformatr2 digest_count) rrrNmatches_or_no_digest non_matches match_countrDr+filtereddiscard_messages r;filter_unallowed_hashesrs(    '  OO     JKK / / ~}    ! ! ! 0 0  1 KK   y ) ) ) ##I....$' ## 8}}J''4<CC    KKII[III I I    LL ) J !!K/    OrKc0eZdZUdZdZeed<dZeed<dS)CandidatePreferenceszk Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. F prefer_binaryallow_all_prereleasesN)r?r@rAr}rr__annotations__rr*rKr;rrFs?  M4"'4'''''rKrc~eZdZdZdeedeedeeddfdZdeefdZ deefd Z dS) r(zA collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. rapplicable_candidatesbest_candidater.Nct|t|ksJ||rJn||vsJ||_||_||_dS)a :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. N)set_applicable_candidates _candidatesrrYrrrs r;rZzBestCandidateResult.__init__Xsi())S__<<<<  !, , ,, ,!%:::::&;#%,rKc*t|jS)zIterate through all candidates.)iterrrYs r;iter_allzBestCandidateResult.iter_allpsD$%%%rKc*t|jS)z*Iterate through the applicable candidates.)rrrs r;iter_applicablez#BestCandidateResult.iter_applicabletsD/000rK) r?r@rAr}rrrrZrrrr*rKr;r(r(Qs -./- $$9:-!!67 -  ----0&(#89&&&&1*?!@111111rKr(cJeZdZdZe ddedeedededee j d ee d dfd Z dded e ede j deded ee d dfd Zde ed e efdZded efdZde ed eefdZde ed efdZdS)CandidateEvaluatorzm Responsible for filtering and sorting candidates for installation based on what tags are valid. NFrNrQrr specifierrr.c|t}|tj}|}|||||||S)aCreate a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. N)rNrwrrrr)rr SpecifierSetget_sorted_tags)clsrNrQrrrrrws r;createzCandidateEvaluator.createsc(  (NNM  "/11I&6688s%)'"7     rKrwc||_||_||_||_||_||_dt |D|_dS)z :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). ci|]\}}|| Sr*r*)ridxtags r; z/CandidateEvaluator.__init__..s+' ' ' !cC' ' ' rKN)_allow_all_prereleases_hashes_prefer_binary _project_name _specifier_supported_tags enumerate_wheel_tag_preferences)rYrNrwrrrrs r;rZzCandidateEvaluator.__init__sa'<# +)#-' ' %.~%>%>' ' ' ###rKrc|jpd}|j}d|D}t|d|D|fd|D}t ||j|j}t||jS)zM Return the applicable candidates from a list of candidates. Nc:g|]}|t|jfSr*r4r:rcs r; z@CandidateEvaluator.get_applicable_candidates..s%"K"K"K1As19~~#6"K"K"KrKc3 K|] \}}|V dSr|r*)r_vs r;rz?CandidateEvaluator.get_applicable_candidates..s&77tq!777777rK) prereleasesc"g|] \}}|v | Sr*r*)rrrversionss r;rz@CandidateEvaluator.get_applicable_candidates..s" X X Xtq!!x-----rK)rrrNkey) rrrfilterrrrsorted _sort_key)rYrallow_prereleasesrcandidates_and_versionsrfiltered_applicable_candidatesrs @r;get_applicable_candidatesz,CandidateEvaluator.get_applicable_candidatess!7?4O #L"K "K"K"K   776777-     !Y X X X/F X X X)@,<+* * * & 4$.IIIIrKrDcl|j}t|}d}d}|j}|jrt |j} |||j }n%#t$rt|jdwxYw|j rd}|j Wtj d|j } | Jd| } t| d| df}n| }t||j} dt|jz} | | ||j||fS) a) Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal r*rz@ is not a supported wheel for this platform. It can't be sorted.raNz ^(\d+)(.*)$z!guaranteed by filename validation)rrr+is_wheelrrhfind_most_preferred_tagr ValueErrorrr build_tagr~rygroupsintrrrbr:) rYrD valid_tags support_numrbinary_preferencer+rvprirybuild_tag_groupshas_allowed_hash yank_values r;rzCandidateEvaluator._sort_keysv<) *oo  ~ = !$-((E 11"D$?    &~'''  " &$%!*AA((*M(((#(<<>>  !1!!4557G7JK .Ct33DLAABB#dn---          s A"A=c:|sdSt||j}|S)zy Return the best candidate per the instance's sort order, or None if no candidate is acceptable. Nr)maxr)rYrrs r;sort_best_candidatez&CandidateEvaluator.sort_best_candidate%s+ 4ZT^<<<rKcz||}||}t|||S)zF Compute and return a `BestCandidateResult` instance. )rr)rrr(rs r;compute_best_candidatez)CandidateEvaluator.compute_best_candidate2sL!% > >z J J112GHH" "7)    rK)NFFNN)FFN)r?r@rAr} classmethodr4rrrr BaseSpecifierr"rrr rZrrCandidateSortingKeyrrr(rr*rKr;rrys 15#&+8<#'! ! !  -!  ! $ ! J45 !  !  ! ! ! [! P$&+#'   S  +    $         4!J./!J # $!J!J!J!JFC #8C =PC C C C J ./  ' (     ./        rKrceZdZdZ d/dedededeedee deed dfd Z e d0ded e deed dfd Z ed efd Zed efdZejded dfdZed eefdZed eefdZed eefdZed efdZd1dZed efdZd1dZd eefdZded efdZdee d ee fdZ!de de"ded dfd Z#d!ede d ee$fd"Z%d!edee d ee$fd#Z&d$e d!ed ee$fd%Z'e(j)d&ded ee$fd'Z* d2ded(ee+j,d)ee-d e.fd*Z/e(j)d& d2ded(ee+j,d)ee-d e0fd+Z1d,e2d-ed ee$fd.Z3dS)3r)zThis finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. Nlink_collectorrQrRformat_controlcandidate_prefsr-r.c|t}|p'ttt}||_||_||_||_||_||_t|_ dS)a This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. N) rrrrT_candidate_prefsrV_link_collectorrXr _logged_links)rYrrQrRrrr-s r;rZzPackageFinder.__init__Ksv&  "244O'F=+F+F) /'=$-+,?BeerKselection_prefsc|t}t|j|j}|||||j|j|jS)afCreate a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. N)rr)rrrQrRrr-)rrrrrRrr-)rrrrQrs r;rzPackageFinder.creatersi  (NNM.)7"1"G    s+)'(5*9#2#I     rKc|jSr|)rXrs r;rQzPackageFinder.target_pythons ""rKc|jjSr|r search_scopers r;rzPackageFinder.search_scopes#00rKrc||j_dSr|r)rYrs r;rzPackageFinder.search_scopes,8)))rKc|jjSr|)r find_linksrs r;rzPackageFinder.find_linkss#..rKc|jjSr|)r index_urlsrs r;rzPackageFinder.index_urlss ++rKc#HK|jjjD] }t|VdSr|)rsessionpip_trusted_originsr$)rY host_ports r; trusted_hostszPackageFinder.trusted_hostss<-5I + +I * * * * * + +rKc|jjSr|rrrs r;rz#PackageFinder.allow_all_prereleasess$::rKcd|j_dSNTrrs r;set_allow_all_prereleasesz'PackageFinder.set_allow_all_prereleasess6:333rKc|jjSr|rrrs r;rzPackageFinder.prefer_binarys$22rKcd|j_dSrrrs r;set_prefer_binaryzPackageFinder.set_prefer_binarys.2+++rKcBd|jD}t|S)Nc:h|]\}}}|tjk|Sr*)r>rJ)rrresultdetails r; z@PackageFinder.requires_python_skipped_reasons..s6   !66::: :::rK)rr)rYreasonss r;requires_python_skipped_reasonsz-PackageFinder.requires_python_skipped_reasonss1  %)%7    grKrNct|}|j|}t||||j|j|jS)N)rNrOrPrQrRr-)rrget_allowed_formatsrMrXrTrV)rYrNrOrPs r;make_link_evaluatorz!PackageFinder.make_link_evaluatorsW*<88%99.II%)-+#'#?     rKlinkscgg}}t}|D]M}||vrG|||jr||8||N||zS)z Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates )raddrdr)rYreggsno_eggsseenr+s r; _sort_linkszPackageFinder._sort_linkss| Bg%% ) )D4$)KK%%%%NN4(((~rKr+r r c|||f}||jvr8td|||j|dSdS)NzSkipping link: %s: %s)rr5r7r)rYr+r r entrys r;_log_skipped_linkzPackageFinder._log_skipped_linksZvv& * * * LL0&$ ? ? ?   " "5 ) ) ) ) ) + *rKlink_evaluatorc||\}}|tjkr||||dS t |j||S#t $rYdSwxYw)z If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. N)rir+r:)r{r>rDrrrNr)rYrr+r r s r;get_install_candidatez#PackageFinder.get_install_candidates(55d;; X' ' '  " "4 8 8 84 (#0     44 sA A('A(cg}||D]/}|||}|||0|S)zU Convert links that are candidates to InstallationCandidate objects. )rrr)rYrrrr+rDs r;evaluate_linkszPackageFinder.evaluate_linkss\  $$U++ - -D22>4HHI$!!),,,rK project_urlc*td||j|}|gSt t |}t 5|||}dddn #1swxYwY|S)Nz-Fetching project page and analyzing links: %s)r)r5r7rfetch_responserrr#r!)rYr"rindex_response page_links package_linkss r;process_project_urlz!PackageFinder.process_project_url s  ;    -<<[II  !I+n5566 \\   // 0M                s$BB B )maxsizec||}|j|tj|j|}t jd|D}t|}t jd|D}| |t|d}t tjr|rg}|D]_} | jjsJ || jj1#t($r"|| jjY\wxYwtdd|||zS) aFind all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. )r)rNcandidates_from_pagec3LK|]}|D]}||V dSr|)page_candidatesrsourcesr`s r;rz4PackageFinder.find_all_candidates..2sW; ; !; ; !  " " $ $"!!!! ; ; rKc3LK|]}|D]}||V dSr|) file_linksr.s r;rz4PackageFinder.find_all_candidates..:sW6 6 !6 6 !     "!!!! 6 6 rKT)reversezLocal files found: %sr_)rrcollect_sources functoolspartialr( itertoolschain from_iterablerr!rr5 isEnabledForloggingDEBUGr+urlr file_path Exceptionr7r2) rYrNrcollected_sourcespage_candidates_itr- file_links_itfile_candidatespathsrDs r;find_all_candidatesz!PackageFinder.find_all_candidatess11,?? 0@@%!*!2(-"""A  '_::; ; ,; ; ;    122!556 6 ,6 6 6   --  =$ / / /     w} - - D/ DE, 5 5  ~))))5LL!9:::: 555LL!3444445 LL0$))E2B2B C C C00s D,,)EErrcn|j}t||j|j|j||S)z*Create a CandidateEvaluator object to use.)rNrQrrrr)rrrrXrr)rYrNrrrs r;make_candidate_evaluatorz&PackageFinder.make_candidate_evaluatorSsD/!((%-)7"1"G )   rKc||}||||}||S)aFind matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. )rNrr)rDrFr)rYrNrrrcandidate_evaluators r;find_best_candidatez!PackageFinder.find_best_candidatedsQ--l;; ";;%<   #99*EEErKrequpgradecb|d}||j|j|}|jd|j |jjdttdtfd}KIt d||| td |d ttdd ffd }|sLJ|r"td jntddS|r>tdj||Std||t")zTry to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a InstallationCandidate if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise F)trust_internet)rrN cand_iterr.cldtd|DtpdS)Nr_c6h|]}t|jSr*rrs r;r zKPackageFinder.find_requirement.._format_versions..s ;;;AQY;;;rKrnone)r2r parse_version)rNs r;_format_versionsz8PackageFinder.find_requirement.._format_versionssJ  ;;;;;)  rKzNCould not find a version that satisfies the requirement %s (from versions: %s)z#No matching distribution found for rDz TypeGuard[InstallationCandidate]c*dSdSjkS)NTF)r:)rDrinstalled_versions r;_should_install_candidatezAPackageFinder.find_requirement.._should_install_candidates*!(t%u!),== =rKzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)zLExisting installed version (%s) is most up-to-date and satisfies requirementz)Using version %s (newest of versions: %s)z=Installed version (%s) is most up-to-date (past versions: %s))rrIrirr satisfied_byr:rrr4r5criticalrrrr7rr) rYrJrKrbest_candidate_resultrSrVrrUs @@r;find_requirementzPackageFinder.find_requirement{s/511 $ 8 8 Hm!9! !  /=48   ' # 0 8  1F(G C      $)? OO&  !6!?!?!A!ABB    ''RS'R'RSS S > 56 > / > > > > > > > ,8((88  6%"*  ,% 4 $ $^ 4 4 " LL;&  !6!F!F!H!HII    " !  K   2BBDD E E   *)rK)NNNr|)r.N)NN)4r?r@rAr}rrrrrrrZrrrpropertyrQrrsetterrr4rrrrrrrrrrMrrrr>rrrr!r(r4 lru_cacherDr rr"rrFr(rIrrZr*rKr;r)r)Ds37:>15!D!D%!D$!D !D !/ !D ""67 !D!)!D !D!D!D!DN 15   % .  -      [ >#|###X#1k111X1999999/DI///X/,DI,,,X,+x}+++X+;t;;;X;;;;;3t333X33333c        $DJ *d*H*c*d****+37 ' (* + 4 # $*Y&&&2121=R8S212121'&21n9=#'    J45        "Y&&&9=#' FFFJ45F F  FFF'&F,U*%U*04U* ' (U*U*U*U*U*U*rKr)fragmentrOct|D]+\}}|dkr t|d||kr|cS,t|d|)aFind the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 -Nz does not match )rrr)r^rOirs r;_find_name_version_seprbsp$(##1 88  Xbqb\ * *n < <HHH = BB.BB C CCrKcn t||dz}n#t$rYdSwxYw||d}|sdS|S)zParse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. raN)rbr)r^rO version_startr:s r;rmrms_.xHH1L tt}~~&G t Ns  $$)F)Wr}rBr4r6r:r~ dataclassesrtypingrrrrrr r r pip._vendor.packagingr pip._vendor.packaging.tagsr pip._vendor.packaging.utilsrpip._vendor.packaging.versionrrrrRpip._internal.exceptionsrrrrpip._internal.index.collectorrrpip._internal.models.candidater#pip._internal.models.format_controlrpip._internal.models.linkr!pip._internal.models.search_scoper$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.models.wheelrpip._internal.reqrpip._internal.utils._logr pip._internal.utils.filetypesr!pip._internal.utils.hashesr"pip._internal.utils.loggingr#pip._internal.utils.miscr$pip._internal.utils.packagingr%pip._internal.utils.unpackingr&pip._vendor.typing_extensionsr'__all__r?r5rr4BuildTagrrr<Enumr>rMrrr(rr)rbrmr*rKr;rs''  !!!!!!XXXXXXXXXXXXXXXXXXXX,,,,,,******999999FFFFFFFF@@@@@@ EDDDDDDD@@@@@@======******999999EEEEEE;;;;;;,,,,,,000000......999999------222222111111??????>>>>>>8777777 C C C 8   rE#s(O+ ,Cc<#PQ $),, ,S# &,!, ,,,,^+++++ty+++L-L-L-L-L-L-L-L-^G*+G V GG  GGGGT ((((((( (%1%1%1%1%1%1%1%1PH H H H H H H H VL*L*L*L*L*L*L*L*^ DSD#D#DDDD4S#(SV-rK