mf?dZddlZddlZddlZddlmZmZmZmZm Z m Z ddl m Z m Z mZmZgdZe e efZe ee eeffZe eeefZe ee e ee eefe eeffdffZe ee edfeeeefZeeegefZejdgd Zd ed d fd ZGddeZGddZdZ e Z! Gdd eZ"dede ee#efd ee eeffdZ$ej%dZ&ded eefdZ'dede edfdee eefdee eefdee eefdee ed efdZ(dS) zB .. testsetup:: from packaging.version import parse, Version N)AnyCallableOptional SupportsIntTupleUnion)Infinity InfinityTypeNegativeInfinityNegativeInfinityType)VERSION_PATTERNparseVersionInvalidVersion._Version)epochreleasedevprepostlocalversionreturnrc t|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)rs H/opt/imunify360/venv/lib64/python3.11/site-packages/packaging/version.pyrr+s 7  ceZdZdZdS)rzRaised when a version string is not a valid version. >>> Version("invalid") Traceback (most recent call last): ... packaging.version.InvalidVersion: Invalid version: 'invalid' N)__name__ __module__ __qualname____doc__rrrr7srrceZdZUeedfed<defdZdddefdZ dddefdZ de defdZ dddefd Z dddefd Zde defd Zd S) _BaseVersion._keyrc*t|jSN)hashr&selfs r__hash__z_BaseVersion.__hash__DsDIrothercZt|tstS|j|jkSr( isinstancer%NotImplementedr&r+r-s r__lt__z_BaseVersion.__lt__J)%.. "! !y5:%%rcZt|tstS|j|jkSr(r/r2s r__le__z_BaseVersion.__le__P)%.. "! !yEJ&&rcZt|tstS|j|jkSr(r/r2s r__eq__z_BaseVersion.__eq__Vr7rcZt|tstS|j|jkSr(r/r2s r__ge__z_BaseVersion.__ge__\r7rcZt|tstS|j|jkSr(r/r2s r__gt__z_BaseVersion.__gt__br4rcZt|tstS|j|jkSr(r/r2s r__ne__z_BaseVersion.__ne__hr7rN)rr r!rr__annotations__intr,boolr3r6objectr9r;r=r?r#rrr%r%As S/# &N&t&&&& 'N't'''' 'F't'''' 'N't'''' &N&t&&&& 'F't''''''rr%a 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
cfeZdZUdZejdezdzejejzZ	e
ed<deddfdZ
defd	Zdefd
ZedefdZedeedffd
ZedeeeeffdZedeefdZedeefdZedeefdZedefdZedefdZedefdZedefdZedefdZedefdZ edefdZ!edefdZ"dS)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*$r&rrNc|j|}|std|dt|dr"t|dndt
d|ddDt|d|d	t|d
|dp|dt|d
|dt|d|_
t|j
j|j
j
|j
j|j
j|j
j|j
j|_dS)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: ''rrc34K|]}t|VdSr()rA.0is  r	z#Version.__init__..s(LLQ#a&&LLLLLLrr.pre_lpre_npost_lpost_n1post_n2dev_ldev_nr)rrrrrrN)_regexsearchrrgrouprAtuplesplit_parse_letter_version_parse_local_version_version_cmpkeyrrrrrrr&)r+rmatchs   r__init__zVersion.__init__s""7++	B !@g!@!@!@AAA!/4{{7/C/CJ#ekk'**+++LL%++i*@*@*F*Fs*K*KLLLLL%ekk'&:&:EKK>> Version('1.0.0')
        
        z
r#r*s r__repr__zVersion.__repr__s&D%%%%rcBg}|jdkr||jd|dd|jD|j7|dd|jD|j|d|j|j|d	|j|j|d
|jd|S)zA string representation of the version that can be rounded-tripped.

        >>> str(Version("1.0a5"))
        '1.0a5'
        r!rLc34K|]}t|VdSr(strrIxs  rrKz"Version.__str__..(;;c!ff;;;;;;rNc34K|]}t|VdSr(rdrfs  rrKz"Version.__str__..s( : :AQ : : : : : :rz.postz.dev+)rappendjoinrrrrrr+partss  r__str__zVersion.__str__s":??LLDJ)))***	SXX;;dl;;;;;<<<8LL : : : : :::;;;9 LL,,,---8LL***+++:!LL)TZ))***wwu~~rc|jj}|S)zThe epoch of the version.

        >>> Version("2.0.0").epoch
        0
        >>> Version("1!2.0.0").epoch
        1
        )r[r)r+_epochs  rrz
