Skip to content

Commit 59a3523

Browse files
committed
[mypy] Fixes typing errors in other/date_to_weekday
1 parent fc5d29e commit 59a3523

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

other/date_to_weekday.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from calendar import day_name
22
from datetime import datetime
3+
from typing import Union
34

45

56
def date_to_weekday(inp_date: str) -> str:
@@ -14,11 +15,12 @@ def date_to_weekday(inp_date: str) -> str:
1415
>>> date_to_weekday("1/1/2021")
1516
'Friday'
1617
"""
18+
year: Union[int, str]
1719
day, month, year = (int(x) for x in inp_date.split("/"))
1820
if year % 100 == 0:
1921
year = "00"
2022
new_base_date: str = f"{day}/{month}/{year%100} 0:0:0"
21-
date_time_obj: datetime.date = datetime.strptime(new_base_date, "%d/%m/%y %H:%M:%S")
23+
date_time_obj: datetime = datetime.strptime(new_base_date, "%d/%m/%y %H:%M:%S")
2224
out_put_day: int = date_time_obj.weekday()
2325
return day_name[out_put_day]
2426

0 commit comments

Comments
 (0)