U Qab$- @sddlmZmZmZddlZddlZddlZddlmZddddd gZ e d d d d dddgZ ddZ Gddde ZGdddeZGdddeZedejZddddddZddZddZdZGd ddeZd!d"Zed#Zd$d%Zd&d'ZdS)()absolute_importdivisionprint_functionN)InfinityparseVersion LegacyVersionInvalidVersionVERSION_PATTERN_VersionepochreleasedevprepostlocalcCs,z t|WStk r&t|YSXdS)z Parse the given version string and return either a :class:`Version` object or a :class:`LegacyVersion` object depending on if the given version is a valid PEP 440 version or a legacy version. N)rr r )versionrK/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.pyrs c@seZdZdZdS)r zF An invalid version was found, users should refer to PEP 440. N)__name__ __module__ __qualname____doc__rrrrr $sc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS) _BaseVersioncCs t|jSN)hash_keyselfrrr__hash__,sz_BaseVersion.__hash__cCs||ddS)NcSs||kSrrsorrr0z%_BaseVersion.__lt__.._comparerotherrrr__lt__/sz_BaseVersion.__lt__cCs||ddS)NcSs||kSrrr!rrrr$3r%z%_BaseVersion.__le__..r&r(rrr__le__2sz_BaseVersion.__le__cCs||ddS)NcSs||kSrrr!rrrr$6r%z%_BaseVersion.__eq__..r&r(rrr__eq__5sz_BaseVersion.__eq__cCs||ddS)NcSs||kSrrr!rrrr$9r%z%_BaseVersion.__ge__..r&r(rrr__ge__8sz_BaseVersion.__ge__cCs||ddS)NcSs||kSrrr!rrrr$<r%z%_BaseVersion.__gt__..r&r(rrr__gt__;sz_BaseVersion.__gt__cCs||ddS)NcSs||kSrrr!rrrr$?r%z%_BaseVersion.__ne__..r&r(rrr__ne__>sz_BaseVersion.__ne__cCst|tstS||j|jSr) isinstancerNotImplementedr)rr)methodrrrr'As z_BaseVersion._compareN) rrrr r*r+r,r-r.r/r'rrrrr*src@s`eZdZddZddZddZeddZed d Zed d Z ed dZ eddZ dS)r cCst||_t|j|_dSr)str_version_legacy_cmpkeyr)rrrrr__init__Js zLegacyVersion.__init__cCs|jSrr4rrrr__str__NszLegacyVersion.__str__cCsdtt|S)Nzformatreprr3rrrr__repr__QszLegacyVersion.__repr__cCs|jSrr7rrrrpublicTszLegacyVersion.publiccCs|jSrr7rrrr base_versionXszLegacyVersion.base_versioncCsdSrrrrrrr\szLegacyVersion.localcCsdSNFrrrrr is_prerelease`szLegacyVersion.is_prereleasecCsdSr?rrrrris_postreleasedszLegacyVersion.is_postreleaseN) rrrr6r8r<propertyr=r>rr@rArrrrr Hs    z(\d+ | [a-z]+ | \.| -)czfinal-@)rpreview-rcrccs\t|D]F}t||}|r |dkr(q |dddkrF|dVq d|Vq dVdS)N.r 0123456789**final)_legacy_version_component_resplit_legacy_version_replacement_mapgetzfill)r"partrrr_parse_version_partsrs   rScCszd}g}t|D]T}|dr^|dkrD|rD|ddkrD|q*|r^|ddkr^|qD||qt|}||fS)NrKrLz*final-Z00000000)rSlower startswithpopappendtuple)rr partsrRrrrr5s    r5a v? (?: (?:(?P[0-9]+)!)? # epoch (?P[0-9]+(?:\.[0-9]+)*) # release segment (?P
                                          # pre-release
            [-_\.]?
            (?P(a|b|c|rc|alpha|beta|pre|preview))
            [-_\.]?
            (?P[0-9]+)?
        )?
        (?P                                         # post release
            (?:-(?P[0-9]+))
            |
            (?:
                [-_\.]?
                (?Ppost|rev|r)
                [-_\.]?
                (?P[0-9]+)?
            )
        )?
        (?P                                          # dev release
            [-_\.]?
            (?Pdev)
            [-_\.]?
            (?P[0-9]+)?
        )?
    )
    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
c@s|eZdZededejejBZddZ	ddZ
ddZed	d
Z
eddZed
dZeddZeddZdS)rz^\s*z\s*$c
Cs|j|}|std|t|dr8t|dndtdd|ddDt	|d|d	t	|d
|dp|dt	|d
|dt
|dd|_t|jj
|jj|jj|jj|jj|jj|_dS)NzInvalid version: '{0}'r
rcss|]}t|VqdSr)int.0irrr	sz#Version.__init__..rrHZpre_lZpre_nZpost_lZpost_n1Zpost_n2Zdev_lZdev_nrr
rrrrr)_regexsearchr
r:rgroupr[rYrN_parse_letter_version_parse_local_versionr4_cmpkeyr
rrrrrr)rrmatchrrrr6s8zVersion.__init__cCsdtt|S)Nzr9rrrrr<szVersion.__repr__cCsg}|jjdkr$|d|jj|ddd|jjD|jjdk	rl|ddd|jjD|jjdk	r|d|jjd	|jjdk	r|d
|jjd	|jj	dk	r|dddd|jj	Dd|S)
Nr{0}!rHcss|]}t|VqdSrr3r]xrrrr_sz"Version.__str__..css|]}t|VqdSrrirjrrrr_sz.post{0}rz.dev{0}z+{0}css|]}t|VqdSrrirjrrrr_s)
r4r
rXr:joinrrrrrrrZrrrr8szVersion.__str__cCst|dddS)N+rrr3rNrrrrr=
szVersion.publiccCsLg}|jjdkr$|d|jj|ddd|jjDd|S)NrrhrHcss|]}t|VqdSrrirjrrrr_sz'Version.base_version..rl)r4r
rXr:rmrrnrrrr>s
zVersion.base_versioncCs$t|}d|kr |dddSdS)Nrorrp)rZversion_stringrrrrsz
Version.localcCst|jjp|jjSr)boolr4rrrrrrr@!szVersion.is_prereleasecCst|jjSr)rqr4rrrrrrA%szVersion.is_postreleaseN)rrrrecompilerVERBOSE
IGNORECASErar6r<r8rBr=r>rr@rArrrrrs"

#



cCsv|rZ|dkrd}|}|dkr&d}n(|dkr4d}n|dkrBd}n|dkrNd	}|t|fS|sr|rrd	}|t|fSdS)
NrZalphaaZbetab)rCrrErG)Zrevrr)rUr[)ZletterZnumberrrrrd*s rdz[\._-]cCs$|dk	r tddt|DSdS)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Ncss&|]}|s|nt|VqdSr)isdigitrUr[)r]rRrrrr_Qsz'_parse_local_version..)rY_local_version_seperatorsrN)rrrrreLsrecCsttttddt|}|dkr@|dkr@|dk	r@t}n|dkrLt}|dkrZt}|dkrft}|dkrvt}ntdd|D}||||||fS)NcSs|dkS)Nrr)rkrrrr$`r%z_cmpkey..css*|]"}t|tr|dfnt|fVqdS)rlN)r0r[rr\rrrr_sz_cmpkey..)rYreversedlist	itertools	dropwhilerr`rrrrfWs,
	rf)Z
__future__rrrcollectionsr}rrZ_structuresr__all__
namedtuplerr
ValueErrorr
objectrr	rsrtrMrOrSr5rrrdrzrerfrrrrsH! k