HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/incremental/__pycache__/__init__.cpython-38.pyc
U

�OX
=�@s�dZddlmZmZddlZddlZddlZejdkr<dZndZe	Z
dd�ZzeZ
Wnek
rpd	d
�Z
YnXdd�ZeGd
d�de��Ze�ZGdd�de�ZeGdd�de��Zdd�Zdd�ZddlmZdddgZdS)z0
Versions for Python packages.

See L{Version}.
�)�division�absolute_importN)�rFTcCs`t|ttf�std|��tr>t|t�r2|�d�S|�d�nt|t�rR|�d�S|�d�|S)a	
    Convert C{bytes} or C{unicode} to the native C{str} type, using ASCII
    encoding if conversion is necessary.

    @raise UnicodeError: The input string is not ASCII encodable/decodable.
    @raise TypeError: The input is neither C{bytes} nor C{unicode}.
    z%r is neither bytes nor unicode�ascii)�
isinstance�bytes�unicode�	TypeError�_PY3�decode�encode)�s�r�6/usr/lib/python3/dist-packages/incremental/__init__.py�
_nativeStrings




rcCs ||krdS||krdSdSdS)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�Nr)�a�brrr�_cmp7s
rcCs`ts|Sdd�}dd�}dd�}dd�}d	d
�}dd�}||_||_||_||_||_||_|S)
z�
    Class decorator that ensures support for the special C{__cmp__} method.

    On Python 2 this does nothing.

    On Python 3, C{__eq__}, C{__lt__}, etc. methods are added to the class,
    relying on C{__cmp__} to implement their comparisons.
    cSs|�|�}|tkr|S|dkS�Nr��__cmp__�NotImplemented��self�other�crrr�__eq__Ss
z_comparable.<locals>.__eq__cSs|�|�}|tkr|S|dkSrrrrrr�__ne__Ys
z_comparable.<locals>.__ne__cSs|�|�}|tkr|S|dkSrrrrrr�__lt___s
z_comparable.<locals>.__lt__cSs|�|�}|tkr|S|dkSrrrrrr�__le__es
z_comparable.<locals>.__le__cSs|�|�}|tkr|S|dkSrrrrrr�__gt__ks
z_comparable.<locals>.__gt__cSs|�|�}|tkr|S|dkSrrrrrr�__ge__qs
z_comparable.<locals>.__ge__)r
r r"r!r#rr)�klassrrr r!r"r#rrr�_comparableFs
r%c@seZdZdZdd�ZdS)�_infz:
    An object that is bigger than all other objects.
    cCs|tkrdSdS)z�
        @param other: Another object.
        @type other: any

        @return: 0 if other is inf, 1 otherwise.
        @rtype: C{int}
        rr)r&)rrrrrr�sz_inf.__cmp__N)�__name__�
__module__�__qualname__�__doc__rrrrrr&�sr&c@seZdZdZdS)�IncomparableVersionsz-
    Two versions could not be compared.
    N)r'r(r)r*rrrrr+�sr+c@s�eZdZdZd#dd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZeZdd�Zdd �Zd!d"�ZdS)$�Versiona*
    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, with support for "local versions" which may include a SVN
    revision or Git SHA1 hash.
    NcCsv|r|rtd��n|r.|s.|}tjdtdd�|dkrN|sF|sF|sF|rNtd��||_||_||_||_||_||_	dS)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 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�dev)rr5r6r7r8r9�
prereleaser:rrr�__init__�s"
�zVersion.__init__cCstjdtdd�f|jS)NzuAccessing incremental.Version.prerelease was deprecated in Incremental 16.9.0. Use Version.release_candidate instead.r-r.)r2r3r4r9�rrrrr;�s
�zVersion.prereleasecCsB|��}|��}|s2|��}|r>|dt|�7}n|d|7}|S)zx
        Return a string in canonical short version format,
        <major>.<minor>.<micro>[+rSVNVer/+gitsha1].
        z+r�+)�base�_getGitVersion�_getSVNVersionr)rr
�gitver�svnverrrr�short�sz
Version.shortcCs|��S)aT
        Return a PEP440-compatible "local" representation of this L{Version}.

        This includes a SVN revision or Git commit SHA1 hash, if available.

        Examples:

          - 14.4.0+r1223
          - 1.2.3rc1+rb2e812003b5d5fcf08efd1dffed6afa98d44ac8c
          - 12.10.1
          - 3.4.8rc2
          - 11.93.0rc1dev3
        )rDr=rrr�local�sz
