+
    ,jJ>                    N    ^ RI Ht ^ RIHtHtHtHt ^ RIHtH	t	  ! R R4      t
R# )    )annotations)ListOptionalTupleUnion)	PyVersionInvalidVersionErrorc                     ] tR t^t$ RtR]R&   R R lt]R R l4       t]	R R	 l4       t
R
 R ltR R ltR R ltR R ltR R ltR R ltR R ltR R lt]	R R l4       tR R ltR R ltR  R! lt]	R" R# l4       tR$ R% ltR& R' ltRDR( R) lltR* R+ lt]	R, R- l4       tR. R/ ltR0 R1 ltR2 R3 ltR4 R5 lt R6 R7 lt!R8 R9 lt"R: R; lt#R< R= lt$R> R? lt%R@ RA lt&RBt'RC# )EVersiona  
This class implements an order relation between version strings.
Version strings can contain the usual alphanumeric characters
(A-Za-z0-9), separated into segments by dots and underscores.
Empty segments (i.e. two consecutive dots, a leading/trailing
underscore) are not permitted. An optional epoch number - an
integer followed by '!' - can precede the actual version string
(this is useful to indicate a change in the versioning scheme itself).
Version comparison is case-insensitive.
r   _versionc                    V ^8  d   QhRRRR/# )   versionstrreturnNone )formats   "7lib/python3.14/site-packages/rattler/version/version.py__annotate__Version.__annotate__   s            c                	    \        V\        4      '       d   \        V4      V n        R# \	        R \        V4      P                  : R24      h)z/Version constructor received unsupported type  z for the `version` parameterN)
isinstancer   r   r   	TypeErrortype__name__)selfr   s   &&r   __init__Version.__init__   s@    gs##%g.DMA$w-BXBXA[[wx r   c                    V ^8  d   QhRRRR/# )r   
py_versionr   r   r   r   )r   s   "r   r   r      s      )  r   c                4    V P                  V 4      pWn        V# )z4Construct Rattler version from FFI PyVersion object.)__new__r   )clsr"   r   s   && r   _from_py_versionVersion._from_py_version   s     ++c"%r   c                   V ^8  d   QhRR/# )r   r   zOptional[str]r   )r   s   "r   r   r   &   s     % %} %r   c                6    V P                   P                  4       # )z
Gets the epoch of the version or `None` if the epoch was not defined.

