Skip to content

Commit b1f8f7f

Browse files
committed
* Refactor version.py
1 parent 4b4f379 commit b1f8f7f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

histogrammar/version.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""
2-
31
import re
2+
from typing import Tuple
43

5-
name = "histogrammar"
6-
__version__ = "1.0.34"
74
version = "1.0.34"
8-
full_version = "1.0.34"
9-
release = True
105

11-
version_info = tuple(re.split(r"[-\.]", __version__))
12-
specification = ".".join(version_info[:2])
136

7+
def split_version_string(version_string: str) -> Tuple[int, int]:
8+
version_numbers = list(map(int, re.split(r"[-.]", version_string)))
9+
return version_numbers[0], version_numbers[1]
10+
11+
12+
specification = ".".join([str(i) for i in split_version_string(version)[:2]])
13+
14+
15+
def compatible(serialized_version: str) -> bool:
16+
self_major, self_minor = split_version_string(version)
17+
other_major, other_minor = split_version_string(serialized_version)
1418

15-
def compatible(serializedVersion):
16-
selfMajor, selfMinor = map(int, version_info[:2])
17-
otherMajor, otherMinor = map(int, re.split(r"[-\.]", serializedVersion)[:2])
18-
if selfMajor >= otherMajor:
19+
if self_major >= other_major:
1920
return True
20-
elif selfMinor >= otherMinor:
21+
elif self_minor >= other_minor:
2122
return True
2223
else:
2324
return False

0 commit comments

Comments
 (0)