Simplify date conversions

Also do a sneaky update to switch from dict() to list()

Change-Id: I71b65b82e8609fc4b3b48ef58acdf434ce69fe5c
This commit is contained in:
Tony Breeds 2022-10-21 11:25:03 -05:00
parent 5701eea441
commit 84c50c9878

View File

@ -102,9 +102,7 @@ def select_release_end_date(release_name, release_schedule):
event = '%s-final' % (release_name[0:1]) event = '%s-final' % (release_name[0:1])
for week in release_schedule.get('cycle', []): for week in release_schedule.get('cycle', []):
if event in week.get('x-project', []): if event in week.get('x-project', []):
date = datetime.datetime.strptime( date = valid_date(week['end'])
week['end'],
"%Y-%m-%d").replace(tzinfo=pytz.UTC)
return date return date
@ -157,10 +155,8 @@ def main():
schedule = utils.get_schedule_data(names[idx+3]) schedule = utils.get_schedule_data(names[idx+3])
event = '%s-rc1' % (names[idx+3][0:1]) event = '%s-rc1' % (names[idx+3][0:1])
for week in schedule.get('cycle', []): for week in schedule.get('cycle', []):
if event in week.get('x-project', {}): if event in week.get('x-project', []):
timeframe_start = datetime.datetime.strptime(week['end'], timeframe_start = valid_date(week['end'])
"%Y-%m-%d")
timeframe_start = timeframe_start.replace(tzinfo=pytz.UTC)
print('Setting %s Election\n%s is at: %s' % (args.type, print('Setting %s Election\n%s is at: %s' % (args.type,
params['milestone'], params['milestone'],