o Ecx @sddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZddlmZddlmZmZmZeeefZeeeefZededZeeegefZGdd d eZGd d d ejd Z Gd dde Z!Gddde!Z"dedeegefdedeegeffddZ#Gddde!Z$e%dZ&dede efddZ'dedefddZ(de ede edee ee effd d!Z)Gd"d#d#e Z*dS)$N) CallableDictIterableIteratorListOptionalPatternSetTupleTypeVarUnion)canonicalize_version) LegacyVersionVersionparseVersionTypeVar)Zboundc@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rrS/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/packaging/specifiers.pyr!src @seZdZejdefddZejdefddZejde de fddZ ejde de fd d Z ej dee fd d Zejd e ddfdd Zejddedee de fddZej ddeedee deefddZdS) BaseSpecifierreturncCdS)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__/r zBaseSpecifier.__hash__othercCr)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nrrr"rrr__eq__5r 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 prereleasesCr zBaseSpecifier.prereleasesvalueNcCr)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nrrr'rrrr&Jr itemr&cCr)zR Determines if the given item is contained within this specifier. Nrrr)r&rrrcontainsQr zBaseSpecifier.containsiterablecCr)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&rrrfilterWr zBaseSpecifier.filterN)rrrabcabstractmethodstrrintr!objectboolr$r%abstractpropertyrr&setterr+rrr-rrrrr's0r) metaclassc@s~eZdZUiZeeefed<eeed<d-dedee ddfdd Z defd d Z defd d Z e deeeffddZdefddZdede fddZdede fddZdedefddZdedefddZe defddZe defdd Ze dee fd!d"Zejd#e ddfd$d"Zd%ede fd&d'Z d.d%edee de fd(d)Z d.d*e e!dee de e!fd+d,Z"dS)/_IndividualSpecifier _operators_regexNspecr&rcCsH|j|}|std|d|d|df|_||_dS)NzInvalid specifier: ''operatorversion)r:searchrgroupstrip_spec _prereleases)rr<r&matchrrr__init__fs    z_IndividualSpecifier.__init__cCs0|jdur d|jnd}d|jjt||S)N, prereleases=r;z <{}({!r}{})>)rDr&format __class__rr1rZprerrr__repr__ss z_IndividualSpecifier.__repr__cCs dj|jS)Nz{}{})rHrCrrrrr|s z_IndividualSpecifier.__str__cCs|jdt|jdfS)Nrr )rCrrrrr_canonical_specsz$_IndividualSpecifier._canonical_speccC t|jSr.)hashrLrrrrr! z_IndividualSpecifier.__hash__r"cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr.) isinstancer1rIrNotImplementedrLr#rrrr$    z_IndividualSpecifier.__eq__cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr.)rPr1rIrrQrCr#rrrr%rRz_IndividualSpecifier.__ne__opcCst|d|j|}|S)NZ _compare_)getattrr9)rrSoperator_callablerrr _get_operatorsz"_IndividualSpecifier._get_operatorr?cCst|ttfs t|}|Sr.)rPrrrrr?rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncC |jdS)NrrCrrrrr> z_IndividualSpecifier.operatorcCrY)Nr rZrrrrr?r[z_IndividualSpecifier.versioncCs|jSr.rDrrrrr&sz _IndividualSpecifier.prereleasesr'cC ||_dSr.r\r(rrrr&r[r)cC ||Sr.r+rr)rrr __contains__rOz!_IndividualSpecifier.__contains__cCs>|dur|j}||}|jr|sdS||j}|||jSNF)r&rX is_prereleaserVr>r?)rr)r&Znormalized_itemrUrrrr+s    z_IndividualSpecifier.containsr,ccsd}g}d|dur |ndi}|D]#}||}|j|fi|r4|jr/|s/|js/||qd}|Vq|sA|rC|D] }|Vq;dSdSdS)NFr&T)rXr+rcr&append)rr,r&yieldedfound_prereleaseskwr?parsed_versionrrrr-s*  z_IndividualSpecifier.filterr;Nr.)#rrrr9rr1__annotations__rrr4rFrKrpropertyr rLr2r!r3r$r%CallableOperatorrVUnparsedVersion ParsedVersionrXr>r?r&r6rar+rrr-rrrrr8asL       r8cseZdZdZededejejBZdddddd d Z d"d e de e dd ffdd Z dedefddZded e de fddZded e de fddZded e de fddZded e de fddZded e de fddZded e de fd d!ZZS)#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)==!=<=>=<>r;Nr<r&rcst||tdtdS)NzZCreating a LegacyVersion has been deprecated and will be removed in the next major release)superrFwarningswarnDeprecationWarning)rr<r&rIrrrFs zLegacySpecifier.__init__r?cCst|ts tt|}|Sr.)rPrr1rWrrrrXs  zLegacySpecifier._coerce_version prospectivecCs|||kSr.rXrrr<rrr_compare_equalzLegacySpecifier._compare_equalcCs|||kSr.rrrrr_compare_not_equalrz"LegacySpecifier._compare_not_equalcCs|||kSr.rrrrr_compare_less_than_equal"rz(LegacySpecifier._compare_less_than_equalcCs|||kSr.rrrrr_compare_greater_than_equal%sz+LegacySpecifier._compare_greater_than_equalcCs|||kSr.rrrrr_compare_less_than*rz"LegacySpecifier._compare_less_thancCs|||kSr.rrrrr_compare_greater_than-rz%LegacySpecifier._compare_greater_thanri)rrr _regex_strrecompileVERBOSE IGNORECASEr:r9r1rr4rFrmrrXrrrrrr __classcell__rrrrros0    rofn Specifierrc s,tdddtdtdtffdd }|S)Nrrrr<rcst|tsdS|||Srb)rPrrrrrwrapped4s  z)_require_version_compare..wrapped) functoolswrapsrnr1r4)rrrrr_require_version_compare1s rc @s8eZdZdZededejejBZdddddd d d d Z e d e de de fddZe d e de de fddZe d e de de fddZe d e de de fddZe d e de de fddZe d e de de fddZe d e de de fddZd ede de fdd Zede fd!d"Zejd#e dd$fd%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. (?r?rrrr&:s    zSpecifier.prereleasesr'NcCr]r.r\r(rrrr&Sr[)rrrrrrrrr:r9rrnr1r4rrrrrrrrrrkr&r6rrrrr=sJ] '  z^([0-9]+)((?:a|b|c|rc)[0-9]+)$r?cCs@g}|dD]}t|}|r||q||q|S)Nr)split _prefix_regexr@extendgroupsrd)r?resultr)rErrrr[s  rsegmentcstfdddD S)Nc3s|]}|VqdSr.) startswith).0rrrr gs  z!_is_not_suffix..)devabZrcZpost)anyrrrrrfs  rleftrightc Csgg}}|ttdd||ttdd|||t|dd||t|dd|ddgtdt|dt|d|ddgtdt|dt|dttj|ttj|fS)NcS|Sr.isdigitxrrrpz_pad_version..cSrr.rrrrrrqrrr 0)rdrrrrinsertmaxchain)rrZ left_splitZ right_splitrrrrls ,,rc@s6eZdZ d%dedeeddfddZdefdd Zdefd d Zde fd d Z de defddfddZ de defddZde defddZde fddZdeefddZedeefddZejdeddfddZdedefddZ d&dedeedefd d!Z d&d"eedeedeefd#d$ZdS)' SpecifierSetr;N specifiersr&rc Csjdd|dD}t}|D]}z |t|Wqty*|t|Yqwt||_||_dS)NcSsg|] }|r|qSr)rBrsrrr sz)SpecifierSet.__init__..,) rsetaddrrro frozenset_specsrD)rrr&Zsplit_specifiersparsed specifierrrrrFs   zSpecifierSet.__init__cCs*|jdur d|jnd}dt||S)NrGr;z)rDr&rHr1rJrrrrKs zSpecifierSet.__repr__cCsdtdd|jDS)Nrcss|]}t|VqdSr.)r1rrrrrsz'SpecifierSet.__str__..)rsortedrrrrrrszSpecifierSet.__str__cCrMr.)rNrrrrrr!rOzSpecifierSet.__hash__r"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.)rPr1rrQrrrD ValueError)rr"rrrr__and__s$     zSpecifierSet.__and__cCs6t|ttfrtt|}nt|tstS|j|jkSr.rPr1r8rrQrr#rrrr$   zSpecifierSet.__eq__cCs6t|ttfrtt|}nt|tstS|j|jkSr.rr#rrrr%rzSpecifierSet.__ne__cCrMr.)rrrrrr__len__rOzSpecifierSet.__len__cCrMr.)iterrrrrr__iter__rOzSpecifierSet.__iter__cCs.|jdur|jS|js dStdd|jDS)Ncss|]}|jVqdSr.r&rrrrrsz+SpecifierSet.prereleases..)rDrrrrrrr&s zSpecifierSet.prereleasesr'cCr]r.r\r(rrrr&r[r)cCr^r.r_r`rrrrarOzSpecifierSet.__contains__csLtttfs tdur|jsjrdStfdd|jDS)NFc3s|] }|jdVqdS)rNr_rr)r&rrrsz(SpecifierSet.contains..)rPrrrr&rcallrr*rrrr+s zSpecifierSet.containsr,cCs|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-r4rPrrrrcrd)rr,r&r<Zfilteredrfr)rhrrrr- s,      zSpecifierSet.filterrir.)rrrr1rr4rFrKrr2r!r rr3r$r%rrr8rrkr&r6rmrar+rrr-rrrrr~sL   r)+r/rrrrtypingrrrrrrrr r r r Zutilsrr?rrrrnr1rmrr4rlrrABCMetarr8rorrrrrrrrrrrrs<4   :<    .