Examples
--------
```python
>>> v = Version('2!1.0')
>>> v.epoch
2
>>>
```
)r   epochr   s   &r   r*   Version.epoch%   s     }}""$$r   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r   5        D DG Dr   c                \    \         P                  V P                  P                  4       4      # )z
Returns a new version where the major segment of this version has
been bumped.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.bump_major()
Version("2.0")
>>> v = Version('9d')
>>> v.bump_major()
Version("10a")
>>>
```
)r   r&   r   
bump_majorr+   s   &r   r1   Version.bump_major5   "    " ''(@(@(BCCr   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r   H   r/   r   c                \    \         P                  V P                  P                  4       4      # )z
Returns a new version where the minor segment of this version has
been bumped.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.bump_minor()
Version("1.1")
>>>
>>> Version("1").bump_minor()
Version("1.1")
>>>
```
)r   r&   r   
bump_minorr+   s   &r   r6   Version.bump_minorH   r3   r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r   [   s     D DG Dr   c                \    \         P                  V P                  P                  4       4      # )a&  
Returns a new version where the patch segment of this version has
been bumped.

Examples
--------
```python
>>> v = Version('1.0.5')
>>> v.bump_patch()
Version("1.0.6")
>>> v = Version('1.1.1e')
>>> v.bump_patch()
Version("1.1.2a")
>>>
>>> Version("1.5").bump_patch()
Version("1.5.1")
>>>
```
)r   r&   r   
bump_patchr+   s   &r   r:   Version.bump_patch[   s"    ( ''(@(@(BCCr   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r   q   s     C C7 Cr   c                \    \         P                  V P                  P                  4       4      # )z
Returns a new version where the last segment of this version has
been bumped.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.bump_last()
Version("1.1")
>>>
```
)r   r&   r   	bump_lastr+   s   &r   r>   Version.bump_lastq   s"     ''(?(?(ABBr   c                    V ^8  d   QhRRRR/# )r   indexintr   r   r   )r   s   "r   r   r      s     K K# K' Kr   c                ^    \         P                  V P                  P                  V4      4      # )a{  
Returns a new version where the last segment of this version has
been bumped.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.bump_segment(index=1)
Version("1.1")
>>>
>>> Version("1.5").bump_segment(-5) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
exceptions.VersionBumpError
>>> Version("1.5").bump_segment(5)
Version("1.5.0.0.0.1")
>>>
```
)r   r&   r   bump_segment)r   rA   s   &&r   rD   Version.bump_segment   s$    ( ''(B(B5(IJJr   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r      s     D DG Dr   c                \    \         P                  V P                  P                  4       4      # )aB  
Returns a new version where the last segment of this version has
been bumped with an alpha character. If the last segment contains a
character, nothing is added.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.with_alpha()
Version("1.0.0a0")
>>> v = Version('1.0.f')
>>> v.with_alpha()
Version("1.0.f")
>>>
```
)r   r&   r   
with_alphar+   s   &r   rH   Version.with_alpha   s"    $ ''(@(@(BCCr   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r      s     F Fg Fr   c                \    \         P                  V P                  P                  4       4      # )a1  
Returns a new version where the local segment of the version has been removed.
Leaves the version unchanged if it does not have a local segment.

Examples
--------
```python
>>> v = Version('1.0+3.4')
>>> v.remove_local()
Version("1.0")
>>> v = Version('1.0')
>>> v.remove_local()
Version("1.0")
>>>
```
)r   r&   r   remove_localr+   s   &r   rL   Version.remove_local   s"    " ''(B(B(DEEr   c                    V ^8  d   QhRRRR/# )r   lengthrB   r   r   r   )r   s   "r   r   r      s     P Ps Pw Pr   c                ^    \         P                  V P                  P                  V4      4      # )a   
Returns a new version that is extended with `0s` to the specified length.

Examples
--------
```python
>>> v = Version('1')
>>> v.extend_to_length(3)
Version("1.0.0")
>>> v = Version('4!1.2+3.4')
>>> v.extend_to_length(4)
Version("4!1.2.0.0+3.4")
>>>
```
)r   r&   r   extend_to_length)r   rO   s   &&r   rQ   Version.extend_to_length   s$      ''(F(Fv(NOOr   c                   V ^8  d   QhRR/# r   r   boolr   )r   s   "r   r   r      s     ) )4 )r   c                6    V P                   P                  4       # )a	  
Returns true if this version has a local segment defined.
The local part of a version is the part behind the (optional) `+`.

Examples
--------
```python
>>> v = Version('1.0+3.2-alpha0')
>>> v.has_local
True
>>> v2 = Version('1.0')
>>> v2.has_local
False
>>>
```
)r   	has_localr+   s   &r   rW   Version.has_local   s    $ }}&&((r   c                   V ^8  d   QhRR/# r   r   zList[List[Union[str, int]]]r   )r   s   "r   r   r      s     ( (5 (r   c                6    V P                   P                  4       # )z
Returns a list of segments of the version. It does not contain
the local segment of the version.

Examples
--------
```python
>>> v = Version("1.2dev.3-alpha4.5+6.8")
>>> v.segments()
[[1], [2, 'dev'], [3], [0, 'alpha', 4], [5]]
>>>
```
)r   segmentsr+   s   &r   r\   Version.segments   s     }}%%''r   c                   V ^8  d   QhRR/# rZ   r   )r   s   "r   r   r      s     . . ; .r   c                6    V P                   P                  4       # )z
Returns a list of local segments of the version. It does not
contain the non-local segment of the version.

Examples
--------
```python
>>> v = Version("1.2dev.3-alpha4.5+6.8")
>>> v.local_segments()
[[6], [8]]
>>>
```
)r   local_segmentsr+   s   &r   r`   Version.local_segments   s     }}++--r   c                   V ^8  d   QhRR/# )r   r   zOptional[Tuple[int, int]]r   )r   s   "r   r   r     s     . . 9 .r   c                6    V P                   P                  4       # )z
Returns the major and minor segments from the version.
Requires a minimum of 2 segments in version to be split
into major and minor, returns `None` otherwise.

Examples
--------
```python
>>> v = Version('1.0')
>>> v.as_major_minor()
(1, 0)
>>>
```
)r   as_major_minorr+   s   &r   rd   Version.as_major_minor  s     }}++--r   c                   V ^8  d   QhRR/# rT   r   )r   s   "r   r   r     s     & & &r   c                6    V P                   P                  4       # )z
Returns true if the version contains a component name "dev",
dev versions are sorted before non-dev version.

