
    /JfU+                     6   d Z ddlmZmZ ddlZddlZddlmZmZm	Z	m
Z
mZmZ  e	dd          ZerddlmZ dd	lmZ neZej        d
k    rd ZneZ G d de          Z e            Z G d de          Z G d de          Zd Zd ZddlmZ d Z g dZ!dS )z0
Versions for Python packages.

See L{Version}.
    )divisionabsolute_importN)TYPE_CHECKINGAnyTypeVarUnionOptionalDict_TT)contravariant)Literal)Distribution   c                 &    | |k     rdS | |k    rdS dS )z
        Compare two objects.

        Returns a negative number if C{a < b}, zero if they are equal, and a
        positive number if C{a > b}.
        r       )abs     W/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/incremental/__init__.py_cmpr   !   s%     q552!VV11    c                   J    e Zd ZdZd Zej        dk    rd Zd Zd Z	d Z
dS dS )	_Infz:
    An object that is bigger than all other objects.
    c                     |t           u rdS dS )z
        @param other: Another object.
        @type other: any

        @return: 0 if other is inf, 1 otherwise.
        @rtype: C{int}
        r   r   )_infselfothers     r   __cmp__z_Inf.__cmp__>   s     D==1qr   r   c                 4    |                      |          dk     S Nr   r!   r   s     r   __lt__z_Inf.__lt__L       <<&&**r   c                 4    |                      |          dk    S r#   r$   r   s     r   __le__z_Inf.__le__O       <<&&!++r   c                 4    |                      |          dk    S r#   r$   r   s     r   __gt__z_Inf.__gt__R   r&   r   c                 4    |                      |          dk    S r#   r$   r   s     r   __ge__z_Inf.__ge__U   r)   r   N)__name__
__module____qualname____doc__r!   sysversion_infor%   r(   r+   r-   r   r   r   r   r   9   s         
 
 
 4	+ 	+ 	+	, 	, 	,	+ 	+ 	+	, 	, 	, 	, 	,  r   r   c                       e Zd ZdZdS )IncomparableVersionsz-
    Two versions could not be compared.
    N)r.   r/   r0   r1   r   r   r   r5   r5   \   s           r   r5   c                       e Zd ZdZ	 	 	 	 ddZed             Zd ZeZeZ	eZ
d Zd Zd Zej        d	k    rd
 Zd Zd Zd Zd Zd ZdS dS )Versionz
    An encapsulation of a version for a project, with support for outputting
    PEP-440 compatible version strings.

    This class supports the standard major.minor.micro[rcN] scheme of
    versioning.
    Nc	                    |r|rt          d          |r |s|}t          j        dt          d           |dk    r|s|s|s|s|rt          d          || _        || _        || _        || _        || _        || _	        || _
        dS )a  
        @param package: Name of the package that this is a version of.
        @type package: C{str}
        @param major: The major version number.
        @type major: C{int} or C{str} (for the "NEXT" symbol)
        @param minor: The minor version number.
        @type minor: C{int}
        @param micro: The micro version number.
        @type micro: C{int}
        @param release_candidate: The release candidate number.
        @type release_candidate: C{int}
        @param prerelease: The prerelease number. (Deprecated)
        @type prerelease: C{int}
        @param post: The postrelease number.
        @type post: C{int}
        @param dev: The development release number.
        @type dev: C{int}
        z Please only return one of these.zvPassing prerelease to incremental.Version was deprecated in Incremental 16.9.0. Please pass release_candidate instead.   
stacklevelNEXTz;When using NEXT, all other values except Package must be 0.N)
ValueErrorwarningswarnDeprecationWarningpackagemajorminormicrorelease_candidatepostdev)	r   rA   rB   rC   rD   rE   
prereleaserF   rG   s	            r   __init__zVersion.__init__k   s    :  
	 
	?@@@ 	 1 	 *M- #    F??  !2 d c  Q   


!2	r   c                 J    t          j        dt          d          f | j        S )NzuAccessing incremental.Version.prerelease was deprecated in Incremental 16.9.0. Use Version.release_candidate instead.r9   r:   )r>   r?   r@   rE   r   s    r   rH   zVersion.prerelease   s8    1 	
 	
 	
 	 	 %%r   c                     | j         dk    r| j         S | j        d}n
d| j        }| j        d}n
d| j        }| j        d}n
d| j        }d| j         | j        | j        |||fz  S )z
        Return a PEP440-compatible "public" representation of this L{Version}.

        Examples:

          - 14.4.0
          - 1.2.3rc1
          - 14.2.1rc1dev9
          - 16.04.0dev0
        r<   N z.rcz.postz.devz%r.%d.%d%s%s%s)rB   rE   rF   rG   rC   rD   )r   rcrF   rG   s       r   publiczVersion.public   s     ::!)BB * !224B9DD  !%		+D8CC  #hh(C4:tz4:r4QT"UUUr   c           	          | j         d}n
