Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/traitlets/_version.py: 91%

11 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-20 06:09 +0000

1""" 

2handle the current version info of traitlets. 

3""" 

4from __future__ import annotations 

5 

6import re 

7from typing import List 

8 

9# Version string must appear intact for hatch versioning 

10__version__ = "5.14.3" 

11 

12# Build up version_info tuple for backwards compatibility 

13pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)" 

14match = re.match(pattern, __version__) 

15assert match is not None 

16parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]] 

17if match["rest"]: 

18 parts.append(match["rest"]) 

19version_info = tuple(parts)