Examples
--------
```python
>>> v = Version('1.0.1dev')
>>> v.is_dev
True
>>> v_non_dev = Version('1.0.1')
>>> v_non_dev >= v
True
>>>
```
)r   is_devr+   s   &r   rh   Version.is_dev  s    $ }}##%%r   c                    V ^8  d   QhRRRR/# r   otherr   r   rU   r   )r   s   "r   r   r   )  s     9 9 9T 9r   c                L    V P                   P                  VP                   4      # )z
Checks if the version and local segment start
same as other version.

Examples
--------
```python
>>> v1 = Version('1.0.1')
>>> v2 = Version('1.0')
>>> v1.starts_with(v2)
True
>>>
```
)r   starts_withr   rl   s   &&r   rn   Version.starts_with)  s     }}((88r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r   :  s     = =W = =r   c                L    V P                   P                  VP                   4      # )a  
Checks if this version is compatible with other version.
Minor versions changes are compatible with older versions,
major version changes are breaking and will not be compatible.

Examples
--------
```python
>>> v1 = Version('1.0')
>>> v2 = Version('1.2')
>>> v_major = Version('2.0')
>>> v1.compatible_with(v2)
False
>>> v2.compatible_with(v1)
True
>>> v_major.compatible_with(v2)
False
>>> v2.compatible_with(v_major)
False
>>>
```
)r   compatible_withro   s   &&r   rs   Version.compatible_with:  s    . }},,U^^<<r   c                    V ^8  d   QhRRRR/# )r   nrB   r   r   r   )r   s   "r   r   r   S  s     W Wc W' Wr   c                    V P                   P                  V4      pV'       d   V P                  V4      # \        R4      h)a  
Pops `n` number of segments from the version and returns
the new version. Raises `InvalidVersionError` if version
becomes invalid due to the operation.

Examples
--------
```python
>>> v = Version('2!1.0.1')
>>> v.pop_segments() # `n` defaults to 1 if left empty
Version("2!1.0")
>>> v.pop_segments(2) # old version is still usable
Version("2!1")
>>> v.pop_segments(3) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
exceptions.InvalidVersionError: new Version must have atleast 1 valid
segment
>>>
```
z-new Version must have atleast 1 valid segment)r   pop_segmentsr&   r	   )r   rv   new_py_versions   && r   rx   Version.pop_segmentsS  s8    * 33A6((88%&UVVr   c               $    V ^8  d   QhRRRRRR/# )r   startrB   stopr   r   r   )r   s   "r   r   r   n  s&     H H3 Hc Hg Hr   c                    V P                   P                  W4      pV'       d   V P                  V4      # \        R4      h)a  
Returns new version with with segments ranging from `start` to `stop`.
`stop` is exclusive. Raises `InvalidVersionError` if the provided range
is invalid.

Examples
--------
```python
>>> v = Version('2!1.2.3')
>>> v.with_segments(0, 2)
Version("2!1.2")
>>>
```
zInvalid segment range provided)r   with_segmentsr&   r	   )r   r|   r}   ry   s   &&& r   r   Version.with_segmentsn  s8     44UA((88%&FGGr   c                   V ^8  d   QhRR/# r   r   rB   r   )r   s   "r   r   r     s     - -s -r   c                6    V P                   P                  4       # )z
Returns the number of segments in the version.
This does not include epoch or local segment of the version

Examples
--------
```python
>>> v = Version('2!1.2.3')
>>> v.segment_count
3
>>>
```
)r   segment_countr+   s   &r   r   Version.segment_count  s     }}**,,r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r     s     B BW Br   c                T    V P                  V P                  P                  4       4      # )z
Returns a new version with local segment stripped.

Examples
--------
```python
>>> v = Version('1.2.3+4.alpha-5')
>>> v.strip_local()
Version("1.2.3")
>>>
```
)r&   r   strip_localr+   s   &r   r   Version.strip_local  s"     $$T]]%>%>%@AAr   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r     s     & & &r   c                6    V P                   P                  4       # )zy
Returns the string representation of the version

Examples
--------
```python
>>> str(Version("1.2.3"))
'1.2.3'
>>>
```
r   as_strr+   s   &r   __str__Version.__str__  s     }}##%%r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     6 6# 6r   c                >    RV P                   P                  4        R2# )zt
Returns a representation of the version