d| j         }| j        d}n
d| j        }| j        d}n
d| j        }d| j        j        | j        | j        | j        | j        |||fz  S )NrM   z, release_candidate=z, post=z, dev=z%s(%r, %r, %d, %d%s%s%s))	rE   rF   rG   	__class__r.   rA   rB   rC   rD   )r   rE   rF   rG   s       r   __repr__zVersion.__repr__   s    !) " * =A<R<R T9DD  #'))-D8CC  !%*C)N#LJJJ	-
 	
 		
r   c                 B    d| j         d|                                 dS )N[z
, version ]rA   shortrK   s    r   __str__zVersion.__str__   s!     %)\\\4::<<<<@@r   c           	         t          || j                  st          S | j                                        |j                                        k    rt          | j        d|j                  | j        dk    rt          }n| j        }| j        t          }n| j        }| j	        d}n| j	        }| j
        t          }n| j
        }|j        dk    rt          }n|j        }|j        t          }n|j        }|j	        d}n|j	        }|j
        t          }	n|j
        }	t          || j        | j        |||f||j        |j        |||	f          }
|
S )aw  
        Compare two versions, considering major versions, minor versions, micro
        versions, then release candidates, then postreleases, then dev
        releases. Package names are case insensitive.

        A version with a release candidate is always less than a version
        without a release candidate. If both versions have release candidates,
        they will be included in the comparison.

        Likewise, a version with a dev release is always less than a version
        without a dev release. If both versions have dev releases, they will
        be included in the comparison.

        @param other: Another version.
        @type other: L{Version}

        @return: NotImplemented when the other object is not a Version, or one
            of -1, 0, or 1.

        @raise IncomparableVersions: when the package names of the versions
            differ.
        z != r<   Nr   )
isinstancerQ   NotImplementedrA   lowerr5   rB   r   rE   rF   rG   r   rC   rD   )r   r    rB   rE   rF   rG   
othermajorotherrc	otherpostotherdevxs              r   r!   zVersion.__cmp__   sb   . %00 	"!!<5=#6#6#8#888&T\\\5=='QRRR:EEJE!) $ $ 69DD9D8CC(C;&  JJJ"*GG-G:II
I9HHyHDJ
,=tSIek7IxP
 
 r   r   c                 N    |                      |          }|t          u r|S |dk    S r#   r!   r[   r   r    cs      r   __eq__zVersion.__eq__;  ,    U##AN""6Mr   c                 N    |                      |          }|t          u r|S |dk    S r#   rc   rd   s      r   __ne__zVersion.__ne__A  rg   r   c                 N    |                      |          }|t          u r|S |dk     S r#   rc   rd   s      r   r%   zVersion.__lt__G  ,    U##AN""q5Lr   c                 N    |                      |          }|t          u r|S |dk    S r#   rc   rd   s      r   r(   zVersion.__le__M  rg   r   c                 N    |                      |          }|t          u r|S |dk    S r#   rc   rd   s      r   r+   zVersion.__gt__S  rk   r   c                 N    |                      |          }|t          u r|S |dk    S r#   rc   rd   s      r   r-   zVersion.__ge__Y  rg   r   )NNNN)r.   r/   r0   r1   rI   propertyrH   rO   baserW   localrR   rX   r!   r2   r3   rf   ri   r%   r(   r+   r-   r   r   r   r7   r7   b   s&         5 5 5 5n & & X&V V V> DEE
 
 
8A A AH H HT 4	 	 		 	 		 	 		 	 		 	 		 	 	 	 	A  r   r7   c                 B    | j         d|                                 }|S )z
    Get a friendly string for the given version object.

    @param version: A L{Version} object.
    @return: A string containing the package and short version number.
     rV   )versionresults     r   getVersionStringrv   `  s#      9FMr   c                    |sdS ddl m} |                    |           }|                                 |                                D ]}|d         dk    rxi }t	          |d                   5 }t          |                                |           ddd           n# 1 swxY w Y   |d                                         | j        _	         dS t          d          )	zF
    Get the version from the package listed in the Distribution.
    Nr   )build_pyr   _versionr9   __version__zNo _version.py found.)distutils.commandrx   finalize_optionsfind_all_modulesopenexecreadrO   metadatart   	Exception)distkeywordvaluerx   
sp_commanditemversion_filefs           r   _get_versionr   k  s+     ******""4((J!!!++--  7j  Ld1g -!QVVXX|,,,- - - - - - - - - - - - - - - %1$?$F$F$H$HDM!44 ! +
,
,,s   -#BB 	#B 	r   )rz   c                  (    t          j                    S )N)rz   rO   r   r   r   _setuptools_versionr     s    r   )rz   r7   rv   )"r1   
__future__r   r   r2   r>   typingr   r   r   r   r	   r
   r   typing_extensionsr   distutils.distr   _Distributionobjectr3   r   cmpr   r   	TypeErrorr5   r7   rv   r   ry   rz   r   __all__r   r   r   <module>r      s    1 0 0 0 0 0 0 0 



  E E E E E E E E E E E E E E E E WT&&&  ))))))<<<<<<< Md     D, , , , ,6 , , ,@ tvv    9   { { { { {f { { {|  - - -2 " ! ! ! ! !      9
8
8r   