File size: 796 Bytes
c2ca15f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# Copyright (c) Open-MMLab. All rights reserved.
__version__ = '1.4.0'
short_version = __version__
def parse_version_info(version_str: str) -> tuple:
"""Parse a version string into a tuple.
Args:
version_str (str): The version string.
Returns:
tuple: The version info, e.g., "1.3.0" is parsed into (1, 3, 0), and
"2.0.0rc4" is parsed into (2, 0, 0, 'rc4').
"""
version_info = []
for x in version_str.split('.'):
if x.isdigit():
version_info.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
version_info.append(int(patch_version[0]))
version_info.append(f'rc{patch_version[1]}')
return tuple(version_info)
version_info = parse_version_info(__version__)
|