-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (27 loc) · 796 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
from model import Calendar
parser = argparse.ArgumentParser(
description="Calculate holiday calendar", epilog="Have a nice holiday!"
)
parser.add_argument(
"--year",
action="store",
help="specify the year between 1900 and 2099 (current year by default)",
metavar="<YOUR YEAR>",
nargs="?",
type=int,
)
args = parser.parse_args()
if __name__ == "__main__":
if args.year:
calendar = Calendar(args.year)
else:
calendar = Calendar.from_today()
print(f"\n{calendar}\n")
for date, holiday in calendar.public_holidays().items():
print(f"{date}: {holiday}")
print(
"\nThe number of public holidays "
+ "that are not the same as a normal weekend: "
+ f"{calendar.real_holidays()}"
)