
    <c_                        d Z ddlmZ ddlZddlZddlmZmZ ddlZddl	Z	ddl
Z
ddlZe
j        d         dk    Ze
j        d         dk    ZdZdZd	Zd
dgZdZdZdZ eed          sd ZereefZeZeZd Zd Zne efZe ZeZd Zd Zd=dZ!ddde"fdZ# e#d          d             Z$d Z% G d de&          Z' e#dd           d!             Z(d" Z) e#d          d#             Z* e#d          d$             Z+ e#d%d&           d'             Z, e#d(d&           d)             Z- e#d*d           d>d+            Z. e#d          d,             Z/ e#d          d-             Z0 e#d          d.             Z1 e#d          d?d0            Z2 e#d          d@d2            Z3 e#d          d3             Z4 e#d          d4             Z5d5 Z6d6 Z7d7 Z8d8 Z9d9 Z:d: Z;dAd;Z<e=d<k    rddl>Z> e>j?                     dS dS )Bz:Python helper for Semantic Versioning (http://semver.org/)    )print_functionN)wrapspartial      z2.13.0zKostiantyn Rybnikovzk-bx@k-bx.comzSebastien CelleszTom Schraitlezs.celles@gmail.com)
bump_build
bump_major
bump_minor
bump_patchbump_prereleasecompare
deprecatedfinalize_versionformat_versionmatchmax_vermin_verparseparse_version_inforeplacecmd_bump	cmd_checkcmd_comparecreateparsermainprocessSEMVER_SPEC_VERSIONVersionInfoz2.0.0cmpc                     | |k    | |k     z
  S )z6Return negative if a<b, zero if a==b, positive if a>b. abs     &lib/python3.11/site-packages/semver.pyr   r   >   s    A!a%      c                 ,    |                      d          S )Nzlatin-1)encodess    r%   r$   r$   H   s    xx	"""r&   c                     | S Nr!   r)   s    r%   ur-   K       r&   c                     | S r,   r!   r)   s    r%   r$   r$   T   r.   r&   c                 J    t          |                     dd          d          S )Nz\\z\\\\unicode_escape)unicoder   r)   s    r%   r-   r-   X   s!    qyy002BCCCr&   utf-8strictc                 F   t          | t          t          f          st          dt	          |           z            t
          r,t          | t                    r|                     ||          } n2t          r+t          | t                    r|                     ||          } | S )z
    Coerce *s* to `str`.

    For Python 2:
      - `unicode` -> encoded to `str`
      - `str` -> `str`

    For Python 3:
      - `str` -> `str`
      - `bytes` -> decoded to `str`
    znot expecting type '%s')	
isinstance	text_typebinary_type	TypeErrortypePY2r(   PY3decode)r*   encodingerrorss      r%   
ensure_strr@   \   s     a)[122 =1DGG;<<<
 'z!Y'' 'HHXv&&	 'A{++ 'HHXv&&Hr&   c                 |      t          t                    S t                      fd            }|S )a  
    Decorates a function to output a deprecation warning.

    :param func: the function to decorate (or None)
    :param str replace: the function to replace (use the full qualified
        name like ``semver.VersionInfo.bump_major``.
    :param str version: the first version when this function was deprecated.
    :param category: allow you to specify the deprecation warning class
        of your choice. By default, it's  :class:`DeprecationWarning`, but
        you can choose :class:`PendingDeprecationWarning` or a custom class.
    N)r   versioncategoryc                     dg}	r|                     d           |                     d           r|                     d           n|                     d           t          d          rj        nj        }p|}t	          j                    j        }d                    |          }t          j	        |
                    j        ||	          t	          j        |j                  |j        	           ~ | i |S )
Nz!Function '{m}.{f}' is deprecated.zDeprecated since version {v}. z*This function will be removed in semver 3.zUse {r!r} instead.z4Use the respective 'semver.VersionInfo.{r}' instead.__qualname__ )mfrv)rC   filenamelineno)appendhasattrrE   __name__inspectcurrentframef_backjoinwarningswarn_explicitformat
__module__getfilef_codef_lineno)
argskwargsmsgrH   rI   framerC   funcr   rB   s
         r%   wrapperzdeprecated.<locals>.wrapper   s   23 	9JJ7888

?@@@ 	OJJ+,,,,JJMNNN ")~!>!>QDDMLq$&&-hhsmmJJAgJ>>_U\22>		
 	
 	
 	
 tT$V$$$r&   )r   r   r   )r_   r   rB   rC   r`   s   ```` r%   r   r   r   sc     |z7GhWWWW
4[[% % % % % % % [%< Nr&   2.10.0rB   c                 Z    t                               |                                           S )aK  
    Parse version to major, minor, patch, pre-release, build parts.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.parse` instead.

    :param version: version string
    :return: dictionary with the keys 'build', 'major', 'minor', 'patch',
             and 'prerelease'. The prerelease or build keys can be None
             if not provided
    :rtype: dict

    >>> ver = semver.parse('3.4.5-pre.2+build.4')
    >>> ver['major']
    3
    >>> ver['minor']
    4
    >>> ver['patch']
    5
    >>> ver['prerelease']
    'pre.2'
    >>> ver['build']
    'build.4'
    )r   r   to_dictrb   s    r%   r   r      s$    4 W%%--///r&   c                 <     t                      fd            }|S )z4Wrap a VersionInfo binary op method in a type-check.c                     t           t          t          t          t          t
          f}t          ||          s"t          dt          |          d|           | |          S )Nzother type z must be in )	r   dicttuplelistr7   r8   r6   r9   r:   )selfothercomparable_typesoperators      r%   r`   zcomparator.<locals>.wrapper   sg    'udI{S%!122 	)15e>N>NO   xe$$$r&   )r   )rm   r`   s   ` r%   
comparatorrn      s5     8__% % % % _% Nr&   c                   2   e Zd ZdZdZ ej        d          Z ej        dej                  Z	d4dZ
ed             Zej        d	             Zed
             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zd Zd Z edd          d             Zej        e_         edd          d             Zej        e_        d Zed             Zd Zd Zd Zd5d Zd6d"Zd# Zd5d$Z e!d%             Z"e!d&             Z#e!d'             Z$e!d(             Z%e!d)             Z&e!d*             Z'd+ Z(d, Z)d- Z*d. Z+d/ Z,d0 Z-e.d1             Z/d2 Z0e.d3             Z1dS )7r   a  
    A semver compatible version class.

    :param int major: version when you make incompatible API changes.
    :param int minor: version when you add functionality in
                      a backwards-compatible manner.
    :param int patch: version when you make backwards-compatible bug fixes.
    :param str prerelease: an optional prerelease string
    :param str build: an optional build string
    )_major_minor_patch_prerelease_buildz(?:[^\d]*(\d+)[^\d]*)+a  
            ^
            (?P<major>0|[1-9]\d*)
            \.
            (?P<minor>0|[1-9]\d*)
            \.
            (?P<patch>0|[1-9]\d*)
            (?:-(?P<prerelease>
                (?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)
                (?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*
            ))?
            (?:\+(?P<build>
                [0-9a-zA-Z-]+
                (?:\.[0-9a-zA-Z-]+)*
            ))?
            $
        r   Nc                 l   |||d}|                                 D ]A\  }}t          |          }|||<   |dk     r"t          d                    |                    B|d         | _        |d         | _        |d         | _        |d nt          |          | _        |d nt          |          | _	        d S )Nmajorminorpatchr   z1{!r} is negative. A version can only be positive.rw   rx   ry   )
itemsint
ValueErrorrV   rp   rq   rr   strrs   rt   )	rj   rw   rx   ry   
prereleasebuildversion_partsnamevalues	            r%   __init__zVersionInfo.__init__   s     
 
 )..00 	 	KD%JJE"'M$qyy GNNtTT   
 $G,#G,#G,#-#5443z??#mddUr&   c                     | j         S )z(The major part of a version (read-only).)rp   rj   s    r%   rw   zVersionInfo.major       {r&   c                      t          d          )Nzattribute 'major' is readonlyAttributeErrorrj   r   s     r%   rw   zVersionInfo.major      <===r&   c                     | j         S )z(The minor part of a version (read-only).)rq   r   s    r%   rx   zVersionInfo.minor  r   r&   c                      t          d          )Nzattribute 'minor' is readonlyr   r   s     r%   rx   zVersionInfo.minor  r   r&   c                     | j         S )z(The patch part of a version (read-only).)rr   r   s    r%   ry   zVersionInfo.patch  r   r&   c                      t          d          )Nzattribute 'patch' is readonlyr   r   s     r%   ry   zVersionInfo.patch"  r   r&   c                     | j         S )z-The prerelease part of a version (read-only).)rs   r   s    r%   r~   zVersionInfo.prerelease&  s     r&   c                      t          d          )Nz"attribute 'prerelease' is readonlyr   r   s     r%   r~   zVersionInfo.prerelease+  s    ABBBr&   c                     | j         S )z(The build part of a version (read-only).)rt   r   s    r%   r   zVersionInfo.build/  r   r&   c                      t          d          )Nzattribute 'build' is readonlyr   r   s     r%   r   zVersionInfo.build4  r   r&   c                 B    | j         | j        | j        | j        | j        fS )ay  
        Convert the VersionInfo object to a tuple.

        .. versionadded:: 2.10.0
           Renamed ``VersionInfo._astuple`` to ``VersionInfo.to_tuple`` to
           make this function available in the public API.

        :return: a tuple with all the parts
        :rtype: tuple

        >>> semver.VersionInfo(5, 3, 1).to_tuple()
        (5, 3, 1, None, None)
        rw   rx   ry   r~   r   r   s    r%   to_tuplezVersionInfo.to_tuple8  s     
DJ
DOTZPPr&   c                 z    t          j        d| j        fd| j        fd| j        fd| j        fd| j        ff          S )a:  
        Convert the VersionInfo object to an OrderedDict.

        .. versionadded:: 2.10.0
           Renamed ``VersionInfo._asdict`` to ``VersionInfo.to_dict`` to
           make this function available in the public API.

        :return: an OrderedDict with the keys in the order ``major``, ``minor``,
          ``patch``, ``prerelease``, and ``build``.
        :rtype: :class:`collections.OrderedDict`

        >>> semver.VersionInfo(3, 2, 1).to_dict()
        OrderedDict([('major', 3), ('minor', 2), ('patch', 1), ('prerelease', None), ('build', None)])
        rw   rx   ry   r~   r   )collectionsOrderedDictrw   rx   ry   r~   r   r   s    r%   rd   zVersionInfo.to_dictH  sP      &$*%$*%$*%t/$*%
 
 	
r&   zsemver.VersionInfo.to_tuplera   r   rB   c                 *    |                                  S r,   r   r   s    r%   _astuplezVersionInfo._astuplec  s    }}r&   zsemver.VersionInfo.to_dictc                 *    |                                  S r,   )rd   r   s    r%   _asdictzVersionInfo._asdicti  s    ||~~r&   c              #   @   K   |                                  D ]}|V  dS )zImplement iter(self).Nr   )rj   rJ   s     r%   __iter__zVersionInfo.__iter__o  s4        	 	AGGGG	 	r&   c                 H   t           j                            |           }|rt          t	          |                    d                    dz             }|                    d          \  }}| dt          |t          |          z
  |                   |z   | |d         z   } | S )a  
        Look for the last sequence of number(s) in a string and increment.

        :param str string: the string to search for.
        :return: the incremented string

        Source:
        http://code.activestate.com/recipes/442460-increment-numbers-in-a-string/#c1
           N)	r   _LAST_NUMBERsearchr}   r{   groupspanmaxlen)stringr   next_startends        r%   _increment_stringzVersionInfo._increment_stringu  s     (//77 	SEKKNN++a/00EAJE3:c#E

"2E:::;eCfSTTlRFr&   c                 F    t          |           } || j        dz             S )ag  
        Raise the major part of the version, return a new object but leave self
        untouched.

        :return: new object with the raised major part
        :rtype: :class:`VersionInfo`

        >>> ver = semver.VersionInfo.parse("3.4.5")
        >>> ver.bump_major()
        VersionInfo(major=4, minor=0, patch=0, prerelease=None, build=None)
        r   )r:   rp   rj   clss     r%   r	   zVersionInfo.bump_major  s%     4jjs4;?###r&   c                 R    t          |           } || j        | j        dz             S )ag  
        Raise the minor part of the version, return a new object but leave self
        untouched.

        :return: new object with the raised minor part
        :rtype: :class:`VersionInfo`

        >>> ver = semver.VersionInfo.parse("3.4.5")
        >>> ver.bump_minor()
        VersionInfo(major=3, minor=5, patch=0, prerelease=None, build=None)
        r   )r:   rp   rq   r   s     r%   r
   zVersionInfo.bump_minor  s)     4jjs4;a000r&   c                 ^    t          |           } || j        | j        | j        dz             S )ag  
        Raise the patch part of the version, return a new object but leave self
        untouched.

        :return: new object with the raised patch part
        :rtype: :class:`VersionInfo`

        >>> ver = semver.VersionInfo.parse("3.4.5")
        >>> ver.bump_patch()
        VersionInfo(major=3, minor=4, patch=6, prerelease=None, build=None)
        r   )r:   rp   rq   rr   r   s     r%   r   zVersionInfo.bump_patch  s-     4jjs4;T[1_===r&   rcc                     t          |           }|                    | j        p|pddz             } || j        | j        | j        |          S )a  
        Raise the prerelease part of the version, return a new object but leave
        self untouched.

        :param token: defaults to 'rc'
        :return: new object with the raised prerelease part
        :rtype: :class:`VersionInfo`

        >>> ver = semver.VersionInfo.parse("3.4.5-rc.1")
        >>> ver.bump_prerelease()
        VersionInfo(major=3, minor=4, patch=5, prerelease='rc.2', build=None)
        r   .0)r:   r   rs   rp   rq   rr   )rj   tokenr   r~   s       r%   r   zVersionInfo.bump_prerelease  sP     4jj**4+;+UQU?UVV
s4;T[*EEEr&   r   c                     t          |           }|                    | j        p|pddz             } || j        | j        | j        | j        |          S )a  
        Raise the build part of the version, return a new object but leave self
        untouched.

        :param token: defaults to 'build'
        :return: new object with the raised build part
        :rtype: :class:`VersionInfo`

        >>> ver = semver.VersionInfo.parse("3.4.5-rc.1+build.9")
        >>> ver.bump_build()
        VersionInfo(major=3, minor=4, patch=5, prerelease='rc.1', build='build.10')
        r   r   )r:   r   rt   rp   rq   rr   rs   )rj   r   r   r   s       r%   r   zVersionInfo.bump_build  sT     4jj%%dk&Ne6Fw$5NOOs4;T[$:JERRRr&   c                 p   t          |           }t          |t                    r|                    |          }nt          |t                    r	 |di |}ngt          |t
          t          f          r || }nEt          ||          s5t          d                    |j	        t          |                              | 
                                dd         }|
                                dd         }t          ||          }|r|S | j        |j        }}t          ||          }|sdS |sdS |sdS |S )aw  
        Compare self with other.

        :param other: the second version (can be string, a dict, tuple/list, or
             a VersionInfo instance)
        :return: The return value is negative if ver1 < ver2,
             zero if ver1 == ver2 and strictly positive if ver1 > ver2
        :rtype: int

        >>> semver.VersionInfo.parse("1.0.0").compare("2.0.0")
        -1
        >>> semver.VersionInfo.parse("2.0.0").compare("1.0.0")
        1
        >>> semver.VersionInfo.parse("2.0.0").compare("2.0.0")
        0
        >>> semver.VersionInfo.parse("2.0.0").compare(dict(major=2, minor=0, patch=0))
        0
        z'Expected str or {} instance, but got {}Nr   r   r   r!   )r:   r6   string_typesr   rg   rh   ri   r9   rV   rO   r   r   r~   _nat_cmp)	rj   rk   r   v1v2xrc1rc2rccmps	            r%   r   zVersionInfo.compare  sS   & 4jje\** 	IIe$$EEt$$ 		CLL%LLEEt}-- 	CKEEE3'' 	9@@L$u++    ]]__RaR ^^bqb!BKK 	H?E$4Sc"" 	1 	1 	2r&   c                    h d}||vr$t          d                    ||                    | }|j        s|j        rN|dk    s1|dk    r|j        dk    s |dk    r1|j        |j        cxk    rdk    rn n|                    dd	          S |d
v r t          |d|z                         S |j        s|                                }|	                    |          S )a  
        Determines next version, preserving natural order.

        .. versionadded:: 2.10.0

        This function is taking prereleases into account.
        The "major", "minor", and "patch" raises the respective parts like
        the ``bump_*`` functions. The real difference is using the
        "preprelease" part. It gives you the next patch version of the prerelease,
        for example:

        >>> str(semver.VersionInfo.parse("0.1.4").next_version("prerelease"))
        '0.1.5-rc.1'

        :param part: One of "major", "minor", "patch", or "prerelease"
        :param prerelease_token: prefix string of prerelease, defaults to 'rc'
        :return: new object with the appropriate part raised
        :rtype: :class:`VersionInfo`
        >   rw   rx   ry   r~   z<Invalid part. Expected one of {validparts}, but got {part!r})
validpartspartry   rx   r   rw   N)r~   r   rv   bump_)
r|   rV   r~   r   ry   rx   r   getattrr   r   )rj   r   prerelease_tokenr   rB   s        r%   next_versionzVersionInfo.next_version  s(   (
 
 

 z!!NUU) V    
  	@'- 	@GOOGMQ$6$6GMW]$G$G$G$Ga$G$G$G$G$G??d$????...377GdN33555! 	+((**G&&'7888r&   c                 4    |                      |          dk    S Nr   r   rj   rk   s     r%   __eq__zVersionInfo.__eq__;      ||E""a''r&   c                 4    |                      |          dk    S r   r   r   s     r%   __ne__zVersionInfo.__ne__?  r   r&   c                 4    |                      |          dk     S r   r   r   s     r%   __lt__zVersionInfo.__lt__C      ||E""Q&&r&   c                 4    |                      |          dk    S r   r   r   s     r%   __le__zVersionInfo.__le__G  r   r&   c                 4    |                      |          dk    S r   r   r   s     r%   __gt__zVersionInfo.__gt__K  r   r&   c                 4    |                      |          dk    S r   r   r   s     r%   __ge__zVersionInfo.__ge__O  r   r&   c                    t          |t                    rt          ||dz             }t          |t                    r|j        |j        dk     s|j        |j        dk     rt          d          t          t          d |                                 |                             }t          |          dk    r	|d         }n|st          d          |S )ap  
        self.__getitem__(index) <==> self[index]

        Implement getitem. If the part requested is undefined, or a part of the
        range requested is undefined, it will throw an index error.
        Negative indices are not supported

        :param Union[int, slice] index: a positive integer indicating the
               offset or a :func:`slice` object
        :raises: IndexError, if index is beyond the range or a part is None
        :return: the requested part of the version at position index

        >>> ver = semver.VersionInfo.parse("3.4.5")
        >>> ver[0], ver[1], ver[2]
        (3, 4, 5)
        r   Nr   z Version index cannot be negativec                 
    | d uS r,   r!   )ps    r%   <lambda>z)VersionInfo.__getitem__.<locals>.<lambda>n  s
    atm r&   zVersion part undefined)
r6   r{   slicer   stop
IndexErrorrh   filterr   r   )rj   indexr   s      r%   __getitem__zVersionInfo.__getitem__S  s    " eS!! 	,%++E ue$$	A(U[1__
&5:>>?@@@V33T]]__U5KLLMMt99>>7DD 	75666r&   c                     d                     d |                                                                 D                       }t          |           j        d|dS )N, c              3   *   K   | ]\  }}|d |V  dS )=Nr!   ).0keyvals      r%   	<genexpr>z'VersionInfo.__repr__.<locals>.<genexpr>w  s1      RRxsCcc*RRRRRRr&   ())rS   rd   rz   r:   rO   )rj   r*   s     r%   __repr__zVersionInfo.__repr__v  sT    IIRR4<<>>;O;O;Q;QRRRRR::...22r&   c                     d| j         | j        | j        fz  }| j        r|d| j        z  z  }| j        r|d| j        z  z  }|S )z	str(self)z%d.%d.%dz-%sz+%sr   )rj   rB   s     r%   __str__zVersionInfo.__str__z  sT    
DJ
CC? 	/ut..G: 	*utz))Gr&   c                 T    t          |                                 d d                   S )N   )hashr   r   s    r%   __hash__zVersionInfo.__hash__  s!    DMMOOBQB'(((r&   c                 X    t          |           } || j        | j        | j                  S )a  
        Remove any prerelease and build metadata from the version.

        :return: a new instance with the finalized version string
        :rtype: :class:`VersionInfo`

        >>> str(semver.VersionInfo.parse('1.2.3-rc.5').finalize_version())
        '1.2.3'
        )r:   rw   rx   ry   r   s     r%   r   zVersionInfo.finalize_version  s)     4jjs4:tz4:666r&   c                     |dd         }|dv r|dd         }n1|r|d         dv r|d         }|dd         }nt          d|z            dd	d
dddd}||         }|                     |          }||v S )aB  
        Compare self to match a match expression.

        :param str match_expr: operator and version; valid operators are
              <   smaller than
              >   greater than
              >=  greator or equal than
              <=  smaller or equal than
              ==  equal
              !=  not equal
        :return: True if the expression matches the version, otherwise False
        :rtype: bool

        >>> semver.VersionInfo.parse("2.0.0").match(">=1.0.0")
        True
        >>> semver.VersionInfo.parse("1.0.0").match(">1.0.0")
        False
        Nr   )>=<===!=r   )><r   z}match_expr parameter should be in format <op><ver>, where <op> is one of ['<', '>', '==', '<=', '>=', '!=']. You provided: %r)r   )r   )r   )r   r   )r   r   )r   r   )r   r   r   r   r   r   )r|   r   )rj   
match_exprprefixmatch_versionpossibilities_dictpossibilitiescmp_ress          r%   r   zVersionInfo.match  s    & BQB---&qrrNMM 		q	Z//AYF&qrrNMM# &00   
 
 +62,,}---''r&   c                 @   | j                             t          |                    }|t          d|z            |                                }t          |d                   |d<   t          |d                   |d<   t          |d                   |d<    | di |S )a  
        Parse version string to a VersionInfo instance.

        :param version: version string
        :return: a :class:`VersionInfo` instance
        :raises: :class:`ValueError`
        :rtype: :class:`VersionInfo`

        .. versionchanged:: 2.11.0
           Changed method from static to classmethod to
           allow subclasses.

        >>> semver.VersionInfo.parse('3.4.5-pre.2+build.4')
        VersionInfo(major=3, minor=4, patch=5, prerelease='pre.2', build='build.4')
        Nz%s is not valid SemVer stringrw   rx   ry   r!   )_REGEXr   r@   r|   	groupdictr{   )r   rB   r   r   s       r%   r   zVersionInfo.parse  s    $ 
  G!4!455=<wFGGG))!$]7%;!<!<g!$]7%;!<!<g!$]7%;!<!<gs##]###r&   c                 X   |                                  }|                    |           	 t          di |S # t          $ rh t	          |          t	          |                                            z
  }dt          |          d                    |          fz  }t          |          w xY w)a   
        Replace one or more parts of a version and return a new
        :class:`VersionInfo` object, but leave self untouched

        .. versionadded:: 2.9.0
           Added :func:`VersionInfo.replace`

        :param dict parts: the parts to be updated. Valid keys are:
          ``major``, ``minor``, ``patch``, ``prerelease``, or ``build``
        :return: the new :class:`VersionInfo` object with the changed
          parts
        :raises: :class:`TypeError`, if ``parts`` contains invalid keys
        z3replace() got %d unexpected keyword argument(s): %sr   Nr!   )rd   updater   r9   setr   rS   )rj   partsrB   unknownkeyserrors        r%   r   zVersionInfo.replace  s     ,,..u	#))))) 	# 	# 	#e**s4<<>>':'::KLK  		+&&P E E"""	#s
   7 A2B)c                 T    	 |                      |           dS # t          $ r Y dS w xY w)a  
        Check if the string is a valid semver version.

        .. versionadded:: 2.9.1

        :param str version: the version string to check
        :return: True if the version string is a valid semver version, False
                 otherwise.
        :rtype: bool
        TF)r   r|   )r   rB   s     r%   isvalidzVersionInfo.isvalid  s@    	IIg4 	 	 	55	s    
