From 5a53d8ae4a1be1349c87a54a1f6af35cfb756d09 Mon Sep 17 00:00:00 2001 From: Michail Bugaev Date: Wed, 28 Feb 2024 22:24:10 +0300 Subject: [PATCH] Fixed code for flake8 --- exchange_calendars/exchange_calendar_xmos.py | 7 ++++--- exchange_calendars/pandas_extensions/offsets.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/exchange_calendars/exchange_calendar_xmos.py b/exchange_calendars/exchange_calendar_xmos.py index 46a7cb7d..00002ac3 100644 --- a/exchange_calendars/exchange_calendar_xmos.py +++ b/exchange_calendars/exchange_calendar_xmos.py @@ -28,6 +28,7 @@ from .exchange_calendar import WEEKDAYS, HolidayCalendar, ExchangeCalendar from .pandas_extensions.offsets import MultipleWeekmaskCustomBusinessDay + def new_years_eve_observance(dt: datetime.datetime) -> datetime.datetime | None: # For some reason New Year's Eve was not a holiday these years. return None if dt.year in [2008, 2009] else weekend_to_monday(dt) @@ -295,8 +296,8 @@ def special_weekmasks(self): weekmasks that applies between dates. """ return [ - # For 1999-2011 years next url was used to obtain data for - # IMOEX close values in order to check if there are any Sat or Sun: + # For 1999-2011 years next url was used to obtain data for + # IMOEX close values in order to check if there are any Sat or Sun: # https://iss.moex.com/iss/history/engines/stock/markets/index/securities/IMOEX (pd.Timestamp("1999-01-04"), pd.Timestamp("1999-01-10"), "1111101"), (pd.Timestamp("2000-05-01"), pd.Timestamp("2000-05-07"), "1111110"), @@ -325,7 +326,7 @@ def special_weekmasks(self): (pd.Timestamp("2010-02-22"), pd.Timestamp("2010-02-28"), "1111110"), (pd.Timestamp("2010-11-08"), pd.Timestamp("2010-11-14"), "1111110"), (pd.Timestamp("2011-02-28"), pd.Timestamp("2011-03-06"), "1111110"), - # For 2012 year https://www.moex.com/a254 + # For 2012 year https://www.moex.com/a254 (pd.Timestamp("2012-03-05"), pd.Timestamp("2012-03-11"), "1111101"), (pd.Timestamp("2012-04-23"), pd.Timestamp("2012-05-13"), "1111110"), (pd.Timestamp("2012-06-04"), pd.Timestamp("2012-06-10"), "1111110"), diff --git a/exchange_calendars/pandas_extensions/offsets.py b/exchange_calendars/pandas_extensions/offsets.py index 89458714..cac2e4a3 100644 --- a/exchange_calendars/pandas_extensions/offsets.py +++ b/exchange_calendars/pandas_extensions/offsets.py @@ -87,7 +87,7 @@ def business_days(self, business_days): for left, right in toolz.sliding_window( 2, toolz.concatv(self._business_days_index) ): - if pd.Timestamp((right.left - left.right).days, + if pd.Timestamp((right.left - left.right).days, unit="D") > pd.Timestamp(1, unit="D"): interval = pd.Interval( left.right + pd.Timedelta(1, unit="D"),