U l aym@sddlmZmZmZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z mZGdddeZGdd d e ejeZGd d d eZGd d d eZddZGdddeZedZddZddZGdddeZdS))absolute_importdivisionprint_functionN) string_typeswith_metaclass)Version LegacyVersionparsec@seZdZdZdS)InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rrkC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-wx4infiz\pkg_resources\_vendor\packaging\specifiers.pyr sr c@seZdZejddZejddZejddZejddZej d d Z e j d d Z ejdd dZ ejdddZ d S) BaseSpecifiercCsdS)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__cCsdS)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nrrotherrrr__eq__$szBaseSpecifier.__eq__cCsdS)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nrrrrr__ne__+szBaseSpecifier.__ne__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nrrrrr prereleases2szBaseSpecifier.prereleasescCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nrrvaluerrrr9sNcCsdS)zR Determines if the given item is contained within this specifier. Nrritemrrrrcontains@szBaseSpecifier.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)riterablerrrrfilterFszBaseSpecifier.filter)N)N)r r rabcabstractmethodrrrrabstractpropertyrsetterr r"rrrrrs        rc@seZdZiZd ddZddZddZd d Zd d Zd dZ ddZ ddZ e ddZ e ddZe ddZejddZddZd!ddZd"ddZdS)#_IndividualSpecifierNcCsF|j|}|std||d|df|_||_dS)NzInvalid specifier: '{0}'operatorversion)_regexsearchr formatgroupstrip_spec _prereleases)rspecrmatchrrr__init__Rs   z_IndividualSpecifier.__init__cCs0|jdk rd|jnd}d|jjt||S)N, prereleases={0!r}r(z<{0}({1!r}{2})>)r1r-r __class__r strrprerrr__repr___sz_IndividualSpecifier.__repr__cCs dj|jS)Nz{0}{1})r-r0rrrrrlsz_IndividualSpecifier.__str__cCs t|jSN)hashr0rrrrrosz_IndividualSpecifier.__hash__cCsPt|tr4z||}WqDtk r0tYSXnt||jsDtS|j|jkSr; isinstancerr6r NotImplementedr0rrrrrrs   z_IndividualSpecifier.__eq__cCsPt|tr4z||}WqDtk r0tYSXnt||jsDtS|j|jkSr;r=rrrrr}s   z_IndividualSpecifier.__ne__cCst|d|j|S)Nz _compare_{0})getattrr- _operators)roprrr _get_operatorsz"_IndividualSpecifier._get_operatorcCst|ttfst|}|Sr;)r>r rr rr*rrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncCs |jdS)Nrr0rrrrr)sz_IndividualSpecifier.operatorcCs |jdS)NrrFrrrrr*sz_IndividualSpecifier.versioncCs|jSr;r1rrrrrsz _IndividualSpecifier.prereleasescCs ||_dSr;rGrrrrrscCs ||Sr;r rrrrr __contains__sz!_IndividualSpecifier.__contains__cCs:|dkr|j}||}|jr&|s&dS||j||jSNF)rrE is_prereleaserCr)r*rrrrr s   z_IndividualSpecifier.containsccsd}g}d|dk r|ndi}|D]B}||}|j|f|r |jrX|sX|jsX||q d}|Vq |s||r||D] }|VqpdS)NFrT)rEr rLrappend)rr!ryieldedfound_prereleaseskwr*parsed_versionrrrr"s"  z_IndividualSpecifier.filter)r(N)N)N)r r rrAr4r:rrrrrCrEpropertyr)r*rr&rJr r"rrrrr'Ns(         r'c@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|tstt|}|Sr;)r>r r7rDrrrrEs  zLegacySpecifier._coerce_versioncCs|||kSr;rEr prospectiver2rrr_compare_equalszLegacySpecifier._compare_equalcCs|||kSr;rbrcrrr_compare_not_equalsz"LegacySpecifier._compare_not_equalcCs|||kSr;rbrcrrr_compare_less_than_equalsz(LegacySpecifier._compare_less_than_equalcCs|||kSr;rbrcrrr_compare_greater_than_equalsz+LegacySpecifier._compare_greater_than_equalcCs|||kSr;rbrcrrr_compare_less_thansz"LegacySpecifier._compare_less_thancCs|||kSr;rbrcrrr_compare_greater_thansz%LegacySpecifier._compare_greater_thanN)r r r _regex_strrecompileVERBOSE IGNORECASEr+rArErerfrgrhrirjrrrrrSs(  rScstfdd}|S)Ncst|tsdS|||SrK)r>rrcfnrrwrapped s z)_require_version_compare..wrapped) functoolswraps)rqrrrrpr_require_version_compare sruc @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. (?s z/Specifier._compare_compatible...*r_r\)joinlist itertools takewhile_version_splitrC)rrdr2prefixrrr_compare_compatibles  zSpecifier._compare_compatiblecCsp|drPt|j}t|dd}tt|}|dt|}t||\}}nt|}|jsht|j}||kS)Nr)endswithrpublicrr7len _pad_versionlocalrcrrrres    zSpecifier._compare_equalcCs||| Sr;)rercrrrrfszSpecifier._compare_not_equalcCs |t|kSr;rrcrrrrgsz"Specifier._compare_less_than_equalcCs |t|kSr;rrcrrrrhsz%Specifier._compare_greater_than_equalcCs<t|}||ksdS|js8|jr8t|jt|jkr8dSdSNFT)rrL base_versionrcrrrris zSpecifier._compare_less_thancCs^t|}||ksdS|js8|jr8t|jt|jkr8dS|jdk rZt|jt|jkrZdSdSr)ris_postreleaserrrcrrrrjs  zSpecifier._compare_greater_thancCst|t|kSr;)r7lowerrcrrr_compare_arbitraryszSpecifier._compare_arbitrarycCsR|jdk r|jS|j\}}|dkrN|dkr@|dr@|dd}t|jrNdSdS)N)r\r_r^ryrzr\rrTF)r1r0rr rL)rr)r*rrrrs    zSpecifier.prereleasescCs ||_dSr;rGrrrrrsN)r r rrkrlrmrnror+rArurrerfrgrhrirjrrRrr&rrrrrvsD_    "      rvz^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCs@g}|dD],}t|}|r0||q||q|S)Nr{)split _prefix_regexr,extendgroupsrM)r*resultrr3rrrr's  rc Csgg}}|ttdd||ttdd|||t|dd||t|dd|ddgtdt|dt|d|ddgtdt|dt|dttj|ttj|fS)NcSs|Sr;isdigitrrrrr6z_pad_version..cSs|Sr;rrrrrr7rrr0)rMrrrrinsertmaxchain)leftright left_split right_splitrrrr2s  ""  rc@seZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ e ddZ e jddZ ddZdddZd ddZdS)! SpecifierSetr(Nc Csndd|dD}t}|D]:}z|t|Wqtk rV|t|YqXqt||_||_dS)NcSsg|]}|r|qSr)r/.0srrr Rsz)SpecifierSet.__init__..,) rsetaddrvr rS frozenset_specsr1)r specifiersrparsed specifierrrrr4Os zSpecifierSet.__init__cCs*|jdk rd|jnd}dt||S)Nr5r(z)r1r-rr7r8rrrr:ds zSpecifierSet.__repr__cCsdtdd|jDS)Nrcss|]}t|VqdSr;)r7rrrr nsz'SpecifierSet.__str__..)rsortedrrrrrrmszSpecifierSet.__str__cCs t|jSr;)r<rrrrrrpszSpecifierSet.__hash__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.)r>rrr?rrr1 ValueError)rrrrrr__and__ss        zSpecifierSet.__and__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkSr;r>rrr'r7r?rrrrrrs    zSpecifierSet.__eq__cCsFt|trt|}n&t|tr,tt|}nt|ts:tS|j|jkSr;rrrrrrs    zSpecifierSet.__ne__cCs t|jSr;)rrrrrr__len__szSpecifierSet.__len__cCs t|jSr;)iterrrrrr__iter__szSpecifierSet.__iter__cCs.|jdk r|jS|jsdStdd|jDS)Ncss|] }|jVqdSr;rrrrrrsz+SpecifierSet.prereleases..)r1ranyrrrrrs  zSpecifierSet.prereleasescCs ||_dSr;rGrrrrrscCs ||Sr;rHrIrrrrJszSpecifierSet.__contains__csLtttfstdkr$|js2jr2dStfdd|jDS)NFc3s|]}|jdVqdS)rNrHrrrrrrsz(SpecifierSet.contains..)r>r rr rrLallrrrrrr s zSpecifierSet.containscCs|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) rrr"boolr>r rr rLrM)rr!rr2filteredrOrrQrrrr"s*      zSpecifierSet.filter)r(N)N)N)r r rr4r:rrrrrrrrRrr&rJr r"rrrrrMs        r) __future__rrrr#rsrrl_compatrrr*rr r rr ABCMetaobjectrr'rSrurvrmrrrrrrrrs&9 4