Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ruralscenery committed Sep 18, 2024
1 parent 0251046 commit f2c8155
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions exchange_calendars/exchange_calendar_xtai.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@
def check_after_2013(dt: datetime.datetime) -> bool:
return dt.year > 2013


def check_between_2013_2024(dt: datetime.datetime) -> bool:
return 2024 > dt.year > 2013


def before_chinese_new_year_offset(holidays):
"""
For Holidays that come before Chinese New Year, we subtract a day
Expand All @@ -72,7 +74,8 @@ def chinese_new_year_offset(holidays):
"""
return pd.to_datetime(holidays.map(lambda d: next_monday(d)))

def tomb_within_children_day(dt:datetime.datetime) -> datetime.datetime:

def tomb_within_children_day(dt: datetime.datetime) -> datetime.datetime:
dts = []
for d in dt:
if d.year > 2012 and d.month == 4 and d.day == 4:
Expand All @@ -82,6 +85,7 @@ def tomb_within_children_day(dt:datetime.datetime) -> datetime.datetime:
dts.append(datetime.datetime(d.year, 4, 3))
return pd.to_datetime(dts)


def nearest_workday_after_2013(dt: datetime.datetime) -> datetime.datetime:
"""
Nearest workday starting in 2014.
Expand Down Expand Up @@ -128,7 +132,7 @@ def weekend_makeup(dt: datetime.datetime) -> datetime.datetime:
return dt


def bridge_mon(dt: datetime.datetime, checker: Callable=check_after_2013) -> datetime.datetime | None:
def bridge_mon(dt: datetime.datetime, checker: Callable = check_after_2013) -> datetime.datetime | None:
"""Define Monday as holiday if Tuesday is a holiday.
This function attempts to implement what seems to be the Taiwan holiday
Expand All @@ -143,8 +147,7 @@ def bridge_mon(dt: datetime.datetime, checker: Callable=check_after_2013) -> dat

return dt if (dt.weekday() == MONDAY and checker(dt)) else None


def bridge_fri(dt: datetime.datetime, checker: Callable=check_after_2013) -> datetime.datetime | None:
def bridge_fri(dt: datetime.datetime, checker: Callable = check_after_2013) -> datetime.datetime | None:
"""Define Friday as holiday if Thursday is a holiday.
This function attempts to implement what seems to be the Taiwan holiday
Expand Down

0 comments on commit f2c8155

Please sign in to comment.