HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/numpy/lib/__pycache__/_version.cpython-310.pyc
o

���g��@s$dZddlZdgZGdd�d�ZdS)aUtility to compare (NumPy) version strings.

The NumpyVersion class allows properly comparing numpy version strings.
The LooseVersion and StrictVersion classes that distutils provides don't
work; they don't recognize anything like alpha/beta/rc/dev versions.

�N�NumpyVersionc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)raParse and compare numpy version strings.

    NumPy has the following versioning scheme (numbers given are examples; they
    can be > 9 in principle):

    - Released version: '1.8.0', '1.8.1', etc.
    - Alpha: '1.8.0a1', '1.8.0a2', etc.
    - Beta: '1.8.0b1', '1.8.0b2', etc.
    - Release candidates: '1.8.0rc1', '1.8.0rc2', etc.
    - Development versions: '1.8.0.dev-f1234afa' (git commit hash appended)
    - Development versions after a1: '1.8.0a1.dev-f1234afa',
                                     '1.8.0b2.dev-f1234afa',
                                     '1.8.1rc1.dev-f1234afa', etc.
    - Development versions (no git hash available): '1.8.0.dev-Unknown'

    Comparing needs to be done against a valid version string or other
    `NumpyVersion` instance. Note that all development versions of the same
    (pre-)release compare equal.

    .. versionadded:: 1.9.0

    Parameters
    ----------
    vstring : str
        NumPy version string (``np.__version__``).

    Examples
    --------
    >>> from numpy.lib import NumpyVersion
    >>> if NumpyVersion(np.__version__) < '1.7.0':
    ...     print('skip')
    >>> # skip

    >>> NumpyVersion('1.7')  # raises ValueError, add ".0"
    Traceback (most recent call last):
        ...
    ValueError: Not a valid numpy version string

    cCs�||_t�d|�}|std��|��|_dd�|j�d�D�\|_|_|_	t
|�|��kr1d|_n;t�d||��d��}t�d||��d��}t�d	||��d��}d
d�|||fD�}|ri|d��|_nd|_t
t�d
|��|_dS)Nz
\d+\.\d+\.\d+z Not a valid numpy version stringcSsg|]}t|��qS�)�int)�.0�xrr�=/usr/local/lib/python3.10/dist-packages/numpy/lib/_version.py�
<listcomp>>sz)NumpyVersion.__init__.<locals>.<listcomp>�.�finalza\dzb\dzrc\dcSsg|]}|dur|�qS)Nr)r�mrrrrFsr�z.dev)�vstring�re�match�
ValueError�group�version�split�major�minor�bugfix�len�end�pre_release�bool�search�
is_devversion)�selfr
�ver_main�alpha�beta�rc�pre_relrrr�__init__7s$

�zNumpyVersion.__init__cCs�|j|jkr2|j|jkr$|j|jkrd}|S|j|jkr d}|Sd}|S|j|jkr.d}|Sd}|S|j|jkr<d}|Sd}|S)zCompare major.minor.bugfixr����)rrr�r�other�vercmprrr�_compare_versionNs(��
����zNumpyVersion._compare_versioncCsT|j|jkr
d}|S|jdkrd}|S|jdkrd}|S|j|jkr&d}|Sd}|S)zCompare alpha/beta/rc/final.rr
r$r%)rr&rrr�_compare_pre_releasecs

�
���z!NumpyVersion._compare_pre_releasecCsvt|ttf�std��t|t�rt|�}|�|�}|dkr9|�|�}|dkr9|j|jur0d}|S|jr7d}|Sd}|S)Nz,Invalid object to compare with NumpyVersion.rr%r$)�
isinstance�strrrr)r*rr&rrr�_comparers 


��zNumpyVersion._comparecCs|�|�dkS�Nr�r-�rr'rrr�__lt__��zNumpyVersion.__lt__cCs|�|�dkSr.r/r0rrr�__le__�r2zNumpyVersion.__le__cCs|�|�dkSr.r/r0rrr�__eq__�r2zNumpyVersion.__eq__cCs|�|�dkSr.r/r0rrr�__ne__�r2zNumpyVersion.__ne__cCs|�|�dkSr.r/r0rrr�__gt__�r2zNumpyVersion.__gt__cCs|�|�dkSr.r/r0rrr�__ge__�r2zNumpyVersion.__ge__cCs
d|jS)NzNumpyVersion(%s))r
)rrrr�__repr__�s
zNumpyVersion.__repr__N)�__name__�
__module__�__qualname__�__doc__r#r)r*r-r1r3r4r5r6r7r8rrrrrs()r<r�__all__rrrrr�<module>s