3

U'ícI9ã	@s^ddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZddlm
Z
mZmZmZddddd	gZeeefZeee
eeffZeeeefZeee
eee
eefe
eeffd
ffZe
ee
ed
feeeefZe
ee
ed
ffZeeeefeeefgefZejddd
ddddgƒZeed.dœdd„ZGdd„deƒZ Gdd„dƒZ!Gdd„de!ƒZ"ej#dej$ƒZ%ddddddœZ&eeedœdd„Z'eedœd d!„Z(d"Z)Gd#d„de!ƒZ*eeee+e	fee
eefd$œd%d&„Z,ej#d'ƒZ-eeed(œd)d*„Z.ee
ed
fee
eefee
eefee
eefee
eed+œd,d-„Z/dS)/éN)ÚCallableÚIteratorÚListÚOptionalÚSupportsIntÚTupleÚUnioné)ÚInfinityÚInfinityTypeÚNegativeInfinityÚNegativeInfinityTypeÚparseÚVersionÚ
LegacyVersionÚInvalidVersionÚVERSION_PATTERN.Ú_VersionÚepochÚreleaseÚdevÚpreÚpostÚlocal)ÚversionÚreturncCs&yt|ƒStk
r t|ƒSXdS)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)rrr)r©rú6/tmp/pip-build-gk9425m9/packaging/packaging/version.pyr*sc@seZdZdZdS)rzF
    An invalid version was found, users should refer to PEP 440.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rrrrr6sc@sˆeZdZUeeefedœdd„Zde	dœdd„Z
de	dœdd„Zee	dœd	d
„Z
de	dœdd„Zde	dœd
d„Zee	dœdd„ZdS)Ú_BaseVersion)rcCs
t|jƒS)N)ÚhashÚ_key)ÚselfrrrÚ__hash__?sz_BaseVersion.__hash__)ÚotherrcCst|tƒstS|j|jkS)N)Ú
isinstancer"ÚNotImplementedr$)r%r'rrrÚ__lt__Es
z_BaseVersion.__lt__cCst|tƒstS|j|jkS)N)r(r"r)r$)r%r'rrrÚ__le__Ks
z_BaseVersion.__le__cCst|tƒstS|j|jkS)N)r(r"r)r$)r%r'rrrÚ__eq__Qs
z_BaseVersion.__eq__cCst|tƒstS|j|jkS)N)r(r"r)r$)r%r'rrrÚ__ge__Ws
z_BaseVersion.__ge__cCst|tƒstS|j|jkS)N)r(r"r)r$)r%r'rrrÚ__gt__]s
z_BaseVersion.__gt__cCst|tƒstS|j|jkS)N)r(r"r)r$)r%r'rrrÚ__ne__cs
z_BaseVersion.__ne__N)rrr rÚCmpKeyÚLegacyCmpKeyr$Úintr&Úboolr*r+Úobjectr,r-r.r/rrrrr"<s
r"c@sþeZdZeddœdd„Zedœdd„Zedœdd	„Zeedœd
d„ƒZeedœdd
„ƒZ	ee
dœdd„ƒZeddœdd„ƒZeddœdd„ƒZ
eddœdd„ƒZeddœdd„ƒZeddœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZdS) rN)rrcCs&t|ƒ|_t|jƒ|_tjdtƒdS)NzZCreating a LegacyVersion has been deprecated and will be removed in the next major release)ÚstrÚ_versionÚ_legacy_cmpkeyr$ÚwarningsÚwarnÚDeprecationWarning)r%rrrrÚ__init__ks

