U ʗReu@sddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZddlmZddlmZmZmZeeefZeeeefZededZeeegefZGdd d eZGd d d ejd Z Gd dde Z!Gddde!Z"edeegefedeegefdddZ#Gddde!Z$e%dZ&ee edddZ'eedddZ(e ee eee ee efdddZ)Gd d!d!e Z*dS)"N) CallableDictIterableIteratorListOptionalPatternSetTupleTypeVarUnion)canonicalize_version) LegacyVersionVersionparseVersionTypeVar)boundc@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.pyr!src@seZdZejedddZejedddZeje e dddZ ej e e dd d Zeje d d d d Zejdee e e dddZejdeee e eedddZd S) BaseSpecifierreturncCsdS)z Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nrselfrrr__str__(szBaseSpecifier.__str__cCsdS)zF Returns a hash value for this Specifier like object. Nrrrrr__hash__/szBaseSpecifier.__hash__otherrcCsdS)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nrrr#rrr__eq__5szBaseSpecifier.__eq__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nrrrrr prereleases<szBaseSpecifier.prereleasesNvaluercCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nrrr(rrrr&Csitemr&rcCsdS)zR Determines if the given item is contained within this specifier. Nrrr+r&rrrcontainsJszBaseSpecifier.containsiterabler&rcCsdS)z Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. Nr)rr/r&rrrfilterPszBaseSpecifier.filter)N)N)rrrabcabstractmethodstrr intr!objectboolr%abstractpropertyrr&setterr-rrr0rrrrr's&r) metaclassc@sReZdZUiZeeefed<eeed<d+eee ddddZ edd d Z edd d Z e eeefdd dZedddZee dddZeedddZeedddZe edddZe edddZe ee dddZeje dd d!dZee d"d#d$Zd,eee e d%d&d'Zd-ee ee ee d(d)d*Z!dS)._IndividualSpecifier _operators_regexNspecr&rcCsH|j|}|s td|d|d|df|_||_dS)NzInvalid specifier: ''operatorversion)r<searchrgroupstrip_spec _prereleases)rr?r&matchrrr__init___s   z_IndividualSpecifier.__init__rcCs8|jdk rd|jnd}d|jjdt||dS)N, prereleases=r=<()>)rGr& __class__rr3rprerrr__repr__ls z_IndividualSpecifier.__repr__cCs dj|jS)Nz{}{})formatrFrrrrr usz_IndividualSpecifier.__str__cCs|jdt|jdfS)Nrr )rFrrrrr_canonical_specxsz$_IndividualSpecifier._canonical_speccCs t|jSN)hashrSrrrrr!|sz_IndividualSpecifier.__hash__r"cCsTt|tr8z|t|}WqHtk r4tYSXnt||jsHtS|j|jkSrT) isinstancer3rNrNotImplementedrSr$rrrr%s   z_IndividualSpecifier.__eq__)oprcCst|d|j|}|S)N _compare_)getattrr;)rrXoperator_callablerrr _get_operators z"_IndividualSpecifier._get_operatorrBrcCst|ttfst|}|SrT)rVrrrrrBrrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncCs |jdS)NrrFrrrrrAsz_IndividualSpecifier.operatorcCs |jdS)Nr r`rrrrrBsz_IndividualSpecifier.versioncCs|jSrTrGrrrrr&sz _IndividualSpecifier.prereleasesr'cCs ||_dSrTrar)rrrr&sr+rcCs ||SrTr-rr+rrr __contains__sz!_IndividualSpecifier.__contains__r*cCs>|dkr|j}||}|jr&|s&dS||j}|||jSNF)r&r_ is_prereleaser\rArB)rr+r&normalized_itemr[rrrr-s   z_IndividualSpecifier.containsr.ccsd}g}d|dk r|ndi}|D]B}||}|j|f|r |jrX|sX|jsX||q d}|Vq |s||r||D] }|VqpdS)NFr&T)r_r-rgr&append)rr/r&yieldedfound_prereleaseskwrBparsed_versionrrrr0s"  z_IndividualSpecifier.filter)r=N)N)N)"rrrr;rr3__annotations__rrr6rIrQr propertyr rSr4r!r5r%CallableOperatorr\UnparsedVersion ParsedVersionr_rArBr&r8rer-rrr0rrrrr:Zs@      r:cseZdZdZededejejBZdddddd d Z d e e e d d fdd Z eedddZee e dddZee e dddZee e dddZee e dddZee e dddZee e dddZZS)!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)==!=<=>=rK>r=Nr>cst||tdtdS)NzZCreating a LegacyVersion has been deprecated and will be removed in the next major release)superrIwarningswarnDeprecationWarning)rr?r&rNrrrIs zLegacySpecifier.__init__r]cCst|tstt|}|SrT)rVrr3r^rrrr_s  zLegacySpecifier._coerce_version prospectiver?rcCs|||kSrTr_rrr?rrr_compare_equal szLegacySpecifier._compare_equalcCs|||kSrTrrrrr_compare_not_equal sz"LegacySpecifier._compare_not_equalcCs|||kSrTrrrrr_compare_less_than_equalsz(LegacySpecifier._compare_less_than_equalcCs|||kSrTrrrrr_compare_greater_than_equalsz+LegacySpecifier._compare_greater_than_equalcCs|||kSrTrrrrr_compare_less_thansz"LegacySpecifier._compare_less_thancCs|||kSrTrrrrr_compare_greater_thansz%LegacySpecifier._compare_greater_than)r=N)rrr _regex_strrecompileVERBOSE IGNORECASEr<r;r3rr6rIrqrr_rrrrrr __classcell__rrrrrss(    rs Specifier)fnrcs&tdtttdfdd }|S)Nr)rrr?rcst|tsdS|||Srf)rVrrrrrwrapped"s z)_require_version_compare..wrapped) functoolswrapsrrr3r6)rrrrr_require_version_comparesrc @seZdZdZededejejBZdddddd d d d Z e e e e d ddZe e e e d ddZe e e e d ddZe e e e d ddZe e e e d ddZe e e e dddZe e e e dddZee e d ddZee dd d!Zeje d"d#d$d!Zd"S)%ra (?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. (?Usz!_is_not_suffix..)devabrcpost)anyrrrrrTs r)leftrightrc Csgg}}|ttdd||ttdd|||t|dd||t|dd|ddgtdt|dt|d|ddgtdt|dt|dttj|ttj|fS)NcSs|SrTisdigitxrrr^z_pad_version..cSs|SrTrrrrrr_rrr 0)rirrrrinsertmaxchain)rr left_split right_splitrrrrZs ,,rc@s eZdZd#eeeddddZedddZedd d Ze dd d Z e defdd ddZ e ed ddZe dddZeedddZeeedddZejeddddZeedddZd$eeeedddZd%eeeeeed d!d"ZdS)& SpecifierSetr=N) specifiersr&rc Csndd|dD}t}|D]:}z|t|Wqtk rV|t|YqXqt||_||_dS)NcSsg|]}|r|qSr)rErsrrr ssz)SpecifierSet.__init__..,) rsetaddrrrs frozenset_specsrG)rrr&split_specifiersparsed specifierrrrrIms zSpecifierSet.__init__rcCs.|jdk rd|jnd}dt||dS)NrJr=z.)rsortedrrrrrr szSpecifierSet.__str__cCs t|jSrT)rUrrrrrr!szSpecifierSet.__hash__r"cCst|trt|}nt|ts"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.)rVr3rrWrrrG ValueError)rr#rrrr__and__s        zSpecifierSet.__and__cCs6t|ttfrtt|}nt|ts*tS|j|jkSrT)rVr3r:rrWrr$rrrr%s  zSpecifierSet.__eq__cCs t|jSrT)rrrrrr__len__szSpecifierSet.__len__cCs t|jSrT)iterrrrrr__iter__szSpecifierSet.__iter__cCs.|jdk r|jS|jsdStdd|jDS)Ncss|] }|jVqdSrTr&rrrrrsz+SpecifierSet.prereleases..)rGrrrrrrr&s  zSpecifierSet.prereleasesr'cCs ||_dSrTrar)rrrr&srbcCs ||SrTrcrdrrrreszSpecifierSet.__contains__r*csLtttfstdkr$|js2jr2dStfdd|jDS)NFc3s|]}|jdVqdS)rNrcrr+r&rrrsz(SpecifierSet.contains..)rVrrrr&rgallrr,rrrr-s zSpecifierSet.containsr.cCs|dkr|j}|jr6|jD]}|j|t|d}q|Sg}g}|D]P}t|ttfs^t|}n|}t|trnqB|jr|s|s| |qB| |qB|s|r|dkr|S|SdS)Nr) r&rr0r6rVrrrrgri)rr/r&r?filteredrkr+rmrrrr0s*      zSpecifierSet.filter)r=N)N)N)rrrr3rr6rIrQr r4r!r rr5r%rrr:rror&r8rqrer-rrr0rrrrrls>   r)+r1rrrrtypingrrrrrrrr r r r utilsrrBrrrrrr3rqrr6rprrABCMetarr:rsrrrrrrrrrrrrs64   3 =   *