Skip to content
This repository was archived by the owner on Aug 29, 2021. It is now read-only.

Commit ca8a5fd

Browse files
committed
[v0.5.1] Bump Version
1 parent 52154c0 commit ca8a5fd

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

disctools/__version_info__.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
status_map = {
1+
from typing import Dict, Literal, Optional, Protocol, Union
2+
3+
class HasStr(Protocol):
4+
def __str__(self) -> str:
5+
...
6+
7+
class HasRepr(Protocol):
8+
def __repr__(self) -> str:
9+
...
10+
11+
Stringable = Union[HasRepr, HasStr]
12+
Status = Literal["a", "b", "rc", "f"]
13+
14+
status_map: Dict[str, Status] = {
215
"alpha": "a",
316
"beta": "b",
417
"release_candidate": "rc",
@@ -12,14 +25,30 @@ class last_modified:
1225
year = 2021
1326

1427
@classmethod
15-
def date(cls):
28+
def date(cls) -> str:
1629
return f"{cls.year}.{cls.month}.{cls.day}"
1730

1831

1932
# Major.minor.patch status serial .postN .devM + build
2033
class VersionInfo:
2134
"""Information regarding a version."""
22-
def __init__(self, *, major, minor, patch, status, serial = 0, post = 0, dev = 0, build = None):
35+
major: int
36+
minor: int
37+
patch: int
38+
status: Status
39+
serial: int
40+
post: int
41+
dev: int
42+
build: Optional[Stringable]
43+
44+
def __init__(self, *, major: int,
45+
minor: int,
46+
patch: int,
47+
status: Status,
48+
serial: int = 0,
49+
post: int = 0,
50+
dev: int = 0,
51+
build: Optional[Stringable] = None) -> None:
2352
ver = str(major)
2453
if minor:
2554
ver += f".{minor}"
@@ -32,6 +61,8 @@ def __init__(self, *, major, minor, patch, status, serial = 0, post = 0, dev = 0
3261

3362
if status != "f":
3463
ver += f"{status}{serial}"
64+
elif serial != 0:
65+
raise ValueError("Final release cannot have a serial number!, use post instead.")
3566

3667
if post:
3768
ver += f".post{post}"
@@ -63,7 +94,7 @@ def __repr__(self) -> str:
6394
major = 0,
6495
minor = 5,
6596
patch = 1,
66-
status = status_map["beta"],
97+
status = status_map["final"],
6798
)
6899

69100
__version__ = str(version_info)

version.num

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5b0
1+
0.5.1

0 commit comments

Comments
 (0)