zLegacyVersion.__init__)rcCs|jS)N)r6)r%rrrÚ__str__uszLegacyVersion.__str__cCsd|›dS)Nz<LegacyVersion('z')>r)r%rrrÚ__repr__xszLegacyVersion.__repr__cCs|jS)N)r6)r%rrrÚpublic{szLegacyVersion.publiccCs|jS)N)r6)r%rrrÚbase_versionszLegacyVersion.base_versioncCsdS)Nr	éÿÿÿÿr)r%rrrrƒszLegacyVersion.epochcCsdS)Nr)r%rrrr‡szLegacyVersion.releasecCsdS)Nr)r%rrrr‹szLegacyVersion.precCsdS)Nr)r%rrrrszLegacyVersion.postcCsdS)Nr)r%rrrr“szLegacyVersion.devcCsdS)Nr)r%rrrr—szLegacyVersion.localcCsdS)NFr)r%rrrÚ
is_prerelease›szLegacyVersion.is_prereleasecCsdS)NFr)r%rrrÚis_postreleaseŸszLegacyVersion.is_postreleasecCsdS)NFr)r%rrrÚ
is_devrelease£szLegacyVersion.is_devrelease)rrr r5r;r<r=Úpropertyr>r?r2rrrrrrr3rArBrCrrrrrjs2
z(\d+ | [a-z]+ | \.| -)Úczfinal-ú@)rÚpreviewú-Úrcr)ÚsrccsbxVtj|ƒD]H}tj||ƒ}|s|dkr,q|dd…dkrJ|jdƒVqd|VqWdVdS)NÚ.r	Ú
0123456789éÚ*z*final)Ú_legacy_version_component_reÚsplitÚ_legacy_version_replacement_mapÚgetÚzfill)rJÚpartrrrÚ_parse_version_parts³srUcCs‚d}g}xlt|jƒƒD]\}|jdƒrh|dkrJx|rH|ddkrH|jƒq.Wx|rf|ddkrf|jƒqLW|j|ƒqW|t|ƒfS)	Nr	rNz*finalz*final-Ú00000000r@r@r@)rUÚlowerÚ
startswithÚpopÚappendÚtuple)rrÚpartsrTrrrr7Äs
r7a—
    v?
    (?:
        (?:(?P<epoch>[0-9]+)!)?                           # epoch
        (?P<release>[0-9]+(?:\.[0-9]+)*)                  # release segment
        (?P<pre>                                          # pre-release
            [-_\.]?
            (?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
            [-_\.]?
            (?P<pre_n>[0-9]+)?
        )?
        (?P<post>                                         # post release
            (?:-(?P<post_n1>[0-9]+))
            |
            (?:
                [-_\.]?
                (?P<post_l>post|rev|r)
                [-_\.]?
                (?P<post_n2>[0-9]+)?
            )
        )?
        (?P<dev>                                          # dev release
            [-_\.]?
            (?P<dev_l>dev)
            [-_\.]?
            (?P<dev_n>[0-9]+)?
        )?
    )
    (?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
c@speZdZejdedejejBƒZe	ddœdd„Z
e	dœdd	„Ze	dœd
d„Ze
edœdd
„ƒZe
eedfdœdd„ƒZe
eee	efdœdd„ƒZe
eedœdd„ƒZe
eedœdd„ƒZe
ee	dœdd„ƒZe
e	dœdd„ƒZe
e	dœdd„ƒZe
edœdd„ƒZe
edœdd „ƒZe
edœd!d"„ƒZe
edœd#d$„ƒZe
edœd%d&„ƒZe
edœd'd(„ƒZdS))rz^\s*z\s*$N)rrc	Csâ|jj|ƒ}|s td|›dƒ‚t|jdƒr:t|jdƒƒndtdd„|jdƒjdƒDƒƒt|jd	ƒ|jd
ƒƒt|jdƒ|jdƒpˆ|jd
ƒƒt|jdƒ|jdƒƒt	|jdƒƒd|_
t|j
j|j
j
|j
j|j
j|j
j|j
jƒ|_dS)NzInvalid version: 'ú'rrcss|]}t|ƒVqdS)N)r2)Ú.0Úirrrú	<genexpr>sz#Version.__init__.<locals>.<genexpr>rrKÚpre_lÚpre_nÚpost_lÚpost_n1Úpost_n2Údev_lÚdev_nr)rrrrrr)Ú_regexÚsearchrrÚgroupr2r[rPÚ_parse_letter_versionÚ_parse_local_versionr6Ú_cmpkeyrrrrrrr$)r%rÚmatchrrrr;s$zVersion.__init__)rcCsd|›dS)Nz
<Version('z')>r)r%rrrr="szVersion.__repr__cCsÀg}|jdkr |j|j›dƒ|jdjdd„|jDƒƒƒ|jdk	rb|jdjdd„|jDƒƒƒ|jdk	r~|jd|j›ƒ|jdk	rš|jd	|j›ƒ|jdk	r¶|jd
|j›ƒdj|ƒS)Nrú!rKcss|]}t|ƒVqdS)N)r5)r^Úxrrrr`-sz"Version.__str__.<locals>.<genexpr>Úcss|]}t|ƒVqdS)N)r5)r^rprrrr`1sz.postz.devú+)rrZÚjoinrrrrr)r%r\rrrr<%s