'')r   r   NNr   r   )2rO   rW   rE   __doc__	__slots__recompiler   VERBOSEr  r   propertyrw   setterrx   ry   r~   r   r   rd   r   r   r   r   staticmethodr   r	   r
   r   r   r   r   r   rn   r   r   r   r   r   r   r   r   r   r   r   r   classmethodr   r   r  r!   r&   r%   r   r      s       	 	 HI2:788LRZ	" 	
% F*< < < <,   X \> > \>   X \> > \>   X \> > \>     X  C C C   X \> > \>Q Q Q 
 
 
6 Z5xHHH  IH  'HZ4hGGG  HG oGO     \"$ $ $1 1 1> > >F F F F$S S S S$1 1 1f.9 .9 .9 .9` ( ( Z( ( ( Z( ' ' Z' ( ( Z( ' ' Z' ( ( Z(! ! !F3 3 3  ) ) )7 7 7-( -( -(^ $ $ [$:# # #4   [  r&   r   zsemver.VersionInfo.parser   c                 6    t                               |           S )aH  
    Parse version string to a VersionInfo instance.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.parse` instead.

    .. versionadded:: 2.7.2
       Added :func:`semver.parse_version_info`

    :param version: version string
    :return: a :class:`VersionInfo` instance
    :rtype: :class:`VersionInfo`

    >>> version_info = semver.VersionInfo.parse("3.4.5-pre.2+build.4")
    >>> version_info.major
    3
    >>> version_info.minor
    4
    >>> version_info.patch
    5
    >>> version_info.prerelease
    'pre.2'
    >>> version_info.build
    'build.4'
    )r   r   rb   s    r%   r   r     s    6 W%%%r&   c                   	 d 		fd}d }| pd|pd}}  ||            ||          }}t          ||          D ]\  }} |||          }|dk    r|c S t          t          |           t          |                    S )Nc                 N    t          j        d|           rt          |           n| S )Nz^[0-9]+$)r  r   r{   )texts    r%   convertz_nat_cmp.<locals>.convert,  s#    HZ66@s4yyyD@r&   c                 F    fd|                      d          D             S )Nc                 &    g | ]} |          S r!   r!   )r   cr  s     r%   
<listcomp>z/_nat_cmp.<locals>.split_key.<locals>.<listcomp>0  s!    333q

333r&   .)split)r   r  s    r%   	split_keyz_nat_cmp.<locals>.split_key/  s'    3333CIIcNN3333r&   c                     t          | t                    r%t          |t                    rt          | |          S t          | t                    rdS t          |t                    rdS t          | |          S )Nr   r   )r6   r{   r   r"   s     r%   cmp_prerelease_tagz$_nat_cmp.<locals>.cmp_prerelease_tag2  so    a 	*Q"4"4 	q!993 	23 	1q!99r&    r   )zipr   r   )
r#   r$   r%  r'  a_partsb_partssub_asub_b
cmp_resultr  s
            @r%   r   r   +  s    A A A4 4 4 4 4   7AGqA y||YYq\\WGGW-- # #u''u55
??  3q663q66"""r&   c                 `    t                               |           }|                    |          S )a  
    Compare two versions strings.

    :param ver1: version string 1
    :param ver2: version string 2
    :return: The return value is negative if ver1 < ver2,
             zero if ver1 == ver2 and strictly positive if ver1 > ver2
    :rtype: int

    >>> semver.compare("1.0.0", "2.0.0")
    -1
    >>> semver.compare("2.0.0", "1.0.0")
    1
    >>> semver.compare("2.0.0", "2.0.0")
    0
    )r   r   r   )ver1ver2r   s      r%   r   r   F  s)    $ 
		4	 	 B::dr&   c                 `    t                               |           }|                    |          S )a  
    Compare two versions strings through a comparison.

    :param str version: a version string
    :param str match_expr: operator and version; valid operators are
          <   smaller than
          >   greater than
          >=  greator or equal than
          <=  smaller or equal than
          ==  equal
          !=  not equal
    :return: True if the expression matches the version, otherwise False
    :rtype: bool

    >>> semver.match("2.0.0", ">=1.0.0")
    True
    >>> semver.match("1.0.0", ">1.0.0")
    False
    )r   r   r   )rB   r   vers      r%   r   r   \  s)    * 

G
$
$C99Z   r&   r   z2.10.2c                     t          | t                    rt                              |           } n#t          | t                    st	                      |                     |          }|dk    rt          |           S |S )a  
    Returns the greater version of two versions strings.

    :param ver1: version string 1
    :param ver2: version string 2
    :return: the greater version of the two
    :rtype: :class:`VersionInfo`

    >>> semver.max_ver("1.0.0", "2.0.0")
    '2.0.0'
    r   )r6   r   r   r   r9   r   r}   r0  r1  r  s      r%   r   r   u  sr     $%%   &&k** kkll4  G!||4yyr&   minc                     t                               |           } |                     |          }|dk    rt          |           S |S )a  
    Returns the smaller version of two versions strings.

    :param ver1: version string 1
    :param ver2: version string 2
    :return: the smaller version of the two
    :rtype: :class:`VersionInfo`

    >>> semver.min_ver("1.0.0", "2.0.0")
    '1.0.0'
    r   )r   r   r   r}   r5  s      r%   r   r     sB     T""Dll4  G!||4yyr&   zstr(versionobject)c           	      B    t          t          | ||||                    S )a\  
    Format a version string according to the Semantic Versioning specification.

    .. deprecated:: 2.10.0
       Use ``str(VersionInfo(VERSION)`` instead.

    :param int major: the required major part of a version
    :param int minor: the required minor part of a version
    :param int patch: the required patch part of a version
    :param str prerelease: the optional prerelease part of a version
    :param str build: the optional build part of a version
    :return: the formatted string
    :rtype: str

    >>> semver.format_version(3, 4, 5, 'pre.2', 'build.4')
    '3.4.5-pre.2+build.4'
    )r}   r   r   s        r%   r   r     s"    & {5%
EBBCCCr&   c                 t    t          t                              |                                                     S )a  
    Raise the major part of the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.bump_major` instead.

    :param: version string
    :return: the raised version string
    :rtype: str

    >>> semver.bump_major("3.4.5")
    '4.0.0'
    )r}   r   r   r	   rb   s    r%   r	   r	     ,     {  ))4466777r&   c                 t    t          t                              |                                                     S )a  
    Raise the minor part of the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.bump_minor` instead.

    :param: version string
    :return: the raised version string
    :rtype: str

    >>> semver.bump_minor("3.4.5")
    '3.5.0'
    )r}   r   r   r
   rb   s    r%   r
   r
     r:  r&   c                 t    t          t                              |                                                     S )a  
    Raise the patch part of the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.bump_patch` instead.

    :param: version string
    :return: the raised version string
    :rtype: str

    >>> semver.bump_patch("3.4.5")
    '3.4.6'
    )r}   r   r   r   rb   s    r%   r   r     r:  r&   r   c                 v    t          t                              |                               |                    S )aU  
    Raise the prerelease part of the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.bump_prerelease` instead.

    :param version: version string
    :param token: defaults to 'rc'
    :return: the raised version string
    :rtype: str

    >>> semver.bump_prerelease('3.4.5', 'dev')
    '3.4.5-dev.1'
    )r}   r   r   r   rB   r   s     r%   r   r     s.      {  ))99%@@AAAr&   r   c                 v    t          t                              |                               |                    S )aW  
    Raise the build part of the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.bump_build` instead.

    :param version: version string
    :param token: defaults to 'build'
    :return: the raised version string
    :rtype: str

    >>> semver.bump_build('3.4.5-rc.1+build.9')
    '3.4.5-rc.1+build.10'
    )r}   r   r   r   r>  s     r%   r   r     s.      {  ))44U;;<<<r&   c                 x    t                               |           }t          |                                          S )a  
    Remove any prerelease and build metadata from the version string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.finalize_version` instead.

    .. versionadded:: 2.7.9
       Added :func:`finalize_version`

    :param version: version string
    :return: the finalized version string
    :rtype: str

    >>> semver.finalize_version('1.2.3-rc.5')
    '1.2.3'
    )r   r   r}   r   )rB   verinfos     r%   r   r     s1    $ ((Gw''))***r&   c                 d    t          t                              |           j        di |          S )a^  
    Replace one or more parts of a version and return the new string.

    .. deprecated:: 2.10.0
       Use :func:`semver.VersionInfo.replace` instead.

    .. versionadded:: 2.9.0
       Added :func:`replace`

    :param str version: the version string to replace
    :param dict parts: the parts to be updated. Valid keys are:
      ``major``, ``minor``, ``patch``, ``prerelease``, or ``build``
    :return: the replaced version string
    :raises: TypeError, if ``parts`` contains invalid keys
    :rtype: str

    >>> import semver
    >>> semver.replace("1.2.3", major=2, patch=10)
    '2.2.10'
    r!   )r}   r   r   r   )rB   r
  s     r%   r   r   *  s1    , {  ))1::E::;;;r&   c                     dddddd}| j         | j                            dd	g           t                              | j                  }t          ||| j                            }t           |                      S )
z
    Subcommand: Bumps a version.

    Synopsis: bump <PART> <VERSION>
    <PART> can be major, minor, patch, prerelease, or build

    :param args: The parsed arguments
    :type args: :class:`argparse.Namespace`
    :return: the new, bumped version
    r	   r
   r   r   r   r   Nbumpz-h)rD  parser
parse_argsr   r   rB   r   r}   )r[   maptabler3  r_   s       r%   r   r   D  s     ' H y 	~...


DL
)
)C3+,,Dttvv;;r&   c                 r    t                               | j                  rdS t          d| j        z            )z
    Subcommand: Checks if a string is a valid semver version.

    Synopsis: check <VERSION>

    :param args: The parsed arguments
    :type args: :class:`argparse.Namespace`
    NzInvalid version %r)r   r  rB   r|   r[   s    r%   r   r   a  s7     4<(( t
)DL8
9
99r&   c                 P    t          t          | j        | j                            S )z
    Subcommand: Compare two versions

    Synopsis: compare <VERSION1> <VERSION2>

    :param args: The parsed arguments
    :type args: :class:`argparse.Namespace`
    )r}   r   version1version2rI  s    r%   r   r   o  s      wt}dm44555r&   c                     t                               | j                  }t          |                    | j                            S )z
    Subcommand: Determines the next version, taking prereleases into account.

    Synopsis: nextver <VERSION> <PART>

    :param args: The parsed arguments
    :type args: :class:`argparse.Namespace`
    )r   r   rB   r}   r   r   )r[   rB   s     r%   cmd_nextverrN  {  s7     --Gw##DI..///r&   c                  f   t          j        t          t                    } |                     dddt
          z              |                                 }|                    dd          }|                    t          	           |                    d
d           |                    dd           |                    dd          }|                    t          	           |                    dd          }|                    dd          |                    dd          |                    dd          |                    dd          |                    dd          fD ]}|                    dd           |                    dd          }|                    t          	           |                    dd           |                    d d!          }|                    t          	           |                    dd           |                    d"d#           | S )$z
    Create an :class:`argparse.ArgumentParser` instance.

    :return: parser instance
    :rtype: :class:`argparse.ArgumentParser`
    )progdescriptionz	--versionrB   z	%(prog)s )actionrB   r   zCompare two versions)help)r_   rK  zFirst versionrL  zSecond versionrD  zBumps a versionzBump commands)titledestrw   z"Bump the major part of the versionrx   z"Bump the minor part of the versionry   z"Bump the patch part of the versionr~   z'Bump the prerelease part of the versionr   z"Bump the build part of the versionzVersion to raisecheckz,Checks if a string is a valid semver versionzVersion to checknextverz=Determines the next version, taking prereleases into account.r   z1One of 'major', 'minor', 'patch', or 'prerelease')argparseArgumentParser__package__r  add_argument__version__add_subparsers
add_parserset_defaultsr   r   r   rN  )rE  r*   parser_compareparser_bumpsbr   parser_checkparser_nextvers           r%   r   r     s_    $+7KKKF
I{[/H     	A\\)2H\IIN[111
AAA
1ABBB ,,v,=,>>K(+++		#	#/	#	G	GB 	g$HII
g$HII
g$HII
l)RSS
g$HII ; ; 	
y'9:::: <<D    L 9---i.@AAA \\W "  N [111	0BCCCH      Mr&   c                     t          | d          s'| j                                         t                      |                     |           S )a  
    Process the input from the CLI.

    :param args: The parsed arguments
    :type args: :class:`argparse.Namespace`
    :param parser: the parser instance
    :type parser: :class:`argparse.ArgumentParser`
    :return: result of the selected action
    :rtype: str
    r_   )rN   rE  
print_help
SystemExitr_   rI  s    r%   r   r     sF     4      ll 99T??r&   c                    	 t                      }|                    |           }||_        t          |          }|t	          |           dS # t
          t          f$ r'}t	          d|t          j                   Y d}~dS d}~ww xY w)z
    Entry point for the application script.

    :param list cliargs: Arguments to parse or None (=use :class:`sys.argv`)
    :return: error code
    :rtype: int
    rI  Nr   ERROR)filer   )	r   rF  rE  r   printr|   r9   sysstderr)cliargsrE  r[   resulterrs        r%   r   r     s      g ..&MMMq	"   gs,,,,qqqqqs   AA B BB__main__)r3   r4   )NNr  r  r,   )@r  
__future__r   rX  r   	functoolsr   r   rP   r  rl  rT   version_infor;   r<   r\  
__author____author_email____maintainer____maintainer_email____all__r   rN   __builtins__r   r}   bytesr   r7   r8   r$   r-   r2   r@   DeprecationWarningr   r   rn   objectr   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   rN  r   r   r   rO   doctesttestmodr!   r&   r%   <module>r     s   @ @ % % % % % %      $ $ $ $ $ $ $ $  				 



  
qQ	qQ "
" $o6+ B   w|U## !! ! !
  D:LIK# # #   
 C<LIK  D D D   , $?Q / / / /d H0 0 08  z z z z z& z z zz .AAA& & BA&:# # #6 H  * H! ! !0 E8,,,  -,. E8,,,  -,( ((;;;D D D <;D* H8 8 8" H8 8 8" H8 8 8" HB B B B$ H= = = =$ H+ + +* H< < <2  :: : :	6 	6 	6
0 
0 
03 3 3l  &   . zNNNGO r&   