d(・ω・d) 微分!(∫・ω・)∫ 積分!∂(・ω・∂) 偏微分!(∮・ω・)∮ 沿閉曲線的積分!(∬・ω・)∬ 重積分!∇(・ω・∇)梯度!∇・(・ω・∇・)散度!∇×(・ω・∇×)旋度!Δ(・ω・Δ)拉普拉斯!#゚Å゚)⊂彡☆))゚Д゚)・∵ლ(◉◞౪◟◉ )ლ千言萬語,不如一個「表情符號(emoji)」簡單生動又有趣!ಠ▃ಠ生氣、-`д´-憤怒、(¬_¬)無言、(•͈⌔•͈⑅)傷心、哭、開心、大笑、可愛、困惑、發呆、大眼睛、驚呀、跳舞、興奮、奔跑..≧Д≦ (;≧皿≦) (⁎˃ᆺ˂) ╬ Ò ‸ Ó) <(`^´)> ( >д<) (ꐦ ಠ皿ಠ ) (`Д´) (;`O´)o o(-`д´- 。) ( ˃⌂˂ ) (°ㅂ° ╬) (ʘ言ʘ╬) (Ò 皿 Ó ╬) (-`д´-) 눈_눈 (⋋▂⋌) (¬▂¬) ಠ▃ಠ (>x<) ╰(‵□′)╯ D.R.S Dz

Sindbad~EG File Manager

Current Path : /lib64/python3.9/site-packages/borg/
Upload File :
Current File : //lib64/python3.9/site-packages/borg/version.py

import re


def parse_version(version):
    """
    Simplistic parser for setuptools_scm versions.

    Supports final versions and alpha ('a'), beta ('b') and release candidate ('rc') versions.
    It does not try to parse anything else than that, even if there is more in the version string.

    Output is a version tuple containing integers. It ends with one or two elements that ensure that relational
    operators yield correct relations for alpha, beta and rc versions, too.
    For final versions the last element is a -1.
    For prerelease versions the last two elements are a smaller negative number and the number of e.g. the beta.

    This version format is part of the remote protocol, don‘t change in breaking ways.
    """
    version_re = r"""
        (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)   # version, e.g. 1.2.33
        (?P<prerelease>(?P<ptype>a|b|rc)(?P<pnum>\d+))?  # optional prerelease, e.g. a1 or b2 or rc33
    """
    m = re.match(version_re, version, re.VERBOSE)
    if m is None:
        raise ValueError('Invalid version string %s' % version)
    gd = m.groupdict()
    version = [int(gd['major']), int(gd['minor']), int(gd['patch'])]
    if m.lastgroup == 'prerelease':
        p_type = {'a': -4, 'b': -3, 'rc': -2}[gd['ptype']]
        p_num = int(gd['pnum'])
        version += [p_type, p_num]
    else:
        version += [-1]
    return tuple(version)


def format_version(version):
    """a reverse for parse_version (obviously without the dropped information)"""
    f = []
    it = iter(version)
    while True:
        part = next(it)
        if part >= 0:
            f.append(str(part))
        elif part == -1:
            break
        else:
            f[-1] = f[-1] + {-2: 'rc', -3: 'b', -4: 'a'}[part] + str(next(it))
            break
    return '.'.join(f)

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists