Skip to content

Commit

Permalink
Revert "Update parse_version_info function."
Browse files Browse the repository at this point in the history
This reverts commit da93cac.
  • Loading branch information
mzr1996 committed Aug 12, 2021
1 parent 90e5807 commit b951397
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
25 changes: 23 additions & 2 deletions mmcls/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

__version__ = '0.14.0'

version_info = tuple(int(x) for x in __version__.split('.')[:3])

__all__ = ['__version__', 'version_info']
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']
1 change: 0 additions & 1 deletion requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
matplotlib
numpy
packaging

0 comments on commit b951397

Please sign in to comment.