%PDF- %PDF-
Mini Shell

Mini Shell

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

o

年f�7�@s�ddlZddlZddlmZddlmZddlmZddlm	Z	dZ
e�e
�Ze�dej
�Ze�e�Ze�d�Ze�d	�ZerAesae�Ze�d
�esUe�dd�d
d�Zesae�dd��dd�Zzedd�e�d�D��ZWney}e�d�Ynwzedd�e�d�D��ZWney�e�d�YnwGdd�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+)?�DEBPYTHON3_SUPPORTED�DEBPYTHON3_DEFAULTz"/usr/share/python3/debian_defaults�DEFAULTzdefault-version�zsupported-versions�python�cc��|]}t|�VqdS�N��int��.0�i�r�'/usr/share/python3/debpython/version.py�	<genexpr>5��r�.zcannot read debian_defaultsccs,�|]}tdd�|���d�D��VqdS)csr
rr)r�jrrrr9rz<genexpr>.<genexpr>rN)�tuple�strip�splitrrrrr9s�$��,c@s�eZdZ		ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) �VersionNc
Cs�t|ttf�rd�dd�|D��}t|t�r&dD]}t||t||��qdSt�}|d=|d=|rSt�	|�}	|	r>|	�
���ngD]\}}|durR||durR|||<q@|��D]\}}|dkrg|durgt|�}t|||�qW|j
sutd��dS)	Nrcsr
r��strrrrrrCrz#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�itemsrr"�
ValueError)
r'r(r"r#r$r%r&�name�compr0rrr�__init__@s,

��zVersion.__init__cCs(t|j�}|jdur|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�.{})r r"r#�format)r'�resultrrr�__str__Ws

zVersion.__str__cCstt|��Sr)�hash�repr)r'rrr�__hash__dszVersion.__hash__cCsBd�|�}dD]}t||�}|s|dS|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&r7z'))r8r-)r'r9r4r(rrr�__repr__gs

�zVersion.__repr__cCs>t|�}|jdur|jt|�7_|S|jt|�7_|S)z�Return next version.

        >>> Version('3.1') + 1
        Version('3.2')
        >>> Version('2') + '1'
        Version('3')
        N)rr#r"r)r'�otherr9rrr�__add__ws
�zVersion.__add__cCsXt|�}|jdur|jt|�8_|j}n|jt|�8_|j}|dkr*td��|S)z�Return previous version.

        >>> Version('3.1') - 1
        Version('3.0')
        >>> Version('3') - '1'
        Version('2')
        Nrzcannot decrease version further)rr#r"rr3)r'r?r9�newrrr�__sub__�s
zVersion.__sub__cCs|�|�dkS�Nr��
_Version__cmp�r'r?rrr�__eq__��zVersion.__eq__cCs|�|�dkSrCrDrFrrr�__lt__�rHzVersion.__lt__cCs|�|�dkSrCrDrFrrr�__le__�rHzVersion.__le__cCs|�|�dkSrCrDrFrrr�__gt__�rHzVersion.__gt__cCs|�|�dkSrCrDrFrrr�__ge__�rHzVersion.__ge__cCsJt|t�s	t|�}|jdus|jdur|j|dd�dkS|j|dd�dkS)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)rr#rErFrrr�
__lshift__��

zVersion.__lshift__cCsJt|t�s	t|�}|jdus|jdur|j|dd�dkS|j|dd�dkS)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
        Nr#rMrr$rOrFrrr�
__rshift__�rQzVersion.__rshift__cCs�t|t�s	t|�}dD]<}||krdSt||�pd}t||�p!d}|dkr9ddddd�}|�|d�}|�|d�}||kr>q||k||kSdS)Nr!rr%���������)�alpha�beta�	candidate�final)r)rr-�get)r'r?rNr4�value1�value2�rmaprrr�__cmp�s 

�z
Version.__cmp)NNNNNNr)�__name__�
__module__�__qualname__r6r:r=r>r@rBrGrIrJrKrLrPrRrErrrrr?s"
�
rcs�t|t�r	t|�}|rt|�ddgkrtt�}n5|ddur dn|d�|ddur,dn|d���krAt�tvr<�fnt��}nt��fdd�tD��}|rZtdd�|D��}|S|d	urgtd
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�)�crcc3s,�|]}�|kr�krnn|VqdSrr�r�v��maxv�minvrrrs�*z)get_requested_versions.<locals>.<genexpr>css �|]}td|�r|VqdS�z/usr/bin/python%d.%dNrrdrrrr��
�Fcss �|]}td|�s|VqdSrirrdrrrrrj)r)r �parse_vranger*�set�	SUPPORTEDr)�vrange�	available�versionsrrfr�get_requested_versions�s

�rqcCs�|dvrdSt�|�}|std|��|��}t|��d�dkr2tdd�|d�d	�D��}||fSd}}|d
r?|d}n|d}|d}|rUtdd�|�d	�D��nd}|retdd�|�d	�D��nd}|ru|ru||krutd|��||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�csr
rrrrrrr%rzparse_vrange.<locals>.<genexpr>rbrrcsr
rrrrrrr/rcsr
rrrrrrr0r)�RANGE_REr0r3�groupsr*�countrr)r(r0rvrhrgrrrrks&

  rkcCs�d}}t�}|�d�D]8}|��}t�d|�}|r"d|�d�}qt�d|�}|r2d|�d�}qt�d|�}|rD|�d|�d��qt|�dkrW|��}t	|�t	|�fS|sa|rat
|�d}|rgt	|�nd|rot	|�fSdfS)	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%.3srbz<<\s*([\d\.]+)z	^[\d\.]+$r)rlrr�rer0�group�add�len�pop�getver�sorted)r(rhrg�	hardcoded�itemr0�verrrr�parse_pycentral_vrange8s,�"r�cCs�|d|durdurdS|d|dkr$d�dd�|dD��S|ddur8dd�dd�|dD��S|ddurLd�d	d�|dD��dSd
d�dd�|dD��d�dd�|dD��fS)
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))
    '-'
    rrbNrrrcsr
rrrrrrrvrzvrange_str.<locals>.<genexpr>csr
rrrrrrrxrcsr
rrrrrrrzrz%s-%scsr
rrrrrrr|rcsr
rrrrrrr}r)r+)rnrrr�
vrange_strcs��r�cCs�t|t�r|St|ttf�st|dt�rd�dd�|D��Sg}|D]}t|t�r0|�|�q#|�d�dd�|D���q#|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'
    rrcsr
rrrrrrr�rzvrepr.<locals>.<genexpr>csr
rrrrrrr�r)r)r rrlrr+�append)r(r9�versionrrr�vrepr�s

r�cCs@|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�csr
rrrrrrr�rzgetver.<locals>.<genexpr>r)r)rr)r(rrrr}�s

"r}cCshg}g}t|�D]}t|t�rt|�}|tkr|�|�q|�|�q|�t|��|r2|r2t|�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']
    )	r~r)r r}r	r��extend�reversedr�)rp�
return_strr9�old_versionsr�rrr�	debsorted�s
r�rsr)&�loggingrx�osr�os.pathr�configparserr�typesr�
RANGE_PATTERN�compileru�VERBOSEr/�	getLoggerr_�logrZ�
_supported�_default�_config�read�replacerrr	�	Exception�	exceptionrmrrqrkr�r�r�r}r�rrrr�<module>sX
�




����
&(,+

Zerion Mini Shell 1.0