Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
herebebeasties committed Feb 13, 2024
1 parent 8fa2ebf commit bf44e82
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It's recommended that whilst working through the process reference be made to ex
- [ ] Name subclass `{Exchange MIC}ExchangeCalendar`.
- [ ] Override methods and properties as required, being guided by ExchangeCalendar documentation and in-code comments. All abstract properties must be overriden.
- [ ] Include references / links for holidays and timings (either to class documentation or as comments).
- [ ] Import calendar class to `exchange_calendars/calendar_utils.py` and add class to `_default_calendar_factories`.
- [ ] Import calendar class to `exchange_calendars/calendar_utils.py` and add class to `_default_calendar_factories`.
- [ ] Add calendar test module `tests/test_{Exchange MIC}_calendar.py` Module should contain a subclass of the test base class `ExchangeCalendarTestBase` (in `tests/test_exchange_calendars.py`).
- [ ] Name subclass `Test{Exchange MIC}Calendar`.
- [ ] Override fixtures as required, being guided by ExchangeCalendarTestBase documentation and in-code comments. The `calendar_cls` and `max_session_hours` fixtures must be overriden.
Expand All @@ -16,7 +16,7 @@ It's recommended that whilst working through the process reference be made to ex

**Workflow to modify an existing Exchange Calendar**

- [ ] Modify calendar class as required.
- [ ] Modify calendar class as required.
- [ ] Modify the test resources file (e.g `tests/resources/{Exchange MIC}.csv`), either manually or by executing `python etc/make_exchange_calendar_test_csv.py {Exchange MIC}`.
- [ ] Check if any of the fixtures in `tests/test_{Exchange MIC}_calendar.py` need updating to reflect your changes.
- [ ] Add references to any new/modified holidays in `exchange_calendars/exchange_calendar_{Exchange MIC}.py`.
2 changes: 1 addition & 1 deletion exchange_calendars/exchange_calendar_xbom.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"2024-10-02",
"2024-11-01",
"2024-11-15",
"2024-12-25"
"2024-12-25",
]
)

Expand Down
4 changes: 3 additions & 1 deletion exchange_calendars/exchange_calendar_xhkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ def process_queen_birthday(dt):
# on the Monday (2022-09-12). In the past they don't seem to have followed
# this pattern. We'll have to wait and see before we generalise this into a rule.
pd.Timestamp("2022-09-12"),
pd.Timestamp("2023-07-17"), # 8号台风泰利, 全天休市 https://www.hkex.com.hk/News/Market-Communications/2023/2307172news?sc_lang=en
pd.Timestamp(
"2023-07-17"
), # 8号台风泰利, 全天休市 https://www.hkex.com.hk/News/Market-Communications/2023/2307172news?sc_lang=en
]


Expand Down
3 changes: 1 addition & 2 deletions exchange_calendars/exchange_calendar_xidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ def regular_holidays(self):
chinese_new_year = chinese_lunar_new_year_dates[
# The Indonesia Stock Exchange did not close for Chinese New
# Year in 1998, 1999, or 2001. (It fell on a Saturday in 2000.)
chinese_lunar_new_year_dates.year
>= 2002
chinese_lunar_new_year_dates.year >= 2002
]

common_leave = pd.to_datetime(
Expand Down
2 changes: 0 additions & 2 deletions exchange_calendars/pandas_extensions/offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class CompositeCustomBusinessDay(CustomBusinessDay):

_prefix = "C"
_attributes = tuple(
[
Expand Down Expand Up @@ -245,7 +244,6 @@ def _get_calendar(weekmask, holidays, calendar):


class MultipleWeekmaskCustomBusinessDay(CompositeCustomBusinessDay):

_prefix = "C"
_attributes = tuple(
[
Expand Down
10 changes: 5 additions & 5 deletions exchange_calendars/tase_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,35 +360,35 @@ def holiday(self):
month=1,
day=1,
offset=[_Sukkoth(), Day(1)],
days_of_week=(0, 1, 2, 3, 6)
days_of_week=(0, 1, 2, 3, 6),
)
SukkothInterimDay2 = Holiday(
"Sukkoth Interim Day",
month=1,
day=1,
offset=[_Sukkoth(), Day(2)],
days_of_week=(0, 1, 2, 3, 6)
days_of_week=(0, 1, 2, 3, 6),
)
SukkothInterimDay3 = Holiday(
"Sukkoth Interim Day",
month=1,
day=1,
offset=[_Sukkoth(), Day(3)],
days_of_week=(0, 1, 2, 3, 6)
days_of_week=(0, 1, 2, 3, 6),
)
SukkothInterimDay4 = Holiday(
"Sukkoth Interim Day",
month=1,
day=1,
offset=[_Sukkoth(), Day(4)],
days_of_week=(0, 1, 2, 3, 6)
days_of_week=(0, 1, 2, 3, 6),
)
SukkothInterimDay5 = Holiday(
"Sukkoth Interim Day",
month=1,
day=1,
offset=[_Sukkoth(), Day(5)],
days_of_week=(0, 1, 2, 3, 6)
days_of_week=(0, 1, 2, 3, 6),
)

# Passover interim days are the days between beginning and end of passover. Any otherwise regular business day in that
Expand Down
2 changes: 1 addition & 1 deletion exchange_calendars/us_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def following_tuesday_every_four_years_observance(dt):
month=6,
day=19,
start_date=Timestamp("2022-01-01"),
observance=nearest_workday
observance=nearest_workday,
)
USIndependenceDayBefore1954 = Holiday(
"July 4th",
Expand Down
2 changes: 1 addition & 1 deletion exchange_calendars/xkls_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
"2021-05-26",
"2022-05-15",
"2023-05-04",
"2024-05-22"
"2024-05-22",
]
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_xfra_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def regular_holidays_sample(self):
# Whit Monday
"2015-05-25", # regularly observed from 2015
"2016-05-16",
"2021-05-24"
"2021-05-24",
]

@pytest.fixture
Expand All @@ -58,7 +58,7 @@ def non_holidays_sample(self):
"2016-10-31",
"2018-10-31",
# German Unity Day was not observed in 2022
"2022-10-03"
"2022-10-03",
]

@pytest.fixture
Expand Down
8 changes: 7 additions & 1 deletion tests/test_xhkg_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ def adhoc_holidays_sample(self):
"2022-09-12" # In 2019, the mid-autumn festival holiday was observed on the following business day.
]

yield lunar_2003 + lunar_2018 + lunar_2017 + typhoon_days + mid_autumn_festival_holidays
yield (
lunar_2003
+ lunar_2018
+ lunar_2017
+ typhoon_days
+ mid_autumn_festival_holidays
)

@pytest.fixture
def early_closes_sample(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xkrx_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def regular_holidays_sample(self):
"2022-10-10",
# Buddha's birthday was on 27th May (Saturday),
# so the next monday becomes alternative holiday
"2023-05-29"
"2023-05-29",
]

@pytest.fixture
Expand Down
6 changes: 4 additions & 2 deletions tests/test_xnze_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def regular_holidays_sample(self):
@pytest.fixture
def adhoc_holidays_sample(self):
yield [
"2022-06-24", "2035-06-29", "2049-06-25", # Mataraki Day (a small selection)
"2022-09-26" # National day of mourning for the queen
"2022-06-24", # Mataraki Day (a small selection)
"2035-06-29", # Mataraki Day
"2049-06-25", # Mataraki Day
"2022-09-26", # National day of mourning for the queen
]

@pytest.fixture
Expand Down

0 comments on commit bf44e82

Please sign in to comment.