fF? dZddlmZddlZddlZddlmZmZmZm Z m Z m Z ddl m Z mZmZmZgdZe e eefdfZe eee eeffZe ee e e eefe ee eefffdffZe ee edfeeeefZeeegefZGd d eZdd ZGd deZGddZdZeZ Gdd eZ! ddZ"ejFdZ$ddZ% ddZ&y)zB .. testsetup:: from packaging.version import parse, Version ) annotationsN)AnyCallable NamedTuple SupportsIntTupleUnion)Infinity InfinityTypeNegativeInfinityNegativeInfinityType)VERSION_PATTERNparseVersionInvalidVersion.cJeZdZUded<ded<ded<ded<ded<d ed <y ) _Versionintepochtuple[int, ...]releasetuple[str, int] | NonedevprepostLocalType | NonelocalN)__name__ __module__ __qualname____annotations__Z/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/packaging/version.pyrr&s% J     r$rrct|S)zParse the given version string. >>> parse('1.0.dev1') :param version: The version string to parse. :raises InvalidVersion: When the version string is not a valid version. )r)versions r%rr/s 7 r$ceZdZdZy)rzRaised when a version string is not a valid version. >>> Version("invalid") Traceback (most recent call last): ... packaging.version.InvalidVersion: Invalid version: 'invalid' N)rr r!__doc__r#r$r%rr;sr$rcPeZdZUded<d dZd dZd dZd dZd dZd dZ d d Z y ) _BaseVersionztuple[Any, ...]_keyc,t|jSN)hashr,selfs r%__hash__z_BaseVersion.__hash__HsDIIr$c`t|tstS|j|jkSr. isinstancer+NotImplementedr,r1others r%__lt__z_BaseVersion.__lt__N%%.! !yy5::%%r$c`t|tstS|j|jkSr.r4r7s r%__le__z_BaseVersion.__le__T%%.! !yyEJJ&&r$c`t|tstS|j|jk(Sr.r4r7s r%__eq__z_BaseVersion.__eq__Zr=r$c`t|tstS|j|jk\Sr.r4r7s r%__ge__z_BaseVersion.__ge__`r=r$c`t|tstS|j|jkDSr.r4r7s r%__gt__z_BaseVersion.__gt__fr:r$c`t|tstS|j|jk7Sr.r4r7s r%__ne__z_BaseVersion.__ne__lr=r$Nreturnr)r8r+rGbool)r8objectrGrH) rr r!r"r2r9r<r?rArCrEr#r$r%r+r+Es+  & ' ' ' & 'r$r+a v? (?: (?:(?P[0-9]+)!)? # epoch (?P[0-9]+(?:\.[0-9]+)*) # release segment (?P
                                          # pre-release
            [-_\.]?
            (?Palpha|a|beta|b|preview|pre|c|rc)
            [-_\.]?
            (?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
ceZdZUdZej
dezdzejejzZ	de
d<ddZddZddZ
edd	Zedd
ZeddZeddZedd
ZeddZeddZeddZeddZeddZeddZeddZeddZeddZy) raThis class abstracts handling of a project's versions.

    A :class:`Version` instance is comparison aware and can be compared and
    sorted using the standard Python interfaces.

    >>> v1 = Version("1.0a5")
    >>> v2 = Version("1.0")
    >>> v1
    
    >>> v2
    
    >>> v1 < v2
    True
    >>> v1 == v2
    False
    >>> v1 > v2
    False
    >>> v1 >= v2
    False
    >>> v1 <= v2
    True
    z^\s*z\s*$CmpKeyr,c|jj|}|std|dt|j	drt|j	dndt
d|j	djdDt|j	d|j	d	t|j	d
|j	dxs|j	dt|j	d
|j	dt|j	d|_
t|jj|jj|jj|jj|jj |jj"|_y)aCInitialize a Version object.

        :param version:
            The string representation of a version which will be parsed and normalized
            before use.
        :raises InvalidVersion:
            If the ``version`` does not conform to PEP 440 in any way then this
            exception will be raised.
        zInvalid version: ''rrc32K|]}t|ywr.)r.0is  r%	z#Version.__init__..sLQ#a&Lr.pre_lpre_npost_lpost_n1post_n2dev_ldev_nr)rrrrrrN)_regexsearchrrgrouprtuplesplit_parse_letter_version_parse_local_version_version_cmpkeyrrrrrrr,)r1r'matchs   r%__init__zVersion.__init__sR""7+ #5gYa!@AA!/4{{7/C#ekk'*+L%++i*@*F*Fs*KLL%ekk'&:EKK>> Version('1.0.0')
        
        z
r#r0s r%__repr__zVersion.__repr__sD6%%r$cZg}|jdk7r|j|jd|jdjd|jD|j1|jdjd|jD|j
|jd|j
|j|jd|j|j|jd	|jdj|S)
zA string representation of the version that can be rounded-tripped.

        >>> str(Version("1.0a5"))
        '1.0a5'
        r!rTc32K|]}t|ywr.strrPxs  r%rRz"Version.__str__..;c!f;rSc32K|]}t|ywr.rlrns  r%rRz"Version.__str__..s :AQ :rSz.postz.dev+)rappendjoinrrrrrr1partss  r%__str__zVersion.__str__s::?LLDJJ>> Version("2.0.0").epoch
        0
        >>> Version("1!2.0.0").epoch
        1
        )rcrr0s r%rz