zVersion.__str__cCs|jj}|S)N)r6r)r%Z_epochrrrrAsz
Version.epoch.cCs|jj}|S)N)r6r)r%Ú_releaserrrrFszVersion.releasecCs|jj}|S)N)r6r)r%Ú_prerrrrKszVersion.precCs|jjr|jjdSdS)Nr	)r6r)r%rrrrPszVersion.postcCs|jjr|jjdSdS)Nr	)r6r)r%rrrrTszVersion.devcCs(|jjr djdd„|jjDƒƒSdSdS)NrKcss|]}t|ƒVqdS)N)r5)r^rprrrr`[sz Version.local.<locals>.<genexpr>)r6rrs)r%rrrrXsz
Version.localcCst|ƒjddƒdS)Nrrr	r)r5rP)r%rrrr>_szVersion.publiccCsFg}|jdkr |j|j›dƒ|jdjdd„|jDƒƒƒdj|ƒS)NrrorKcss|]}t|ƒVqdS)N)r5)r^rprrrr`lsz'Version.base_version.<locals>.<genexpr>rq)rrZrsr)r%r\rrrr?cs

zVersion.base_versioncCs|jdk	p|jdk	S)N)rr)r%rrrrApszVersion.is_prereleasecCs
|jdk	S)N)r)r%rrrrBtszVersion.is_postreleasecCs
|jdk	S)N)r)r%rrrrCxszVersion.is_devreleasecCst|jƒdkr|jdSdS)Nr	r)Úlenr)r%rrrÚmajor|sz
Version.majorcCst|jƒdkr|jdSdS)Nér	r)rvr)r%rrrÚminor€sz
Version.minorcCst|jƒdkr|jdSdS)Nérxr)rvr)r%rrrÚmicro„sz
Version.micro) rrr ÚreÚcompilerÚVERBOSEÚ
IGNORECASErhr5r;r=r<rDr2rrrrrrrrr>r?r3rArBrCrwryr{rrrrrs@)ÚletterÚnumberrcCsx|rZ|dkrd}|jƒ}|dkr&d}n(|dkr4d}n|d
krBd	}n|dkrNd}|t|ƒfS|rt|rtd}|t|ƒfSdS)NrÚalphaÚaÚbetaÚbrErrGrIÚrevÚrr)rErrG)r†r‡)rWr2)r€rrrrrk‰s"
rkz[\._-])rrcCs$|dk	r tdd„tj|ƒDƒƒSdS)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Ncss&|]}|jƒs|jƒnt|ƒVqdS)N)ÚisdigitrWr2)r^rTrrrr`¶sz'_parse_local_version.<locals>.<genexpr>)r[Ú_local_version_separatorsrP)rrrrrl°s
rl)rrrrrrrcCs¤ttttjdd„t|ƒƒƒƒƒ}|dkr>|dkr>|dk	r>t}n|dkrLt}n|}|dkr^t}n|}|dkrpt}	n|}	|dkr‚t}
ntdd„|Dƒƒ}
|||||	|
fS)NcSs|dkS)Nrr)rprrrÚ<lambda>Ësz_cmpkey.<locals>.<lambda>css(|] }t|tƒr|dfnt|fVqdS)rqN)r(r2r)r^r_rrrr`õsz_cmpkey.<locals>.<genexpr>)r[ÚreversedÚlistÚ	itertoolsÚ	dropwhilerr
)rrrrrrrtruZ_postZ_devÚ_localrrrrm¼s$	rm)rr)0Úcollectionsrr|r8ÚtypingrrrrrrrÚ_structuresr
rrr
Ú__all__Z
InfiniteTypesr5r2ZPrePostDevTypeZSubLocalTypeZ	LocalTyper0r1r3ZVersionComparisonMethodÚ
namedtuplerrÚ
ValueErrorrr"rr}r~rOrQrUr7rrÚbytesrkr‰rlrmrrrrÚ<module>sd$
.>:
"