3 ”ReÈ|ã@sXddlmZmZmZddlZddlZddlZddlZddlm Z m Z ddl m Z ddl mZddlmZmZmZe rÊddlmZmZmZmZmZmZmZmZmZeeefZeeeefZeeege fZ!Gd d „d e"ƒZ#Gd d „d e ej$e%ƒƒZ&Gd d„de&ƒZ'Gdd„de'ƒZ(dd„Z)Gdd„de'ƒZ*ej+dƒZ,dd„Z-dd„Z.Gdd„de&ƒZ/dS)é)Úabsolute_importÚdivisionÚprint_functionNé)Ú string_typesÚwith_metaclass)Ú TYPE_CHECKING)Úcanonicalize_version)ÚVersionÚ LegacyVersionÚparse) ÚListÚDictÚUnionÚIterableÚIteratorÚOptionalÚCallableÚTupleÚ FrozenSetc@seZdZdZdS)ÚInvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú�/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/packaging/specifiers.pyr"src@s€eZdZejdd„ƒZejdd„ƒZejdd„ƒZejdd„ƒZej d d „ƒZ e j d d „ƒZ ejdd d„ƒZ ejddd„ƒZ d S)Ú BaseSpecifiercCsdS)zŽ Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nr)ÚselfrrrÚ__str__)szBaseSpecifier.__str__cCsdS)zF Returns a hash value for this Specifier like object. Nr)rrrrÚ__hash__1szBaseSpecifier.__hash__cCsdS)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr)rÚotherrrrÚ__eq__8szBaseSpecifier.__eq__cCsdS)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nr)rr!rrrÚ__ne__@szBaseSpecifier.__ne__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nr)rrrrÚ prereleasesHszBaseSpecifier.prereleasescCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr)rÚvaluerrrr$PsNcCsdS)zR Determines if the given item is contained within this specifier. Nr)rÚitemr$rrrÚcontainsXszBaseSpecifier.containscCsdS)z• Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. Nr)rÚiterabler$rrrÚfilter_szBaseSpecifier.filter)N)N)rrrÚabcÚabstractmethodrr r"r#Úabstractpropertyr$Úsetterr'r)rrrrr(s rc@s¬eZdZiZd"dd„Zdd„Zdd„Zed d „ƒZd d „Z d d„Z dd„Z dd„Z dd„Z edd„ƒZedd„ƒZedd„ƒZejdd„ƒZdd„Zd#dd„Zd$d d!„ZdS)%Ú_IndividualSpecifierÚNcCsF|jj|ƒ}|stdj|ƒƒ‚|jdƒjƒ|jdƒjƒf|_||_dS)NzInvalid specifier: '{0}'ÚoperatorÚversion)Ú_regexÚsearchrÚformatÚgroupÚstripÚ_specÚ _prereleases)rÚspecr$ÚmatchrrrÚ__init__ls   z_IndividualSpecifier.__init__cCs0|jdk rdj|jƒnd}dj|jjt|ƒ|ƒS)Nz, prereleases={0!r}r/z<{0}({1!r}{2})>)r8r4r$Ú __class__rÚstr)rÚprerrrÚ__repr__zsz_IndividualSpecifier.__repr__cCs dj|jŽS)Nz{0}{1})r4r7)rrrrr„sz_IndividualSpecifier.__str__cCs|jdt|jdƒfS)Nrr)r7r )rrrrÚ_canonical_specˆsz$_IndividualSpecifier._canonical_speccCs t|jƒS)N)Úhashr@)rrrrr �sz_IndividualSpecifier.__hash__c CsPt|tƒr4y|jt|ƒƒ}WqDtk r0tSXnt||jƒsDtS|j|jkS)N)Ú isinstancerr<r=rÚNotImplementedr@)rr!rrrr"‘s  z_IndividualSpecifier.__eq__c CsPt|tƒr4y|jt|ƒƒ}WqDtk r0tSXnt||jƒsDtS|j|jkS)N)rBrr<r=rrCr7)rr!rrrr#�s  z_IndividualSpecifier.__ne__cCst|dj|j|ƒƒ}|S)Nz _compare_{0})Úgetattrr4Ú _operators)rÚopÚoperator_callablerrrÚ _get_operator©sz"_IndividualSpecifier._get_operatorcCst|ttfƒst|ƒ}|S)N)rBr r r )rr1rrrÚ_coerce_version°sz$_IndividualSpecifier._coerce_versioncCs |jdS)Nr)r7)rrrrr0¶sz_IndividualSpecifier.operatorcCs |jdS)Nr)r7)rrrrr1»sz_IndividualSpecifier.versioncCs|jS)N)r8)rrrrr$Àsz _IndividualSpecifier.prereleasescCs ||_dS)N)r8)rr%rrrr$ÅscCs |j|ƒS)N)r')rr&rrrÚ __contains__Êsz!_IndividualSpecifier.__contains__cCs@|dkr|j}|j|ƒ}|jr(| r(dS|j|jƒ}|||jƒS)NF)r$rIÚ is_prereleaserHr0r1)rr&r$Únormalized_itemrGrrrr'Îs   z_IndividualSpecifier.containsccsŒd}g}d|dk r|ndi}xL|D]D}|j|ƒ}|j|f|Žr"|jr\|pL|j r\|j|ƒq"d}|Vq"W| rˆ|rˆx|D] }|VqzWdS)NFr$T)rIr'rKr$Úappend)rr(r$ÚyieldedÚfound_prereleasesÚkwr1Úparsed_versionrrrr)äs       z_IndividualSpecifier.filter)r/N)N)N)rrrrEr;r?rÚpropertyr@r r"r#rHrIr0r1r$r-rJr'r)rrrrr.hs"         r.c@sveZdZdZejdedejejBƒZdddddd d œZ d d „Z d d„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)ÚLegacySpecifieraÛ (?P(==|!=|<=|>=|<|>)) \s* (?P [^,;\s)]* # Since this is a "legacy" specifier, and the version # string can be just about anything, we match everything # except for whitespace, a semi-colon for marker support, # a closing paren since versions can be enclosed in # them, and a comma since it's a version separator. ) z^\s*z\s*$ÚequalÚ not_equalÚless_than_equalÚgreater_than_equalÚ less_thanÚ greater_than)z==z!=z<=z>=ú<ú>cCst|tƒstt|ƒƒ}|S)N)rBr r=)rr1rrrrI s  zLegacySpecifier._coerce_versioncCs||j|ƒkS)N)rI)rÚ prospectiver9rrrÚ_compare_equal&szLegacySpecifier._compare_equalcCs||j|ƒkS)N)rI)rr\r9rrrÚ_compare_not_equal*sz"LegacySpecifier._compare_not_equalcCs||j|ƒkS)N)rI)rr\r9rrrÚ_compare_less_than_equal.sz(LegacySpecifier._compare_less_than_equalcCs||j|ƒkS)N)rI)rr\r9rrrÚ_compare_greater_than_equal2sz+LegacySpecifier._compare_greater_than_equalcCs||j|ƒkS)N)rI)rr\r9rrrÚ_compare_less_than6sz"LegacySpecifier._compare_less_thancCs||j|ƒkS)N)rI)rr\r9rrrÚ_compare_greater_than:sz%LegacySpecifier._compare_greater_thanN)rrrÚ _regex_strÚreÚcompileÚVERBOSEÚ IGNORECASEr2rErIr]r^r_r`rarbrrrrrSs rScstjˆƒ‡fdd„ƒ}|S)Ncst|tƒsdSˆ|||ƒS)NF)rBr )rr\r9)ÚfnrrÚwrappedCs z)_require_version_compare..wrapped)Ú functoolsÚwraps)rhrir)rhrÚ_require_version_compare?srlc @s¸eZdZdZejdedejejBƒZdddddd d d d œZ e d d„ƒZ e dd„ƒZ e dd„ƒZ e dd„ƒZe dd„ƒZe dd„ƒZe dd„ƒZdd„Zedd„ƒZejdd„ƒZd S)!Ú Specifiera (?P(~=|==|!=|<=|>=|<|>|===)) (?P (?: # The identity operators allow for an escape hatch that will # do an exact string match of the version you wish to install. # This will not be parsed by PEP 440 and we cannot determine # any semantic meaning from it. This operator is discouraged # but included entirely as an escape hatch. (?<====) # Only match for the identity operator \s* [^\s]* # We just match everything, except for whitespace # since we are only testing for strict identity. ) | (?: # The (non)equality operators allow for wild card and local # versions to be specified so we have to define these two # operators separately to enable that. (?<===|!=) # Only match for equals and not equals \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? # You cannot use a wild card and a dev or local version # together so group them with a | and make them optional. (?: (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local | \.\* # Wild card syntax of .* )? ) | (?: # The compatible operator requires at least two digits in the # release segment. (?<=~=) # Only match for the compatible operator \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) (?: # pre release [-_\.]? (a|b|c|rc|alpha|beta|pre|preview) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) | (?: # All other operators only allow a sub set of what the # (non)equality operators do. Specifically they do not allow # local versions to be specified nor do they allow the prefix # matching wild cards. (?=rZr[z===cCsNdjttjdd„t|ƒƒƒdd…ƒ}|d7}|jdƒ||ƒoL|jdƒ||ƒS) NÚ.cSs|jdƒ o|jdƒ S)NÚpostÚdev)Ú startswith)ÚxrrrÚÉsz/Specifier._compare_compatible..rz.*z>=z==éÿÿÿÿ)ÚjoinÚlistÚ itertoolsÚ takewhileÚ_version_splitrH)rr\r9ÚprefixrrrÚ_compare_compatible¹s   zSpecifier._compare_compatiblec Csz|jdƒrVt|jƒ}t|dd…ƒ}tt|ƒƒ}|dt|ƒ…}t||ƒ\}}||kSt|ƒ}|jsnt|jƒ}||kSdS)Nz.*ééþÿÿÿ)Úendswithr Úpublicr{r=ÚlenÚ _pad_versionÚlocal) rr\r9Ú split_specÚsplit_prospectiveÚshortened_prospectiveÚ padded_specÚpadded_prospectiveÚ spec_versionrrrr]Ös     zSpecifier._compare_equalcCs|j||ƒ S)N)r])rr\r9rrrr^ÿszSpecifier._compare_not_equalcCst|jƒt|ƒkS)N)r r�)rr\r9rrrr_sz"Specifier._compare_less_than_equalcCst|jƒt|ƒkS)N)r r�)rr\r9rrrr` sz%Specifier._compare_greater_than_equalcCs>t|ƒ}||ksdS|j r:|jr:t|jƒt|jƒkr:dSdS)NFT)r rKÚ base_version)rr\Úspec_strr9rrrraszSpecifier._compare_less_thancCs`t|ƒ}||ksdS|j r:|jr:t|jƒt|jƒkr:dS|jdk r\t|jƒt|jƒkr\dSdS)NFT)r Úis_postreleaser‹r„)rr\rŒr9rrrrb1s zSpecifier._compare_greater_thancCst|ƒjƒt|ƒjƒkS)N)r=Úlower)rr\r9rrrÚ_compare_arbitraryRszSpecifier._compare_arbitrarycCsR|jdk r|jS|j\}}|d krN|dkr@|jdƒr@|dd …}t|ƒjrNdSd S) Nú==ú>=ú<=ú~=ú===z.*r~TF)r�r‘r’r“r”r)r8r7r€r rK)rr0r1rrrr$Vs    zSpecifier.prereleasescCs ||_dS)N)r8)rr%rrrr$psN)rrrrcrdrerfrgr2rErlr}r]r^r_r`rarbr�rRr$r-rrrrrmMs(]  )   ! rmz^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCsDg}x:|jdƒD],}tj|ƒ}|r2|j|jƒƒq|j|ƒqW|S)Nrp)ÚsplitÚ _prefix_regexr3ÚextendÚgroupsrM)r1Úresultr&r:rrrr{ys r{c Csægg}}|jttjdd„|ƒƒƒ|jttjdd„|ƒƒƒ|j|t|dƒd…ƒ|j|t|dƒd…ƒ|jddgtdt|dƒt|dƒƒƒ|jddgtdt|dƒt|dƒƒƒttj|Žƒttj|ŽƒfS)NcSs|jƒS)N)Úisdigit)rtrrrruŠsz_pad_version..cSs|jƒS)N)rš)rtrrrru‹srrÚ0)rMrxryrzr‚ÚinsertÚmaxÚchain)ÚleftÚrightÚ left_splitÚ right_splitrrrrƒ…s ,,rƒc@sŒeZdZddd„Zdd„Zdd„Zd d „Zd d „Zd d„Zdd„Z dd„Z dd„Z e dd„ƒZ e jdd„ƒZ dd„Zddd„Zd dd„ZdS)!Ú SpecifierSetr/Nc Csrdd„|jdƒDƒ}tƒ}xB|D]:}y|jt|ƒƒWq tk rX|jt|ƒƒYq Xq Wt|ƒ|_||_dS)NcSsg|]}|jƒr|jƒ‘qSr)r6)Ú.0Úsrrrú žsz)SpecifierSet.__init__..ú,) r•ÚsetÚaddrmrrSÚ frozensetÚ_specsr8)rÚ specifiersr$Úsplit_specifiersÚparsedÚ specifierrrrr;™s  zSpecifierSet.__init__cCs*|jdk rdj|jƒnd}djt|ƒ|ƒS)Nz, prereleases={0!r}r/z)r8r4r$r=)rr>rrrr?°szSpecifierSet.__repr__cCsdjtdd„|jDƒƒƒS)Nr§css|]}t|ƒVqdS)N)r=)r¤r¥rrrú ¼sz'SpecifierSet.__str__..)rwÚsortedr«)rrrrrºszSpecifierSet.__str__cCs t|jƒS)N)rAr«)rrrrr ¾szSpecifierSet.__hash__cCs˜t|tƒrt|ƒ}nt|tƒs"tStƒ}t|j|jBƒ|_|jdkrX|jdk rX|j|_n<|jdk rv|jdkrv|j|_n|j|jkrŒ|j|_ntdƒ‚|S)NzFCannot combine SpecifierSets with True and False prerelease overrides.)rBrr£rCrªr«r8Ú ValueError)rr!r¯rrrÚ__and__Âs       zSpecifierSet.__and__cCs6t|ttfƒrtt|ƒƒ}nt|tƒs*tS|j|jkS)N)rBrr.r£r=rCr«)rr!rrrr"Ús  zSpecifierSet.__eq__cCs6t|ttfƒrtt|ƒƒ}nt|tƒs*tS|j|jkS)N)rBrr.r£r=rCr«)rr!rrrr#ãs  zSpecifierSet.__ne__cCs t|jƒS)N)r‚r«)rrrrÚ__len__ìszSpecifierSet.__len__cCs t|jƒS)N)Úiterr«)rrrrÚ__iter__ðszSpecifierSet.__iter__cCs.|jdk r|jS|jsdStdd„|jDƒƒS)Ncss|] }|jVqdS)N)r$)r¤r¥rrrr°sz+SpecifierSet.prereleases..)r8r«Úany)rrrrr$ôs  zSpecifierSet.prereleasescCs ||_dS)N)r8)rr%rrrr$scCs |j|ƒS)N)r')rr&rrrrJ szSpecifierSet.__contains__csNtˆttfƒstˆƒ‰ˆdkr$|j‰ˆ r4ˆjr4dSt‡‡fdd„|jDƒƒS)NFc3s|]}|jˆˆd�VqdS))r$N)r')r¤r¥)r&r$rrr°*sz(SpecifierSet.contains..)rBr r r r$rKÚallr«)rr&r$r)r&r$rr's zSpecifierSet.containscCs¼|dkr|j}|jr:x |jD]}|j|t|ƒd�}qW|Sg}g}xZ|D]R}t|ttfƒsdt|ƒ}n|}t|tƒrtqH|jr�| r�|sš|j |ƒqH|j |ƒqHW| r´|r´|dkr´|S|SdS)N)r$) r$r«r)ÚboolrBr r r rKrM)rr(r$r9ÚfilteredrOr&rQrrrr),s*       zSpecifierSet.filter)r/N)N)N)rrrr;r?rr r³r"r#r´r¶rRr$r-rJr'r)rrrrr£˜s      r£)0Ú __future__rrrr*rjryrdÚ_compatrrÚ_typingrÚutilsr r1r r r Útypingr rrrrrrrrZ ParsedVersionr=ZUnparsedVersionr¹ZCallableOperatorr²rÚABCMetaÚobjectrr.rSrlrmrer–r{rƒr£rrrrÚs4  , @ 8+