o ~Re|@sXddlmZmZmZddlZddlZddlZddlZddlm Z m Z ddl m Z ddl mZddlmZmZmZe reddlmZmZmZmZmZmZmZmZmZeeefZeeeefZeeege fZ!Gd d d e"Z#Gd d d e ej$e%Z&Gd dde&Z'Gddde'Z(ddZ)Gddde'Z*e+dZ,ddZ-ddZ.Gddde&Z/dS))absolute_importdivisionprint_functionN) string_typeswith_metaclass) TYPE_CHECKING)canonicalize_version)Version LegacyVersionparse) ListDictUnionIterableIteratorOptionalCallableTuple FrozenSetc@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-2.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/_vendor/packaging/specifiers.pyr"src@seZdZejddZejddZejddZejddZej d d Z e j d d Z ejdd dZ ejdddZ d S) BaseSpecifiercCdS)z Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nrselfrrr__str__)zBaseSpecifier.__str__cCr)zF Returns a hash value for this Specifier like object. Nrrrrr__hash__1r"zBaseSpecifier.__hash__cCr)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nrr otherrrr__eq__8r"zBaseSpecifier.__eq__cCr)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nrr$rrr__ne__@r"zBaseSpecifier.__ne__cCr)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nrrrrr prereleasesHr"zBaseSpecifier.prereleasescCr)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nrr valuerrrr(Pr"NcCr)zR Determines if the given item is contained within this specifier. Nrr itemr(rrrcontainsXr"zBaseSpecifier.containscCr)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(rrrfilter_r"zBaseSpecifier.filterN)rrrabcabstractmethodr!r#r&r'abstractpropertyr(setterr-r/rrrrr(s"       rc@seZdZiZd"ddZddZddZed d Zd d Z d dZ ddZ ddZ ddZ eddZeddZeddZejddZddZd#ddZd#d d!ZdS)$_IndividualSpecifierNcCsF|j|}|std||d|df|_||_dS)NzInvalid specifier: '{0}'operatorversion)_regexsearchrformatgroupstrip_spec _prereleases)r specr(matchrrr__init__ls    z_IndividualSpecifier.__init__cCs0|jdur d|jnd}d|jjt||S)N, prereleases={0!r}r6z<{0}({1!r}{2})>)r?r;r( __class__rstrr prerrr__repr__zs  z_IndividualSpecifier.__repr__cCs dj|jS)Nz{0}{1})r;r>rrrrr!s z_IndividualSpecifier.__str__cCs|jdt|jdfS)Nrr)r>r rrrr_canonical_specsz$_IndividualSpecifier._canonical_speccC t|jSr0)hashrIrrrrr# z_IndividualSpecifier.__hash__cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr0) isinstancerrDrErNotImplementedrIr$rrrr&    z_IndividualSpecifier.__eq__cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr0)rMrrDrErrNr>r$rrrr'rOz_IndividualSpecifier.__ne__cCst|d|j|}|S)Nz _compare_{0})getattrr; _operators)r opoperator_callablerrr _get_operatorsz"_IndividualSpecifier._get_operatorcCst|ttfs t|}|Sr0)rMr r r r r8rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncC |jdS)Nrr>rrrrr7 z_IndividualSpecifier.operatorcCrW)NrrXrrrrr8rYz_IndividualSpecifier.versioncCs|jSr0r?rrrrr(sz _IndividualSpecifier.prereleasescC ||_dSr0rZr)rrrr(rYcC ||Sr0r-r r,rrr __contains__rLz!_IndividualSpecifier.__contains__cCs>|dur|j}||}|jr|sdS||j}|||jSNF)r(rV is_prereleaserTr7r8)r r,r(normalized_itemrSrrrr-s    z_IndividualSpecifier.containsccsd}g}d|dur |ndi}|D]#}||}|j|fi|r4|jr/|s/|js/||qd}|Vq|sA|rC|D] }|Vq;dSdSdS)NFr(T)rVr-rar(append)r r.r(yieldedfound_prereleaseskwr8parsed_versionrrrr/s*  z_IndividualSpecifier.filterr6Nr0)rrrrQrBrHr!propertyrIr#r&r'rTrVr7r8r(r4r_r-r/rrrrr5hs.          r5c@sveZdZdZededejejBZdddddd d Z d d Z d dZ ddZ ddZ ddZddZddZdS)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. ) ^\s*\s*$equal not_equalless_than_equalgreater_than_equal less_than greater_than)==!=<=>=<>cCst|ts tt|}|Sr0)rMr rErUrrrrV s  zLegacySpecifier._coerce_versioncCs|||kSr0rVr prospectiver@rrr_compare_equal&zLegacySpecifier._compare_equalcCs|||kSr0ryrzrrr_compare_not_equal*r}z"LegacySpecifier._compare_not_equalcCs|||kSr0ryrzrrr_compare_less_than_equal.r}z(LegacySpecifier._compare_less_than_equalcCs|||kSr0ryrzrrr_compare_greater_than_equal2r}z+LegacySpecifier._compare_greater_than_equalcCs|||kSr0ryrzrrr_compare_less_than6r}z"LegacySpecifier._compare_less_thancCs|||kSr0ryrzrrr_compare_greater_than:r}z%LegacySpecifier._compare_greater_thanN)rrr _regex_strrecompileVERBOSE IGNORECASEr9rQrVr|r~rrrrrrrrrjs"   rjcstfdd}|S)Ncst|tsdS|||Sr`)rMr rzfnrrwrappedCs  z)_require_version_compare..wrapped) functoolswraps)rrrrr_require_version_compare?src @seZdZdZededejejBZdddddd d d d Z e d dZ e ddZ e ddZ e ddZe ddZe ddZe ddZddZeddZejddZd 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. (?sz/Specifier._compare_compatible...*rvrs)joinlist itertools takewhile_version_splitrT)r r{r@prefixrrr_compare_compatibles  zSpecifier._compare_compatiblec Csv|dr+t|j}t|dd}tt|}|dt|}t||\}}||kSt|}|js7t|j}||kS)Nr)endswithr publicrrElen _pad_versionlocal) r r{r@ split_specsplit_prospectiveshortened_prospective padded_specpadded_prospective spec_versionrrrr|s    zSpecifier._compare_equalcCs||| Sr0)r|rzrrrr~szSpecifier._compare_not_equalcCst|jt|kSr0r rrzrrrrz"Specifier._compare_less_than_equalcCst|jt|kSr0rrzrrrr rz%Specifier._compare_greater_than_equalcCs<t|}||ks dS|js|jrt|jt|jkrdSdSNFT)r ra base_versionr r{spec_strr@rrrrs zSpecifier._compare_less_thancCs^t|}||ks dS|js|jrt|jt|jkrdS|jdur-t|jt|jkr-dSdSr)r is_postreleaserrrrrrr1s  zSpecifier._compare_greater_thancCst|t|kSr0)rElowerrzrrr_compare_arbitraryRszSpecifier._compare_arbitrarycCsR|jdur|jS|j\}}|dvr'|dkr |dr |dd}t|jr'dSdS)N)rsrvrurrrsrrTF)r?r>rr ra)r r7r8rrrr(Vs    zSpecifier.prereleasescCr[r0rZr)rrrr(prYN)rrrrrrrrr9rQrrr|r~rrrrrrir(r4rrrrrMs>]  (       rz^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCs@g}|dD]}t|}|r||q||q|S)Nr)split _prefix_regexr:extendgroupsrc)r8resultr,rArrrrys  rc Csgg}}|ttdd||ttdd|||t|dd||t|dd|ddgtdt|dt|d|ddgtdt|dt|dttj|ttj|fS)NcS|Sr0isdigitrrrrrz_pad_version..cSrr0rrrrrrrrr0)rcrrrrinsertmaxchain)leftright left_split right_splitrrrrs ,,rc@seZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ e ddZ e jddZ ddZdddZ dddZdS) SpecifierSetr6Nc Csjdd|dD}t}|D]}z |t|Wqty*|t|Yqwt||_||_dS)NcSsg|] }|r|qSr)r=.0srrr sz)SpecifierSet.__init__..,) rsetaddrrrj frozenset_specsr?)r specifiersr(split_specifiersparsed specifierrrrrBs   zSpecifierSet.__init__cCs*|jdur d|jnd}dt||S)NrCr6z)r?r;r(rErFrrrrHs  zSpecifierSet.__repr__cCsdtdd|jDS)Nrcss|]}t|VqdSr0)rErrrr sz'SpecifierSet.__str__..)rsortedrrrrrr!szSpecifierSet.__str__cCrJr0)rKrrrrrr#rLzSpecifierSet.__hash__cCst|tr t|}nt|tstSt}t|j|jB|_|jdur-|jdur-|j|_|S|jdur=|jdur=|j|_|S|j|jkrI|j|_|Std)NzFCannot combine SpecifierSets with True and False prerelease overrides.)rMrrrNrrr? ValueError)r r%rrrr__and__s$     zSpecifierSet.__and__cCs6t|ttfrtt|}nt|tstS|j|jkSr0rMrr5rrErNrr$rrrr&   zSpecifierSet.__eq__cCs6t|ttfrtt|}nt|tstS|j|jkSr0rr$rrrr'rzSpecifierSet.__ne__cCrJr0)rrrrrr__len__rLzSpecifierSet.__len__cCrJr0)iterrrrrr__iter__rLzSpecifierSet.__iter__cCs.|jdur|jS|js dStdd|jDS)Ncss|]}|jVqdSr0r(rrrrrsz+SpecifierSet.prereleases..)r?ranyrrrrr(s zSpecifierSet.prereleasescCr[r0rZr)rrrr(rYcCr\r0r]r^rrrr_ rLzSpecifierSet.__contains__csLtttfs tdur|jsjrdStfdd|jDS)NFc3s|] }|jdVqdS)rNr]rr,r(rrr*sz(SpecifierSet.contains..)rMr r r r(raallrr+rrrr-s zSpecifierSet.containscCs|dur|j}|jr|jD] }|j|t|d}q |Sg}g}|D](}t|ttfs/t|}n|}t|tr7q!|jrD|sD|sC| |q!| |q!|sT|rT|durT|S|S)Nr) r(rr/boolrMr r r rarc)r r.r(r@filteredrer,rgrrrr/,s,       zSpecifierSet.filterrhr0)rrrrBrHr!r#rr&r'rrrir(r4r_r-r/rrrrrs$       r)0 __future__rrrr1rrrZ_compatrrZ_typingrutilsr r8r r r typingr rrrrrrrr ParsedVersionrEUnparsedVersionrCallableOperatorrrABCMetaobjectrr5rjrrrrrrrrrrrs6  , @ 8 +