%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/usr/share/python3/debpython/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/usr/share/python3/debpython/__pycache__/version.cpython-38.pyc

U

�zk^�7�@s�ddlZddlZddlmZddlmZddlmZddlm	Z	dZ
e�e
�Ze�dej
�Ze�e�Ze�d�Ze�d	�Zer�es�e�Ze�d
�es�e�dd�d
d�Zes�e�dd��dd�Zzedd�e�d�D��ZWnek
r�e�d�YnXzedd�e�d�D��ZWn ek
�r:e�d�YnXGdd�d�Zd'dd�Zdd�Z dd�Z!dd �Z"d!d"�Z#d#d$�Z$d(d%d&�Z%dS))�N)�environ��exists)�ConfigParser)�
GeneratorTypez(-)?(\d\.\d+)(?:(-)(\d\.\d+)?)?z�
    (?P<major>\d+)\.?
    (?P<minor>\d+)?\.?
    (?P<micro>\d+)?[.\s]?
    (?P<releaselevel>alpha|beta|candidate|final)?[.\s]?
    (?P<serial>\d+)?ZDEBPYTHON3_SUPPORTEDZDEBPYTHON3_DEFAULTz"/usr/share/python3/debian_defaults�DEFAULTzdefault-version�zsupported-versions�python�ccs|]}t|�VqdS�N��int��.0�i�r�'/usr/share/python3/debpython/version.py�	<genexpr>5sr�.zcannot read debian_defaultsccs*|]"}tdd�|���d�D��VqdS)css|]}t|�VqdSrr)r�jrrrr9sz<genexpr>.<genexpr>rN)�tuple�strip�splitrrrrr9s��,c@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) �VersionNc
Cs�t|ttf�r"d�dd�|D��}t|t�rLdD]}t||t||��q0dSt�}|d=|d=|r�t�	|�}	|	r||	�
���ngD]$\}}|dk	r�||dkr�|||<q�|��D],\}}|dkr�|dk	r�t|�}t|||�q�|j
s�td��dS)	Nrcss|]}t|�VqdSr��strrrrrrCsz#Version.__init__.<locals>.<genexpr>��major�minor�micro�releaselevel�serial�self�valuer!zmajor component is required)�
isinstancer�list�joinr�setattr�getattr�locals�
VERSION_RE�match�	groupdict�itemsr
r�
ValueError)
r#r$rrr r!r"�name�compr,rrr�__init__@s(


zVersion.__init__cCs(t|j�}|jdk	r$|d�|j�7}|S)z�Return major.minor or major string.

        >>> str(Version(major=3, minor=2, micro=1, releaselevel='final', serial=4))
        '3.2'
        >>> str(Version(major=2))
        '2'
        N�.{})rrr�format)r#�resultrrr�__str__Ws

zVersion.__str__cCstt|��Sr)�hash�repr)r#rrr�__hash__dszVersion.__hash__cCs<d�|�}dD]$}t||�}|s$q4|d�|�7}q|dS)z�Return full version string.

        >>> repr(Version(major=3, minor=2, micro=1, releaselevel='final', serial=4))
        "Version('3.2.1.final.4')"
        >>> repr(Version(major=2))
        "Version('2')"
        zVersion('{})r r!r"r3z'))r4r))r#r5r0r$rrr�__repr__gs

zVersion.__repr__cCs<t|�}|jdkr&|jt|�7_n|jt|�7_|S)z�Return next version.

        >>> Version('3.1') + 1
        Version('3.2')
        >>> Version('2') + '1'
        Version('3')
        N)rrrr
)r#�otherr5rrr�__add__ws

zVersion.__add__cCsXt|�}|jdkr,|jt|�8_|j}n|jt|�8_|j}|dkrTtd��|S)z�Return previous version.

        >>> Version('3.1') - 1
        Version('3.0')
        >>> Version('3') - '1'
        Version('2')
        Nrzcannot decrease version further)rrrr
