o _ax @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)boundc@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rrI/usr/lib/python3/dist-packages/setuptools/_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)rrrabcabstractmethodstrr intr"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}{})>)rEr'format __class__rr2rprerrr__repr__ss  z_IndividualSpecifier.__repr__cCs dj|jS)Nz{}{})rIrDrrrrr |s z_IndividualSpecifier.__str__cCs|jdt|jdfS)Nrr )rDrrrrr_canonical_specsz$_IndividualSpecifier._canonical_speccC t|jSr/)hashrNrrrrr" z_IndividualSpecifier.__hash__r#cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr/) isinstancer2rJrNotImplementedrNr$rrrr%    z_IndividualSpecifier.__eq__cCsPt|trz |t|}WntytYSwt||js"tS|j|jkSr/)rRr2rJrrSrDr$rrrr&rTz_IndividualSpecifier.__ne__opcCst|d|j|}|S)N _compare_)getattrr:)rrUoperator_callablerrr _get_operatorsz"_IndividualSpecifier._get_operatorr@cCst|ttfs t|}|Sr/)rRrrrrr@rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncC |jdS)NrrDrrrrr? z_IndividualSpecifier.operatorcCr\)Nr r]rrrrr@r^z_IndividualSpecifier.versioncCs|jSr/rErrrrr'sz _IndividualSpecifier.prereleasesr(cC ||_dSr/r_r)rrrr'r^r*cC ||Sr/r,rr*rrr __contains__rQz!_IndividualSpecifier.__contains__cCs>|dur|j}||}|jr|sdS||j}|||jSNF)r'r[ is_prereleaserYr?r@)rr*r'normalized_itemrXrrrr,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)r[r,rfr'append)rr-r'yieldedfound_prereleaseskwr@parsed_versionrrrr.s*  z_IndividualSpecifier.filterr<Nr/)#rrrr:rr2__annotations__rrr5rGrMr propertyr rNr3r"r4r%r&CallableOperatorrYUnparsedVersion ParsedVersionr[r?r@r'r7rdr,rrr.rrrrr9asL       r9cseZdZdZededejejBZdddddd 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)superrGwarningswarnDeprecationWarning)rr=r'rJrrrGs zLegacySpecifier.__init__r@cCst|ts tt|}|Sr/)rRrr2rZrrrr[s  zLegacySpecifier._coerce_version prospectivecCs|||kSr/r[rrr=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_thanrm)rrr _regex_strrecompileVERBOSE IGNORECASEr;r:r2rr5rGrqrr[rrrrrr __classcell__rrrrrss0    rsfn Specifierrc s,tdddtdtdtffdd }|S)Nrrrr=rcst|tsdS|||Sre)rRrrrrrwrapped4s  z)_require_version_compare..wrapped) functoolswrapsrrr2r5)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. (?gs  z!_is_not_suffix..)devabrcpost)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)rhrrrrinsertmaxchain)rr left_split 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)rCrsrrr sz)SpecifierSet.__init__..,) rsetaddrrrs frozenset_specsrE)rrr'split_specifiersparsed specifierrrrrGs   zSpecifierSet.__init__cCs*|jdur d|jnd}dt||S)NrHr<z)rEr'rIr2rKrrrrMs  zSpecifierSet.__repr__cCsdtdd|jDS)Nrcss|]}t|VqdSr/)r2rrrrrsz'SpecifierSet.__str__..)rsortedrrrrrr szSpecifierSet.__str__cCrOr/)rPrrrrrr"rQzSpecifierSet.__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.)rRr2rrSrrrE ValueError)rr#rrrr__and__s$     zSpecifierSet.__and__cCs6t|ttfrtt|}nt|tstS|j|jkSr/rRr2r9rrSrr$rrrr%   zSpecifierSet.__eq__cCs6t|ttfrtt|}nt|tstS|j|jkSr/rr$rrrr&rzSpecifierSet.__ne__cCrOr/)rrrrrr__len__rQzSpecifierSet.__len__cCrOr/)iterrrrrr__iter__rQzSpecifierSet.__iter__cCs.|jdur|jS|js dStdd|jDS)Ncss|]}|jVqdSr/r'rrrrrsz+SpecifierSet.prereleases..)rErrrrrrr's zSpecifierSet.prereleasesr(cCr`r/r_r)rrrr'r^r*cCrar/rbrcrrrrdrQzSpecifierSet.__contains__csLtttfs tdur|jsjrdStfdd|jDS)NFc3s|] }|jdVqdS)rNrbrr*r'rrrsz(SpecifierSet.contains..)rRrrrr'rfallrr+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.r5rRrrrrfrh)rr-r'r=filteredrjr*rlrrrr. s,      zSpecifierSet.filterrmr/)rrrr2rr5rGrMr r3r"r rr4r%r&rrr9rror'r7rqrdr,rrr.rrrrr~sL   r)+r0rrrrtypingrrrrrrrr r r r utilsrr@rrrrrr2rqrr5rprrABCMetarr9rsrrrrrrrrrrrrs<4   :<    .