forked from AILab-CVC/YOLO-World
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e6de41
commit be077a0
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) Tencent Inc. All rights reserved. | ||
__version__ = '0.1.0' | ||
|
||
|
||
def parse_version_info(version_str): | ||
"""Parse a version string into a tuple. | ||
Args: | ||
version_str (str): The version string. | ||
Returns: | ||
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into | ||
(1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1'). | ||
""" | ||
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__) | ||
|
||
__all__ = ['__version__', 'version_info', 'parse_version_info'] |