r/)r#r;r5�newrrr�__sub__�s
zVersion.__sub__cCs|�|�dkS�Nr��
_Version__cmp�r#r;rrr�__eq__�szVersion.__eq__cCs|�|�dkSr?r@rBrrr�__lt__�szVersion.__lt__cCs|�|�dkSr?r@rBrrr�__le__�szVersion.__le__cCs|�|�dkSr?r@rBrrr�__gt__�szVersion.__gt__cCs|�|�dkSr?r@rBrrr�__ge__�szVersion.__ge__cCsNt|t�st|�}|jdks&|jdkr8|j|dd�dkS|j|dd�dkSdS)akCompare major.minor or major only (if minor is not set).

        >>> Version('2.6') << Version('2.7')
        True
        >>> Version('2.6') << Version('2.6.6')
        False
        >>> Version('3') << Version('2')
        False
        >>> Version('3.1') << Version('2')
        False
        >>> Version('2') << Version('3.2.1.alpha.3')
        True
        Nr��ignorerr �r%rrrArBrrr�
__lshift__�s

zVersion.__lshift__cCsNt|t�st|�}|jdks&|jdkr8|j|dd�dkS|j|dd�dkSdS)aoCompare major.minor or major only (if minor is not set).

        >>> Version('2.6') >> Version('2.7')
        False
        >>> Version('2.6.7') >> Version('2.6.6')
        False
        >>> Version('3') >> Version('2')
        True
        >>> Version('3.1') >> Version('2')
        True
        >>> Version('2.1') >> Version('3.2.1.alpha.3')
        False
        NrrHrr rJrBrrr�
__rshift__�s

zVersion.__rshift__cCs�t|t�st|�}dD]v}||kr&q�t||�p2d}t||�p@d}|dkrpddddd�}|�|d�}|�|d�}||krzq||k||kSdS)Nrrr!���������)ZalphaZbeta�	candidate�final)r%rr)�get)r#r;rIr0Zvalue1Zvalue2ZrmaprrrZ__cmp�s
z
Version.__cmp)NNNNNN)N)�__name__�
__module__�__qualname__r2r6r9r:r<r>rCrDrErFrGrKrLrArrrrr?s"�

rcs�t|t�rt|�}|r&t|�ddgkr0tt�}nj|ddkr@dn|d�|ddkrXdn|d���kr�t�tkrx�fnt��}nt��fdd�tD��}|r�tdd�|D��}n|d	kr�td
d�|D��}|S)aJReturn a set of requested and supported Python versions.

    :param available: if set to `True`, return installed versions only,
        if set to `False`, return requested versions that are not installed.
        By default returns all requested versions.
    :type available: bool

    >>> sorted(get_requested_versions([(3, 0), None]))
    [(3, 2), (3, 3)]
    >>> sorted(get_requested_versions('')) == sorted(SUPPORTED)
    True
    >>> sorted(get_requested_versions([None, None])) == sorted(SUPPORTED)
    True
    >>> get_requested_versions([(5, 0), None]) == set()
    True
    Nr)rr�)�crWc3s*|]"}�|kr�krnq|VqdSrr�r�v��maxv�minvrrrs

z)get_requested_versions.<locals>.<genexpr>css|]}td|�r|VqdS�z/usr/bin/python%d.%dNrrXrrrrs�Fcss|]}td|�s|VqdSr]rrXrrrrs�)r%r�parse_vranger&�set�	SUPPORTEDr)�vrangeZ	available�versionsrrZr�get_requested_versions�s

rccCs�|dkrdSt�|�}|s&td|��|��}t|��d�dkrdtdd�|d�d	�D��}||fSd}}|d
r~|d}n|d}|d}|r�tdd�|�d	�D��nd}|r�tdd�|�d	�D��nd}|r�|r�||kr�td|��||fS)
a�Return minimum and maximum Python version from given range.

    >>> parse_vrange('3.0-')
    ((3, 0), None)
    >>> parse_vrange('3.1-3.3')
    ((3, 1), (3, 3))
    >>> parse_vrange('3.2-4.0')
    ((3, 2), (4, 0))
    >>> parse_vrange('-3.7')
    (None, (3, 7))
    >>> parse_vrange('3.2')
    ((3, 2), (3, 2))
    >>> parse_vrange('') == parse_vrange('-') == (None, None)
    True
    )r
�-)NNzversion range is invalid: %sN�css|]}t|�VqdSrrrrrrr%szparse_vrange.<locals>.<genexpr>rVrrcss|]}t|�VqdSrrrrrrr/scss|]}t|�VqdSrrrrrrr0s)�RANGE_REr,r/�groupsr&�countrr)r$r,rgr\r[rrrr^s&

  r^cCs�d}}t�}|�d�D]p}|��}t�d|�}|rDd|�d�}qt�d|�}|rdd|�d�}qt�d|�}|r|�d|�d��qt|�dkr�|��}t	|�t	|�fS|s�|r�t
