8f\ dZddlZddlZddlmZddlmZgdZeje Z Gdde Z Gd d e ZGd d e Zejd ejZdZeZGddeZdZGddeZejddfejddfejddfejddfejddfejddfejddfejd d!fejd"d#fejd$d%ff Zejd&dfejd'dfejd(dfejddfejd)dffZejd*Zd+Zd,Zejd-ejZd.d.d/d.d0ddd1Zd2ZGd3d4eZ Gd5d6eZ!ejd7ejZ"d8Z#d9Z$Gd:d;eZ%Gd<d=eZ&Gd>d?e Z'e'eeee'ee!d@e'e$e&edAZ(e(dBe(dC<dDZ)dS)Ez~ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. N) string_typesparse_requirement)NormalizedVersionNormalizedMatcher LegacyVersion LegacyMatcherSemanticVersionSemanticMatcherUnsupportedVersionError get_schemeceZdZdZdS)r zThis is an unsupported version.N)__name__ __module__ __qualname____doc__{/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/version.pyr r s))Drr cleZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zed ZdS)Versionc|x|_}||x|_}t |t sJt |dksJdS)Nr)strip_stringparse_parts isinstancetuplelen)selfspartss r__init__zVersion.__init__sY7799$ q"jjmm+ e%'''''5zzA~~~~~~rc td)Nzplease implement in a subclassNotImplementedErrorr!r"s rrz Version.parse%s!"BCCCrcpt|t|krtd|d|dSNzcannot compare z and )type TypeErrorr!others r_check_compatiblezVersion._check_compatible(s< ::e $ $)$$$FGG G % $rcL|||j|jkSNr/rr-s r__eq__zVersion.__eq__,s% u%%%{el**rc.|| Sr1r3r-s r__ne__zVersion.__ne__0;;u%%%%rcL|||j|jkSr1r2r-s r__lt__zVersion.__lt__3s% u%%%{U\))rcX||p|| Sr1r9r3r-s r__gt__zVersion.__gt__7s(KK&&<$++e*<*<==rcV||p||Sr1r;r-s r__le__zVersion.__le__:%{{5!!7T[[%7%77rcV||p||Sr1)r<r3r-s r__ge__zVersion.__ge__=r?rc*t|jSr1)hashrr!s r__hash__zVersion.__hash__AsDK   rc0|jjd|jdS)Nz('z') __class__rrrDs r__repr__zVersion.__repr__Ds!^444dlllCCrc|jSr1rrDs r__str__zVersion.__str__G |rc td)NzPlease implement in subclasses.r&rDs r is_prereleasezVersion.is_prereleaseJs!"CDDDrN)rrrr$rr/r3r6r9r<r>rArErIrLpropertyrOrrrrrs DDDHHH+++&&&***>>>888888!!!DDDEEXEEErrc eZdZdZdddddddd d Zd Zd Zd ZedZ dZ dZ dZ dZ dZdZdS)MatcherNc||kSr1rvcps rzMatcher.T QUrc||kSr1rrTs rrXzMatcher.UrYrc||kp||kSr1rrTs rrXzMatcher.Va1foArc||kp||kSr1rrTs rrXzMatcher.Wr\rc||kSr1rrTs rrXzMatcher.X a1frc||kSr1rrTs rrXzMatcher.Ys qAvrc||kp||kSr1rrTs rrXzMatcher.[r\rc||kSr1rrTs rrXzMatcher.\r_r)<><=>======~=!=c t|Sr1rr(s rrzMatcher.parse_requirementas ###rcZ|jtd|x|_}||}|std|z|j|_|j|_g}|jr|jD]\}}| dr8|dvrtd|z|ddd}}||n||d}}| |||ft||_ dS) NzPlease specify a version classz Not valid: %rz.*)rgrjz#'.*' not allowed for %r constraintsTF) version_class ValueErrorrrrnamelowerkey constraintsendswithappendrr)r!r"rclistopvnprefixs rr$zMatcher.__init__dsM   %=>> >7799$ q  " "1 % % 2_q011 1F 9??$$ = / / /A::d## >--(*:<>*?@@@"#3B3B&&r****"&!3!3A!6!6B b"f-....Ell rcXt|tr||}|jD]w\}}}|j|}t|trt ||}|s |d|jj}t|||||sdSxdS)z Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. z not implemented for FT) rrrnr _operatorsgetgetattrrHrr')r!versionoperator constraintrzfmsgs rmatchz Matcher.matchs g| , , 2((11G,0K   (Hj&##H--A!\** %D!$$ /#+88T^-D-DF)#...1Wj&11 uu trcd}t|jdkr(|jdddvr|jdd}|S)Nrr)rgrh)r r)r!results r exact_versionzMatcher.exact_versionsF t{  q T[^A%6-%G%G[^A&F rct|t|ks|j|jkrtd|d|dSr*)r+rpr,r-s rr/zMatcher._check_compatiblesK ::e $ $ UZ(?(?)$$$FGG G)@(?rcl|||j|jko|j|jkSr1)r/rrrr-s rr3zMatcher.__eq__s3 u%%%x59$D )DDrc.|| Sr1r5r-s rr6zMatcher.__ne__r7rcTt|jt|jzSr1)rCrrrrDs rrEzMatcher.__hash__sDH~~T[ 1 111rc0|jjd|jdS)N()rGrDs rrIzMatcher.__repr__s>222DLLLAArc|jSr1rKrDs rrLzMatcher.__str__rMr)rrrrnr|rr$rrPrr/r3r6rErIrLrrrrRrROsM# " " "----$$%%--$$  J$$$###:*X HHHEEE&&&222BBBrrRz^v?(\d+!)?(\d+(\.\d+)*)((a|alpha|b|beta|c|rc|pre|preview)(\d+)?)?(\.(post|r|rev)(\d+)?)?([._-]?(dev)(\d+)?)?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$c|}t|}|std|z|}t d|ddD}t|dkr5|ddkr)|dd}t|dkr |ddk)|dsd}nt|ddd}|dd}|d d }|d d }|d }|dkrd}n0|d |ddf}n|dt|df}|dkrd}n0|d |ddf}n|dt|df}|dkrd}n0|d |ddf}n|dt|df}|d}nhg} |dD]A} | rdt| f} nd| f} | | Bt | }|s |s|rd}nd}|sd}|sd}||||||fS)NzNot a valid version: %sc34K|]}t|VdSr1int.0rUs r z_pep_440_key..s(66AQ666666rr.r )NNr)ar)z)_)final) rPEP440_VERSION_RErr groupsrsplitr risdigitru) r"mrnumsepochprepostdevlocalr#parts r _pep_440_keyrs  A""A E%&?!&CDDD XXZZF 66!5!5666 6 6D d))a--DHMMCRCy d))a--DHMM !9$F1IcrcN## 1+C !A#;D B-C 2JE l q6>a&!)CCa&#c!f++%C | 7?7A:DD7CQLL(D l q6>a&!)CCa&#c!f++%C }KK$$  D||~~ !3t99~4y LL    e    CCC   $T3 --rcHeZdZdZdZegdZedZdS)raIA rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b ct|}t|}|}t d|ddD|_|S)Nc34K|]}t|VdSr1rrs rrz*NormalizedVersion.parse..s($J$JSVV$J$J$J$J$J$Jrrr)_normalized_keyrrrrr_release_clause)r!r"rrrs rrzNormalizedVersion.parsese ##  # #A & &$$J$JVAY__S5I5I$J$J$JJJ r)rbrVrcrcDtfdjDS)Nc3:K|]}||djvVdS)rN) PREREL_TAGS)rtr!s rrz2NormalizedVersion.is_prerelease..!s4FFAF1Q44++FFFFFFr)anyrrDs`rrOzNormalizedVersion.is_prereleases(FFFFT[FFFFFFrN) rrrrrsetrrPrOrrrrrsc"   #22233K GGXGGGrrct|}t|}||krdS||sdSt|}||dkS)NTFr)str startswithr )xyns r _match_prefixr$sV AA AAAvvt <<??u AA Q43;rc ^eZdZeZddddddddd Zd Zd Zd Zd Z dZ dZ dZ dZ dZdS)r_match_compatible _match_lt _match_gt _match_le _match_ge _match_eq_match_arbitrary _match_ne)rircrdrerfrgrhrjc|rd|vo |jd}n|jd o |jd}|r6|jddd}||}||fS)N+rrr)rrrrn)r!rrrz strip_localr"s r _adjust_localzNormalizedMatcher._adjust_local>s  KZ/FGN24FKK )/33Jr8JK  ,%%c1--a0A((++G ""rc||||\}}||krdS|j}dd|D}t|| S)NFrc,g|]}t|Srrris r z/NormalizedMatcher._match_lt..Q7771A777rrrjoinrr!rrrzrelease_clausepfxs rrzNormalizedMatcher._match_ltLi"00*fMM j 5#3hh7777788 #....rc||||\}}||krdS|j}dd|D}t|| S)NFrc,g|]}t|Srrrs rrz/NormalizedMatcher._match_gt..Yrrrrs rrzNormalizedMatcher._match_gtTrrcB||||\}}||kSr1rr!rrrzs rrzNormalizedMatcher._match_le\)"00*fMM*$$rcB||||\}}||kSr1rrs rrzNormalizedMatcher._match_ge`rrcl||||\}}|s||k}nt||}|Sr1rrr!rrrzrs rrzNormalizedMatcher._match_eqdsF"00*fMM 8+FF"7J77F rcBt|t|kSr1rrs rrz"NormalizedMatcher._match_arbitraryls7||s:..rcn||||\}}|s||k}nt|| }|Sr1rrs rrzNormalizedMatcher._match_neosI"00*fMM <+FF&w ;;;F rc||||\}}||krdS||krdS|j}t|dkr |dd}dd|D}t ||S)NTFrrrc,g|]}t|Srrrs rrz7NormalizedMatcher._match_compatible..rr)rrr rrrs rrz#NormalizedMatcher._match_compatiblews"00*fMM j 4 Z  5$3 ~   " "+CRC0Nhh7777788Wc***rN)rrrrrnr|rrrrrrrrrrrrrr/s%M"  !  J # # #//////%%%%%%/// + + + + +rrz[.+-]$z^[.](\d)z0.\1z^[.-]z ^\((.*)\)$\1z^v(ersion)?\s*(\d+)z\2z^r(ev)?\s*(\d+)z[.]{2,}rz\b(alfa|apha)\balphaz\b(pre-alpha|prealpha)\bz pre.alphaz \(beta\)$betaz ^[:~._+-]+z [,*")([\]]z[~:+_ -]z\.$z (\d+(\.\d+)*)c|}tD]\}}|||}|sd}t|}|sd}|}n%|dd}d|D}t|dkr(| dt|dk(t|dkr|| d}nNd d|ddD|| dz}|dd}d d|D}|}|r#tD]\}}|||}|s|}nd |vrd nd }||z|z}t|sd}|S) z Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. z0.0.0rrc,g|]}t|Srrrs rrz-_suggest_semantic_version..s)))Q#a&&)))rNc,g|]}t|Srrrs rrz-_suggest_semantic_version..s:::!s1vv:::rc,g|]}t|Srrrs rrz-_suggest_semantic_version..s222a3q66222rr-r)rrq _REPLACEMENTSsub_NUMERIC_PREFIXrrrr ruendr_SUFFIX_REPLACEMENTS is_semver)r"rpatreplrrzsuffixseps r_suggest_semantic_versionrs WWYY__  F"'' Tv&&  f%%A  A$$S))))&)))&kkAoo MM!   &kkAoo v;;!  AEEGGHH%FFXX::vabbz:::;;fQUUWWXX>NNFBQBZF22622233 +. + +ICWWT6**FF 'f__cc##& V   Mrc t||S#t$rYnwxYw|}dD]\}}|||}t jdd|}t jdd|}t jdd|}t jdd |}t jd d |}|d r |d d}t jdd |}t jdd|}t jdd|}t jdd|}t jdd|}t jdd|}t jdd|}t jdd|}t jdd|}t jdd|}t jdd |} t|n#t$rd}YnwxYw|S)!aSuggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. ))z-alphar)z-betar)rr)rr)rrV)z-finalr)z-prerV)z-releaser)z.releaser)z-stabler)rr)rr) r)z.finalr)rrzpre$pre0zdev$dev0z([abc]|rc)[\-\.](\d+)$z\1\2z[\-\.](dev)[\-\.]?r?(\d+)$z.\1\2z[.~]?([abc])\.?rrUrNz\b0+(\d+)(?!\d)z (\d+[abc])$z\g<1>0z\.?(dev-r|dev\.r)\.?(\d+)$z.dev\2z-(a|b|c)(\d+)$z[\.\-](dev|devel)$z.dev0z(?![\.\-])dev$z(final|stable)$rz\.?(r|-|-r)\.?(\d+)$z.post\2z\.?(dev|git|bzr)\.?(\d+)$z\.?(pre|preview|-c)(\d+)$zc\g<2>zp(\d+)$z.post\1)rr rqreplacererr)r"rsorigrs r_suggest_normalized_versionr s1"  "      B&$$ d ZZd # # " % %B " % %B )7B 7 7B -x < .get_partsMs$$QWWYY// ! !A $$Q**A !!BQB%&&&&3&&&&& AAaA a    h rrrrz*final-00000000)rpoprur)r"rrrWs r _legacy_keyrLs   F Yq\\ <<   8||!y!8!8JJLLL!y!8!8 VBZ:55  VBZ:55 a ==rc*eZdZdZedZdS)r c t|Sr1)rr(s rrzLegacyVersion.parsegs1~~rcd}|jD]6}t|tr|dr |dkrd}n7|S)NFrrT)rrrr)r!rrs rrOzLegacyVersion.is_prereleasejsV  A1l++  S0A0A LL rNrrrrrPrOrrrr r fs>Xrr cbeZdZeZeejZded<ej dZ dZ dS)r rriz^(\d+(\.\d+)*)c4||krdS|jt|}|std||dS|d}d|vr|ddd}t||S)NFzACannot compute compatible match for version %s and constraint %sTrrr) numeric_rerrloggerwarningrrsplitr)r!rrrzrr"s rrzLegacyMatcher._match_compatible}s Z  5 O ! !#j// 2 2  NN018* F F F4 HHJJqM !88a  #AWa(((rN) rrrr rndictrRr|rcompiler!rrrrr r usV!Mg())J*Jt-..J ) ) ) ) )rr zN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$c6t|Sr1) _SEMVER_REr)r"s rrrs   A  rcd}t|}|st||}d|ddD\}}}||dd||dd}}|||f||fS)Nc~||f}n6|ddd}td|D}|S)Nrrcdg|]-}|r|dn|.S)r)rr)rrWs rrz5_semantic_key..make_tuple..s3LLL!))++.make_tuplesL 9YFFabbEKK$$ELLeLLLMMF rc,g|]}t|Srrrs rrz!_semantic_key..s666a3q66666rr|r)rr r) r"r-rrmajorminorpatchrbuilds r _semantic_keyr5s ! A )%a((( XXZZF666"1":666E5%F1Is++ZZq 3-G-GC 5% #u ,,rc*eZdZdZedZdS)r c t|Sr1)r5r(s rrzSemanticVersion.parsesQrc0|jdddkS)Nrrr/)rrDs rrOzSemanticVersion.is_prereleases{1~a C''rNrrrrr r s>   ((X(((rr ceZdZeZdS)r N)rrrr rnrrrr r s#MMMrr c.eZdZddZdZdZdZdZdS) VersionSchemeNc0||_||_||_dSr1)rrmatcher suggester)r!rrr=r>s rr$zVersionScheme.__init__s "rcf |j|d}n#t$rd}YnwxYw|SNTF)r=rnr r!r"rs ris_valid_versionzVersionScheme.is_valid_versionsM  L & &q ) ) )FF&   FFF  s  ..c\ ||d}n#t$rd}YnwxYw|Sr@)r=r rAs ris_valid_matcherzVersionScheme.is_valid_matchersF  LLOOOFF&   FFF  s  ))cp|dr |dd}|d|zS)z: Used for processing some metadata fields ,Nrzdummy_name (%s))rtrDr(s ris_valid_constraint_listz&VersionScheme.is_valid_constraint_lists= ::c?? #2#A$$%6%:;;;rcD|jd}n||}|Sr1)r>rAs rsuggestzVersionScheme.suggests' > !FF^^A&&F rr1)rrrr$rBrDrGrIrrrr;r;sd#### <<<rr;c|Sr1rr(s rrXrXsr) normalizedlegacysemanticrKdefaultcR|tvrtd|zt|S)Nzunknown scheme name: %r)_SCHEMESro)rps rrrs+ 82T9::: D>r)*rloggingrcompatrutilr__all__ getLoggerrr"ror objectrrRr&Irrrrrrrrrrr rrrr r r(rr5r r r;rPrrrrrXs   ###### 4 4 4  8 $ $     j   .E.E.E.E.Ef.E.E.EbaaaaafaaaHBJ FGItMM B.B.B.J!G!G!G!G!G!G!G!GHT+T+T+T+T+T+T+T+pRZ2RZ g&RZ"RZ &RZ&''/RZ"##U+RZ C RZ"##W-RZ+,,RZ v&  RZ r"RZ #RZ S!RZ C RZ "*-..+++\lllf 0"$77    4     G   )))))G)))4RZ:;=4AA ---*(((((g((($$$$$g$$$$$$$$F$$$P -1B ;==mK8I8IJJ m_799   |,r