Version.epochsm)
r.c|jj}|S)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.
        )r[r)r+_releases  rrzVersion.releases%)M$9rc|jj}|S)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)
        )r[r)r+_pres  rrzVersion.pre$s+/-*;rcB|jjr|jjdndS)zThe post-release number of the version.

        >>> print(Version("1.2.3").post)
        None
        >>> Version("1.2.3.post1").post
        1
        r	N)r[rr*s rrzVersion.post4s#)-
(:Dt}!!$$DrcB|jjr|jjdndS)zThe development number of the version.

        >>> print(Version("1.2.3").dev)
        None
        >>> Version("1.2.3.dev1").dev
        1
        r	N)r[rr*s rrzVersion.dev?s#(,}'8Bt} ##dBrcp|jjr)dd|jjDSdS)zThe local version segment of the version.

        >>> print(Version("1.2.3").local)
        None
        >>> Version("1.2.3+abc").local
        'abc'
        rLc34K|]}t|VdSr(rdrfs  rrKz Version.local..Ts(@@qCFF@@@@@@rN)r[rrmr*s rrz
Version.localJs<=	88@@DM,?@@@@@@4rcTt|dddS)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'
        rkr	r)rerXr*s rpubliczVersion.publicXs#4yysA&&q))rcg}|jdkr||jd|dd|jDd|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.
        rrbrLc34K|]}t|VdSr(rdrfs  rrKz'Version.base_version..zrhrri)rrlrmrrns  rbase_versionzVersion.base_versionest:??LLDJ)))***	SXX;;dl;;;;;<<<wwu~~rc&|jdup|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)rrr*s r
is_prereleasezVersion.is_prerelease~sxt#;txt';;rc|jduS)zWhether this version is a post-release.

        >>> Version("1.2.3").is_postrelease
        False
        >>> Version("1.2.3.post1").is_postrelease
        True
        N)rr*s ris_postreleasezVersion.is_postreleasesy$$rc|jduS)zWhether this version is a development release.

        >>> Version("1.2.3").is_devrelease
        False
        >>> Version("1.2.3.dev1").is_devrelease
        True
        N)rr*s r
is_devreleasezVersion.is_devreleasesxt##rcPt|jdkr
|jdndS)zqThe first item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").major
        1
        r	rlenrr*s rmajorz
Version.majors(#&dl"3"3q"8"8t|Aa?rcPt|jdkr
|jdndS)zThe second item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").minor
        2
        >>> Version("1").minor
        0
        r	rrr*s rminorz
Version.minor(#&dl"3"3q"8"8t|Aa?rcPt|jdkr
|jdndS)zThe third item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").micro
        3
        >>> Version("1").micro
        0
        rrrr*s rmicroz
Version.microrr)#rr r!r"recompilerVERBOSE
IGNORECASErTCmpKeyr@rer^r`rppropertyrArrrrrrrrr|rrBrrrrrrr#rrrrs	.RZ/1G;RZ"-=W
X
XF
LLL$
$
$
$
$
$
L&#&&&&B	s			X	sCxX 
XeCHo.


X
EhsmEEEXECXc]CCCXCx}X
*
*
*
*X
*cX0F
WFF
v

FF
.
.
.FF
|
#
#Fs6{{""#f#s6{{""4rz[\._-]rcl|1tdt|DSdS)zR
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    Nc3K|];}|s|nt|V.sU

!%=DJJLLLCII





r)rW_local_version_separatorsrX)rs rrZrZsM


177>>




	
4rrrrrrcPttttjdt|}||
|t
}n|t}n|}|t
}n|}|t}	n|}	|t
}
ntd|D}
|||||	|
fS)Nc|dkS)Nrr#)rgs rz_cmpkey..s
AFrc3ZK|]&}t|tr|dfnt|fV'dS)riN)r0rArrHs  rrKz_cmpkey..0sP

IJz!S))DQGG0@!/D





r)rWreversedlist	itertools	dropwhilerr
)rrrrrrrtrv_post_dev_locals           rr\r\si)*:*:HWrsQ				EEEEEEEEEEEEEEEEWWWWWWWWWWWW
C
C
Cl$889
}eCHo56]C,-	
,#$&45
7	

		


	
sCx...)S
#FF#3T#9:!;!CCC
	3	9				Z+'+'+'+'+'+'+'+'`>#	e@e@e@e@e@le@e@e@P	!!sE;67!
eCHo!!!!H'BJy11		(;				<6<6
38_<6
%S/	"<65c?
#	<6

%S/	"<6E,'(
<6<6<6<6<6<6<6r