| Conditions | 2 |
| Total Lines | 9 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import os |
||
| 6 | def load_version(version_file_path): |
||
| 7 | import re |
||
| 8 | file_contents = open(version_file_path, "rt").read() |
||
| 9 | version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]" |
||
| 10 | match = re.search(version_regex, file_contents, re.M) |
||
| 11 | if match: |
||
| 12 | return match.group(1) |
||
| 13 | else: |
||
| 14 | raise RuntimeError(f"Unable to find version string in {version_file_path}") |
||
| 15 | |||
| 43 |