Version.epochs}}"""r$c.|jjS)adThe components of the "release" segment of the version.

        >>> Version("1.2.3").release
        (1, 2, 3)
        >>> Version("2.0.0").release
        (2, 0, 0)
        >>> Version("1!2.0.0.post0").release
        (2, 0, 0)

        Includes trailing zeroes but not the epoch or any pre-release / development /
        post-release suffixes.
        )rcrr0s r%rzVersion.releases}}$$$r$c.|jjS)aThe pre-release segment of the version.

        >>> print(Version("1.2.3").pre)
        None
        >>> Version("1.2.3a1").pre
        ('a', 1)
        >>> Version("1.2.3b1").pre
        ('b', 1)
        >>> Version("1.2.3rc1").pre
        ('rc', 1)
        )rcrr0s r%rzVersion.pre&s}}   r$cd|jjr|jjdSdS)zThe post-release number of the version.

        >>> print(Version("1.2.3").post)
        None
        >>> Version("1.2.3.post1").post
        1
        r
N)rcrr0s r%rzVersion.post5s*)-

(:(:t}}!!!$DDr$cd|jjr|jjdSdS)zThe development number of the version.

        >>> print(Version("1.2.3").dev)
        None
        >>> Version("1.2.3.dev1").dev
        1
        r
N)rcrr0s r%rzVersion.dev@s*(,}}'8'8t}}  #BdBr$c|jjr,djd|jjDSy)zThe local version segment of the version.

        >>> print(Version("1.2.3").local)
        None
        >>> Version("1.2.3+abc").local
        'abc'
        rTc32K|]}t|ywr.rlrns  r%rRz Version.local..Us@qCF@rSN)rcrrur0s r%rz
Version.localKs3==88@DMM,?,?@@@r$c>t|jdddS)zThe public portion of the version.

        >>> Version("1.2.3").public
        '1.2.3'
        >>> Version("1.2.3+abc").public
        '1.2.3'
        >>> Version("1.2.3+abc.dev1").public
        '1.2.3'
        rsr
r)rmr`r0s r%publiczVersion.publicYs4ysA&q))r$cg}|jdk7r|j|jd|jdjd|jDdj|S)a]The "base version" of the version.

        >>> Version("1.2.3").base_version
        '1.2.3'
        >>> Version("1.2.3+abc").base_version
        '1.2.3'
        >>> Version("1!1.2.3+abc.dev1").base_version
        '1!1.2.3'

        The "base version" is the public version of the project without any pre or post
        release markers.
        rrjrTc32K|]}t|ywr.rlrns  r%rRz'Version.base_version..{rprSrq)rrtrurrvs  r%base_versionzVersion.base_versionfs\::?LLDJJ|jduxs|jduS)aTWhether this version is a pre-release.

        >>> Version("1.2.3").is_prerelease
        False
        >>> Version("1.2.3a1").is_prerelease
        True
        >>> Version("1.2.3b1").is_prerelease
        True
        >>> Version("1.2.3rc1").is_prerelease
        True
        >>> Version("1.2.3dev1").is_prerelease
        True
        N)rrr0s r%
is_prereleasezVersion.is_prereleases!xxt#;txxt';;r$c|jduS)zWhether this version is a post-release.

        >>> Version("1.2.3").is_postrelease
        False
        >>> Version("1.2.3.post1").is_postrelease
        True
        N)rr0s r%is_postreleasezVersion.is_postreleasesyy$$r$c|jduS)zWhether this version is a development release.

        >>> Version("1.2.3").is_devrelease
        False
        >>> Version("1.2.3.dev1").is_devrelease
        True
        N)rr0s r%
is_devreleasezVersion.is_devreleasesxxt##r$cTt|jdk\r|jdSdS)zqThe first item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").major
        1
        r
rlenrr0s r%majorz
Version.majors'#&dll"3q"8t||A?a?r$cTt|jdk\r|jdSdS)zThe second item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").minor
        2
        >>> Version("1").minor
        0
        r
rrr0s r%minorz
Version.minor'#&dll"3q"8t||A?a?r$cTt|jdk\r|jdSdS)zThe third item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").micro
        3
        >>> Version("1").micro
        0
        rrrr0s r%microz
Version.microrr$N)r'rmrGNone)rGrmrF)rGr)rGr)rGz
int | None)rG
str | None)rGrH)rr r!r)recompilerVERBOSE
IGNORECASEr\r"rfrhrxpropertyrrrrrrrrrrrrrrr#r$r%rrsj.RZZ/1G;RZZ"--=W
XF
L$
L&B##
%
%!!EECC
*
*0<< %%$$@@@@@@r$c|r>|d}|j}|dk(rd}n|dk(rd}n
|dvrd}n|dvrd	}|t|fS|s|rd	}|t|fSy)
Nralphaabetab)crpreviewrc)revrr)lowerr)letternumbers  r%raras>F
WF
v
F
.
.F
|
#Fs6{""fs6{""r$z[\._-]cR|%tdtj|DSy)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Nc3rK|]/}|js|jn
t|1ywr.)isdigitrr)rPparts  r%rRz'_parse_local_version..s/
!%DJJLCI=
s57)r__local_version_separatorsr`)rs r%rbrbs4

177>

	
r$cttttjdt|}||	|t
}n|t}n|}|t
}n|}|t}	n|}	|t
}
ntd|D}
|||||	|
fS)Nc|dk(S)Nrr#)ros r%z_cmpkey..sAFr$c3TK|] }t|tr|dfnt|f"yw)rqN)r5rr
rOs  r%rRz_cmpkey../s-
IJz!S)QG0@!/DD
s&()r_reversedlist	itertools	dropwhiler
r)rrrrrr_release_pre_post_dev_locals           r%rdrdsi))*:HWrs#	GGWW
C%S/3&'	,(#	b@lb@J	   @  F'BJJy1	;6;6
;6
 ;6!	;6

 ;6
;6;6r$