Version.localcCs|��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?r=rrr�public�szVersion.publiccCs`|jdkr|jS|jdkr d}nd|jf}|jdkr<d}nd|jf}d|j|j|j||fS)zF
        Like L{short}, but without the +rSVNVer or @gitsha1.
        r0N�zrc%szdev%sz%r.%d.%d%s%s)r6r9r:r7r8)rZrcr:rrrr?s


�zVersion.basec	Cs�|��}|rd|}|��}|r(d|}|jdkr8d}nd|jf}|jdkrTd}nd|jf}d|jj|j|j|j|j	|||p�|fS)Nz  #rGz, release_candidate=%rz, dev=%rz%s(%r, %r, %d, %d%s%s)%s)
�_formatGitVersion�_formatSVNVersionr9r:�	__class__r'r5r6r7r8)rrBrCr9r:rrr�__repr__s0
�
�zVersion.__repr__cCsd|j|��fS)Nz[%s, version %s]�r5rDr=rrr�__str__:s�zVersion.__str__c	Cs�t||j�stS|j��|j��kr8td|j|jf��|jdkrHt}n|j}|jdkr^t}n|j}|j	dkrtt}n|j	}|jdkr�t}n|j}|jdkr�t}n|j}|j	dkr�t}n|j	}t
||j|j||f||j|j||f�}|S)a�
        Compare two versions, considering major versions, minor versions, micro
        versions, then release candidates. 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.

        @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 != %rr0N)
rrJrr5�lowerr+r6r&r9r:rr7r8)	rrr6r9r:Z
othermajorZotherrcZotherdev�xrrrr?sL
�





���
zVersion.__cmp__c
Cs�tj�tj�|d��}t|d��}|����}W5QRX|�d�r�ttj�tj�||�d�d����}|��}|��W5QR�SQRX|S)NZHEAD�rzref: � r)	�os�path�abspath�join�open�read�strip�
startswith�split)rZ	directoryZheadFile�fZheadContentZcommitrrr�_parseGitDir�s
��zVersion._parseGitDircCs�tj�|j�}|r�tj�|j�}tj�tj�	|d��}dt�
|�krX|�tj�	|d��Stj�tj�	|d��}||krzdSdt�
|�kr�|�tj�	|d��S|}qXdS)zQ
        Given a package directory, walk up and find the git commit sha.
        z..z.gitN)�sys�modules�getr5rRrS�dirname�__file__rTrU�listdirr\)r�modZbasepathZupOneZ	upOneMorerrrr@�szVersion._getGitVersioncCsPddlm}||�j}|jD].}t|d�r|�d�}|dk	r|�d�SqdS)z�
        Given a readable file object which represents a .svn/entries file in
        format version 4, return the revision as a string.  We do this by
        reading first XML element in the document that has a 'revision'
        attribute.
        r)�parse�getAttributeZrevisionNr)Zxml.dom.minidomrdZdocumentElementZ
childNodes�hasattrrer)r�entriesFilerd�docZnodeZrevrrr�_parseSVNEntries_4�s



zVersion._parseSVNEntries_4cCs$|��|��|��|����S)z�
        Given a readable file object which represents a .svn/entries file in
        format version 8, return the revision as a string.
        )�readlinerX)rrgrrr�_parseSVNEntries_8�szVersion._parseSVNEntries_8c		Cs�tj�|j�}|r�tj�tj�|j�d�}tj�	|�s:dStj�|d�}tj�	|�r�t
|d��}|����}W5QRXt
|d|�d�d�}n|j}|dkr�dStj�|d�}t
|d�}zz||�W�WS|��XWnYdSXdS)	a?
        Figure out the SVN revision number based on the existence of
        <package>/.svn/entries, and its contents. This requires discovering the
        format version from the 'format' file and parsing the entries file
        accordingly.

        @return: None or string containing SVN Revision number.
        z.svnN�format�rbZ_parseSVNEntries_rsUnknown�entries)r]r^r_r5rRrSrUr`ra�existsrVrWrX�getattrr�_parseSVNEntriesTenPlus�close)	rrcZsvnZ
formatFileZfObjrl�parserrgrnrrrrA�s0	�
zVersion._getSVNVersioncCs|��}|dkrdSd|fS)NrGz
 (SVN r%s))rA�rZverrrrrI�szVersion._formatSVNVersioncCs|��}|dkrdSd|fS)NrGz	 (Git %s))r@rtrrrrH�szVersion._formatGitVersion)NNN)r'r(r)r*r<�propertyr;rDrErFr?rKrMrr\r@rirkZ_parseSVNEntries_9rqrArIrHrrrrr,�s.�
'

 B*r,cCsd|j|��f}|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.
    z%s %srL)�version�resultrrr�getVersionString�srxc
Cs�|sdSddlm}|�|�}|��|��D]P}|ddkr.i}t|d��}t|��|�W5QRX|d��|j_	dSq.t
d��dS)	zF
    Get the version from the package listed in the Distribution.
    Nr)�build_pyr�_versionr-�__version__zNo _version.py found.)Zdistutils.commandryZfinalize_optionsZfind_all_modulesrV�execrWrFZmetadatarv�	Exception)Zdist�keyword�valueryZ
sp_command�itemZversion_filer[rrr�_get_version
s
r�r)r{r{)r*Z
__future__rrrRr]r2�version_infor
�strrrZcmpr�	NameErrorr%�objectr&r	r+r,rxr�rzr{�__all__rrrr�<module>s4
>b