|�d}|r�t	|�nd|r�t	|�ndfS)	aParse X-Python3-Version.

    >>> parse_pycentral_vrange('>= 3.1')
    ((3, 1), None)
    >>> parse_pycentral_vrange('<< 4.0')
    (None, (4, 0))
    >>> parse_pycentral_vrange('3.1')
    ((3, 1), (3, 1))
    >>> parse_pycentral_vrange('3.1, 3.2')
    ((3, 1), None)
    Nrz>=\s*([\d\.]+)z%.3srVz<<\s*([\d\.]+)z	^[\d\.]+$r)r_rr�rer,�group�add�len�pop�getver�sorted)r$r\r[Z	hardcoded�itemr,Zverrrr�parse_pycentral_vrange8s*rqcCs�|d|dkrdkr$nndS|d|dkrLd�dd�|dD��S|ddkrtdd�dd�|dD��S|ddkr�d�d	d�|dD��dSd
d�dd�|dD��d�dd�|dD��fSdS)
aMReturn version range string from given range.

    >>> vrange_str(((3, 4), None))
    '3.4-'
    >>> vrange_str(((3, 4), (3, 6)))
    '3.4-3.6'
    >>> vrange_str(((3, 4), (4, 0)))
    '3.4-4.0'
    >>> vrange_str((None, (3, 7)))
    '-3.7'
    >>> vrange_str(((3, 5), (3, 5)))
    '3.5'
    >>> vrange_str((None, None))
    '-'
    rrVNrdrcss|]}t|�VqdSrrrrrrrvszvrange_str.<locals>.<genexpr>css|]}t|�VqdSrrrrrrrxscss|]}t|�VqdSrrrrrrrzsz%s-%scss|]}t|�VqdSrrrrrrr|scss|]}t|�VqdSrrrrrrr}s)r')rarrr�
vrange_strcs �rrcCs�t|t�r|St|ttf�s>t|dt�r>d�dd�|D��Sg}|D]4}t|t�r`|�|�qF|�d�dd�|D���qF|S)z�
    >>> vrepr(([3, 4], [3, 2]))
    ['3.4', '3.2']
    >>> vrepr(('2.6', '3.1'))
    ['2.6', '3.1']
    >>> vrepr('3.2')
    '3.2'
    >>> vrepr((3, 2))
    '3.2'
    rrcss|]}t|�VqdSrrrrrrr�szvrepr.<locals>.<genexpr>css|]}t|�VqdSrrrrrrr�s)r%rrr_r
r'�append)r$r5�versionrrr�vrepr�s

rucCs@|sdSt|t�r|dd�Stdd�|�dd�D��dd�S)z�Return pair of integers that represent version.

    >>> getver('3.2')
    (3, 2)
    >>> getver('3.1.4')
    (3, 1)
    >>> getver((3, 3, 1))
    (3, 3)
    >>> getver(None)
    ''
    r
N�css|]}t|�VqdSrrrrrrr�szgetver.<locals>.<genexpr>r)r%rr)r$rrrrn�s

rncCshg}g}t|�D]4}t|t�r&t|�}|tkr:|�|�q|�|�q|�t|��|rd|rdt|�S|S)a�Return sorted list of versions starting with default Python
    version (if available) then list of suppored versions greater than default
    one followed by reversed list of older versions.

    List of versions sorted this way can be used in Depends field.

    :param vrepr: return string represenatations of versions, by default the
        same format is used as in :param:`versions`

    >>> debsorted([(2, 6), (3, 1), (3, 2), (3, 3), (2, 7)])[0] == DEFAULT
    True
    >>> debsorted(('2.4', '3.2', '2.6', '2.7'))[-1]
    (2, 4)
    >>> debsorted(set([(2, 1), (2, 2)]))
    [(2, 2), (2, 1)]
    >>> debsorted([(2, 1), (2, 2)], return_str=True)
    ['2.2', '2.1']
    )	ror%rrnrrs�extend�reversedru)rbZ
return_strr5Zold_versionsrtrrr�	debsorted�s
ry)NN)N)&Zloggingri�osr�os.pathrZconfigparserr�typesrZ
RANGE_PATTERN�compilerf�VERBOSEr+Z	getLoggerrS�logrRZ
_supportedZ_defaultZ_config�read�replacerrr�	ExceptionZ	exceptionr`rrcr^rqrrrurnryrrrr�<module>sT
�



��&
(,+

Zerion Mini Shell 1.0