Examples
--------
```python
>>> Version("1.2.3")
Version("1.2.3")
>>>
```
z	Version("z")r   r+   s   &r   __repr__Version.__repr__  s!     4==//12"55r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     ( (# (r   c                6    V P                   P                  4       # )z
Computes the hash of this instance.

Examples
--------
```python
>>> hash(Version("1.2.3")) == hash(Version("1.2.3"))
True
>>> hash(Version("1.2.3")) == hash(Version("3.2.1"))
False
>>> hash(Version("1")) == hash(Version("1.0.0"))
True
>>>
```
)r   __hash__r+   s   &r   r   Version.__hash__  s      }}%%''r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r          / /G / /r   c                4    V P                   VP                   8H  # )z
Returns True if this instance represents the same version as `other`.

Examples
--------
```python
>>> Version("1.2.3") == Version("1.2.3")
True
>>> Version("3.2.1") == Version("1.2.3")
False
>>> Version("1") == Version("1.0.0")
True
>>>
```
r   ro   s   &&r   __eq__Version.__eq__        }}..r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r     r   r   c                4    V P                   VP                   8g  # )z
Returns False if this instance represents the same version as `other`.

Examples
--------
```python
>>> Version("1.2.3") != Version("1.2.3")
False
>>> Version("3.2.1") != Version("1.2.3")
True
>>> Version("1") != Version("1.0.0")
False
>>>
```
r   ro   s   &&r   __ne__Version.__ne__  r   r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r          . .G . .r   c                4    V P                   VP                   8  # )aH  
Returns True if this instance should be ordered *after* `other`.

Examples
--------
```python
>>> Version("1.2.3") > Version("1.2.3")
False
>>> Version("1.2.4") > Version("1.2.3")
True
>>> Version("1.2.3.1") > Version("1.2.3")
True
>>> Version("3.2.1") > Version("1.2.3")
True
>>> Version("1") > Version("1.0.0")
False
>>>
```
r   ro   s   &&r   __gt__Version.__gt__      ( }}u~~--r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r     r   r   c                4    V P                   VP                   8  # )aJ  
Returns True if this instance should be ordered *before* `other`.

Examples
--------
```python
>>> Version("1.2.3") < Version("1.2.3")
False
>>> Version("1.2.3") < Version("1.2.4")
True
>>> Version("1.2.3") < Version("1.2.3.1")
True
>>> Version("3.2.1") < Version("1.2.3")
False
>>> Version("1") < Version("1.0.0")
False
>>>
```
r   ro   s   &&r   __lt__Version.__lt__  r   r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r   !  s     / /G / /r   c                4    V P                   VP                   8  # )a  
Returns True if this instance should be ordered *after* or at the same location
as `other`.

Examples
--------
```python
>>> Version("1.2.3") >= Version("1.2.3")
True
>>> Version("1.2.4") >= Version("1.2.3")
True
>>> Version("1.2.3.1") >= Version("1.2.3")
True
>>> Version("3.2.1") >= Version("1.2.3")
True
>>> Version("1.2.3") >= Version("3.2.1")
False
>>> Version("1") >= Version("1.0.0")
True
>>>
```
r   ro   s   &&r   __ge__Version.__ge__!  s    . }}..r   c                    V ^8  d   QhRRRR/# rk   r   )r   s   "r   r   r   :  s     / /G / /r   c                4    V P                   VP                   8*  # )ah  
Returns True if this instance should be ordered *before* or at the same
location as `other`.

Examples
--------
```python
>>> Version("1.2.3") <= Version("1.2.3")
True
>>> Version("1.2.3") <= Version("1.2.4")
True
>>> Version("1.2.3") <= Version("1.2.3.1")
True
>>> Version("3.2.1") <= Version("1.2.3")
False
>>> Version("1") <= Version("1.0.0")
True
>>>
```
r   ro   s   &&r   __le__Version.__le__:  s    * }}..r   r   N)   )(r   
__module____qualname____firstlineno____doc____annotations__r   classmethodr&   propertyr*   r1   r6   r:   r>   rD   rH   rL   rQ   rW   r\   r`   rd   rh   rn   rs   rx   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r   r   r   r      s   	    % %D&D&D,C K,D(F&P$ ) )&( . ." & &&9"=2W6H* - - B&6($/$/$.,.,/2/ /r   r   N)
__future__r   typingr   r   r   r   rattler.rattlerr   r	   r   r   r   r   <module>r      s    " / / :G	/ G	/r   