Merge same holidays from different regions

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-12-28 14:10:40 +01:00
parent ff562b8a9e
commit 002a04db63
2 changed files with 6 additions and 3 deletions

View file

@ -8,7 +8,6 @@ define holidays:
2017_01_16 = Birthday of Martin Luther King, Jr.
2017_02_20 = Washington's Birthday
2017_04_17 = Patriots' Day
2017_04_17 = Patriots' Day
2017_05_29 = Memorial Day
2017_07_04 = Independence Day
2017_09_04 = Labor Day
@ -21,7 +20,6 @@ define holidays:
2018_01_15 = Birthday of Martin Luther King, Jr.
2018_02_19 = Washington's Birthday
2018_04_16 = Patriots' Day
2018_04_16 = Patriots' Day
2018_05_28 = Memorial Day
2018_07_04 = Independence Day
2018_09_03 = Labor Day

View file

@ -62,6 +62,7 @@ def update_locales(locales, regions, years):
fh.write(" {}:\n".format(locale))
for year in years:
holidays = dict()
url = holidata(locale, year)
print(url)
try:
@ -73,7 +74,11 @@ def update_locales(locales, regions, years):
if not j['region'] or not regions or j['region'] in regions:
day = j['date'].replace("-", "_")
desc = j['description']
fh.write(" {} = {}\n".format(day, desc))
holidays[day] = desc
for date, desc in holidays.items():
fh.write(" {} = {}\n".format(date, desc))
fh.write('\n')
except HTTPError as e: