a  zex@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__rrb/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_vendor/packaging/specifiers.pyr!src@seZdZejedddZejedddZeje e dddZ eje e dd d Z ej ee dd d Zeje d ddd Zejdeee e dddZejdeeee 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)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nrr$rrr__ne__<szBaseSpecifier.__ne__cCsdS)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nrrrrr prereleasesCszBaseSpecifier.prereleasesNvaluercCsdS)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nrrr)rrrr'Jsitemr'rcCsdS)zR Determines if the given item is contained within this specifier. Nrrr,r'rrrcontainsQszBaseSpecifier.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)rr0r'rrrfilterWszBaseSpecifier.filter)N)N)rrrabcabstractmethodstrr intr!objectboolr%r&abstractpropertyrr'setterr.rrr1rrrrr's( r) metaclassc@sbeZdZUiZeeefed<eeed<d-eee ddddZ edd d Z edd d Z e eeefdd dZedddZee dddZee dddZeedddZeedddZe edddZe edddZe ee dd d!Zeje dd"d#d!Zee d$d%d&Zd.eee e d'd(d)Zd/e e!ee e e!d*d+d,Z"dS)0_IndividualSpecifier _operators_regexNspecr'rcCsH|j|}|s td|d|d|df|_||_dS)NzInvalid specifier: ''operatorversion)r=searchrgroupstrip_spec _prereleases)rr@r'matchrrr__init__fs   z_IndividualSpecifier.__init__rcCs0|jdurd|jnd}d|jjt||S)N, prereleases=r>z <{}({!r}{})>)rHr'format __class__rr4rprerrr__repr__ss z_IndividualSpecifier.__repr__cCs dj|jS)Nz{}{})rLrGrrrrr |sz_IndividualSpecifier.__str__cCs|jdt|jdfS)Nrr )rGrrrrr_canonical_specsz$_IndividualSpecifier._canonical_speccCs t|jSN)hashrQrrrrr!sz_IndividualSpecifier.__hash__r"cCsRt|tr6z|t|}WqFty2tYS0nt||jsFtS|j|jkSrR) isinstancer4rMrNotImplementedrQr$rrrr%s    z_IndividualSpecifier.__eq__cCsRt|tr6z|t|}WqFty2tYS0nt||jsFtS|j|jkSrR)rTr4rMrrUrGr$rrrr&s    z_IndividualSpecifier.__ne__)oprcCst|d|j|}|S)N _compare_)getattrr<)rrVoperator_callablerrr _get_operatorsz"_IndividualSpecifier._get_operatorrCrcCst|ttfst|}|SrR)rTrrrrrCrrr_coerce_versionsz$_IndividualSpecifier._coerce_versioncCs |jdS)NrrGrrrrrBsz_IndividualSpecifier.operatorcCs |jdS)Nr r^rrrrrCsz_IndividualSpecifier.versioncCs|jSrRrHrrrrr'sz _IndividualSpecifier.prereleasesr(cCs ||_dSrRr_r*rrrr'sr,rcCs ||SrRr.rr,rrr __contains__sz!_IndividualSpecifier.__contains__r+cCs>|dur|j}||}|jr&|s&dS||j}|||jSNF)r'r] is_prereleaserZrBrC)rr,r'normalized_itemrYrrrr.s   z_IndividualSpecifier.containsr/ccsd}g}d|dur|ndi}|D]F}||}|j|fi|r |jr\|s\|js\||q d}|Vq |s|r|D] }|VqtdS)NFr'T)r]r.rer'append)rr0r'yieldedfound_prereleaseskwrCparsed_versionrrrr1s"  z_IndividualSpecifier.filter)r>N)N)N)#rrrr<rr4__annotations__rrr7rJrPr propertyr rQr5r!r6r%r&CallableOperatorrZUnparsedVersion ParsedVersionr]rBrCr'r9rcr.rrr1rrrrr;as>        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)==!=<=>=<>r>Nr?cst||tdtdS)NzZCreating a LegacyVersion has been deprecated and will be removed in the next major release)superrJwarningswarnDeprecationWarning)rr@r'rMrrrJs zLegacySpecifier.__init__r[cCst|tstt|}|SrR)rTrr4r\rrrr]s  zLegacySpecifier._coerce_version prospectiver@rcCs|||kSrRr]rrr@rrr_compare_equalszLegacySpecifier._compare_equalcCs|||kSrRrrrrr_compare_not_equalsz"LegacySpecifier._compare_not_equalcCs|||kSrRrrrrr_compare_less_than_equal"sz(LegacySpecifier._compare_less_than_equalcCs|||kSrRrrrrr_compare_greater_than_equal%sz+LegacySpecifier._compare_greater_than_equalcCs|||kSrRrrrrr_compare_less_than*sz"LegacySpecifier._compare_less_thancCs|||kSrRrrrrr_compare_greater_than-sz%LegacySpecifier._compare_greater_than)r>N)rrr _regex_strrecompileVERBOSE IGNORECASEr=r<r4rr7rJrorr]rrrrrr __classcell__rrrrrqs&    rq Specifier)fnrcs&tdtttdfdd }|S)Nr)rrr@rcst|tsdS|||Srd)rTrrrrrwrapped4s z)_require_version_compare..wrapped) functoolswrapsrpr4r7)rrrrr_require_version_compare1src @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. (?gsz!_is_not_suffix..)devabrcpost)anyrrrrrfs r)leftrightrc Csgg}}|ttdd||ttdd|||t|dd||t|dd|ddgtdt|dt|d|ddgtdt|dt|dttj|ttj|fS)NcSs|SrRisdigitxrrrpz_pad_version..cSs|SrRrrrrrrqrrr 0)rgrrrrinsertmaxchain)rr left_split right_splitrrrrls ,,rc@seZdZd%eeeddddZedddZedd d Ze dd d Z e defdd ddZ e ed ddZe ed ddZe dddZeedddZeeedddZejeddddZeedddZd&eeeedd d!Zd'eeeeeed"d#d$ZdS)( SpecifierSetr>N) specifiersr'rc Csldd|dD}t}|D]8}z|t|WqtyT|t|Yq0qt||_||_dS)NcSsg|]}|r|qSr)rFrsrrr rz)SpecifierSet.__init__..,) rsetaddrrrq frozenset_specsrH)rrr'split_specifiersparsed specifierrrrrJs  zSpecifierSet.__init__rcCs*|jdurd|jnd}dt||S)NrKr>z)rHr'rLr4rNrrrrPs zSpecifierSet.__repr__cCsdtdd|jDS)Nrcss|]}t|VqdSrR)r4rrrrrrz'SpecifierSet.__str__..)rsortedrrrrrr szSpecifierSet.__str__cCs t|jSrR)rSrrrrrr!szSpecifierSet.__hash__r"cCst|trt|}nt|ts"tSt}t|j|jB|_|jdurX|jdurX|j|_n<|jdurv|jdurv|j|_n|j|jkr|j|_ntd|S)NzFCannot combine SpecifierSets with True and False prerelease overrides.)rTr4rrUrrrH ValueError)rr#rrrr__and__s        zSpecifierSet.__and__cCs6t|ttfrtt|}nt|ts*tS|j|jkSrRrTr4r;rrUrr$rrrr%s  zSpecifierSet.__eq__cCs6t|ttfrtt|}nt|ts*tS|j|jkSrRrr$rrrr&s  zSpecifierSet.__ne__cCs t|jSrR)rrrrrr__len__szSpecifierSet.__len__cCs t|jSrR)iterrrrrr__iter__szSpecifierSet.__iter__cCs.|jdur|jS|jsdStdd|jDS)Ncss|] }|jVqdSrRr'rrrrrrz+SpecifierSet.prereleases..)rHrrrrrrr's  zSpecifierSet.prereleasesr(cCs ||_dSrRr_r*rrrr'sr`cCs ||SrRrarbrrrrcszSpecifierSet.__contains__r+csLtttfstdur$|js2jr2dStfdd|jDS)NFc3s|]}|jdVqdS)rNrarr,r'rrrrz(SpecifierSet.contains..)rTrrrr'reallrr-rrrr.s zSpecifierSet.containsr/cCs|dur|j}|jr6|jD]}|j|t|d}q|Sg}g}|D]P}t|ttfs^t|}n|}t|trnqB|jr|s|s| |qB| |qB|s|r|dur|S|SdS)Nr) r'rr1r7rTrrrrerg)rr0r'r@filteredrir,rkrrrr1 s*      zSpecifierSet.filter)r>N)N)N)rrrr4rr7rJrPr r5r!r rr6r%r&rrr;rrmr'r9rorcr.rrr1rrrrr~s8    r)+r2rrrrtypingrrrrrrrr r r r utilsrrCrrrrpr4rorr7rnrrABCMetarr;rqrrrrrrrrrrrrs64   :=   *