Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4b94bf
commit 9ab1227
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
from dataclasses import dataclass | ||
|
||
short_month_to_full = { | ||
'XX': 'XX', | ||
'01': 'January', | ||
'02': 'February', | ||
'03': 'March', | ||
'04': 'April', | ||
'05': 'May', | ||
'06': 'June', | ||
'07': 'July', | ||
'08': 'August', | ||
'09': 'September', | ||
'10': 'October', | ||
'11': 'November', | ||
'12': 'December', | ||
} | ||
|
||
@dataclass | ||
class Config: | ||
annotated: bool | ||
effective_year: str | ||
effective_month: str | ||
effective_day: str | ||
|
||
def not_annotated(self): | ||
return Config(False) | ||
return Config(False, self.effective_year, self.effective_month, self.effective_day) | ||
|
||
def version_string(self): | ||
return f'{self.effective_year[2:]}.{self.effective_month}' | ||
|
||
def effective_date_str(self): | ||
if not self.effective_month in short_month_to_full: | ||
raise Exception(f'Not a valid month string: {self.effective_month}') | ||
return f'{self.effective_day} {short_month_to_full[self.effective_month]} {self.effective_year}' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters