diff --git a/etc/factory_bounds.py b/etc/factory_bounds.py index 141dabe4..5d3000d7 100644 --- a/etc/factory_bounds.py +++ b/etc/factory_bounds.py @@ -9,8 +9,6 @@ Module retained in case might be useful. """ -from __future__ import annotations - import abc import dataclasses import pathlib diff --git a/exchange_calendars/calendar_helpers.py b/exchange_calendars/calendar_helpers.py index b3e4cc73..f857890b 100644 --- a/exchange_calendars/calendar_helpers.py +++ b/exchange_calendars/calendar_helpers.py @@ -2,8 +2,7 @@ import contextlib import datetime -import typing -from typing import Literal +from typing import Literal, TYPE_CHECKING from zoneinfo import ZoneInfo import numpy as np @@ -11,7 +10,7 @@ from exchange_calendars import errors -if typing.TYPE_CHECKING: +if TYPE_CHECKING: from exchange_calendars import ExchangeCalendar UTC = ZoneInfo("UTC") @@ -22,7 +21,7 @@ # Use Date type where input does not need to represent an actual session # and will be parsed by parse_date. -Date = typing.Union[pd.Timestamp, str, int, float, datetime.datetime] +Date = pd.Timestamp | str | int | float | datetime.datetime # Use Session type where input should represent an actual session and will # be parsed by parse_session. @@ -30,7 +29,7 @@ # Use Minute type where input does not need to represent an actual trading # minute and will be parsed by parse_timestamp. -Minute = typing.Union[pd.Timestamp, str, int, float, datetime.datetime] +Minute = pd.Timestamp | str | int | float | datetime.datetime # Use TradingMinute where input should represent a trading minute and will # be parsed by parse_trading_minute. diff --git a/exchange_calendars/calendar_utils.py b/exchange_calendars/calendar_utils.py index ec2be518..7a9eb53c 100644 --- a/exchange_calendars/calendar_utils.py +++ b/exchange_calendars/calendar_utils.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from typing import Literal from .calendar_helpers import parse_date, Date diff --git a/exchange_calendars/errors.py b/exchange_calendars/errors.py index dbf47d9e..fef75a3f 100644 --- a/exchange_calendars/errors.py +++ b/exchange_calendars/errors.py @@ -12,7 +12,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import annotations + import typing import pandas as pd diff --git a/exchange_calendars/exchange_calendar_xbud.py b/exchange_calendars/exchange_calendar_xbud.py index 0c89ede1..249f43f7 100644 --- a/exchange_calendars/exchange_calendar_xbud.py +++ b/exchange_calendars/exchange_calendar_xbud.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from zoneinfo import ZoneInfo diff --git a/exchange_calendars/exchange_calendar_xbue.py b/exchange_calendars/exchange_calendar_xbue.py index 650c37e1..6bd5dfdd 100644 --- a/exchange_calendars/exchange_calendar_xbue.py +++ b/exchange_calendars/exchange_calendar_xbue.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from itertools import chain diff --git a/exchange_calendars/exchange_calendar_xkrx.py b/exchange_calendars/exchange_calendar_xkrx.py index 1bd6a1cb..d8303955 100644 --- a/exchange_calendars/exchange_calendar_xkrx.py +++ b/exchange_calendars/exchange_calendar_xkrx.py @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations + from datetime import time import functools diff --git a/exchange_calendars/exchange_calendar_xmos.py b/exchange_calendars/exchange_calendar_xmos.py index 00002ac3..da7ba7cb 100644 --- a/exchange_calendars/exchange_calendar_xmos.py +++ b/exchange_calendars/exchange_calendar_xmos.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from itertools import chain diff --git a/exchange_calendars/exchange_calendar_xphs.py b/exchange_calendars/exchange_calendar_xphs.py index dba98d67..685130c9 100644 --- a/exchange_calendars/exchange_calendar_xphs.py +++ b/exchange_calendars/exchange_calendar_xphs.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from itertools import chain diff --git a/exchange_calendars/exchange_calendar_xsgo.py b/exchange_calendars/exchange_calendar_xsgo.py index a6e236ec..99c11013 100644 --- a/exchange_calendars/exchange_calendar_xsgo.py +++ b/exchange_calendars/exchange_calendar_xsgo.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from zoneinfo import ZoneInfo diff --git a/exchange_calendars/exchange_calendar_xtai.py b/exchange_calendars/exchange_calendar_xtai.py index 74153950..0c134a7e 100644 --- a/exchange_calendars/exchange_calendar_xtai.py +++ b/exchange_calendars/exchange_calendar_xtai.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from itertools import chain diff --git a/exchange_calendars/exchange_calendar_xwar.py b/exchange_calendars/exchange_calendar_xwar.py index 3b79527f..ab8571b0 100644 --- a/exchange_calendars/exchange_calendar_xwar.py +++ b/exchange_calendars/exchange_calendar_xwar.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations import datetime from zoneinfo import ZoneInfo diff --git a/exchange_calendars/precomputed_exchange_calendar.py b/exchange_calendars/precomputed_exchange_calendar.py index 8d937ce5..71fa23d5 100644 --- a/exchange_calendars/precomputed_exchange_calendar.py +++ b/exchange_calendars/precomputed_exchange_calendar.py @@ -1,4 +1,3 @@ -from __future__ import annotations from abc import abstractmethod import numpy as np diff --git a/exchange_calendars/utils/pandas_utils.py b/exchange_calendars/utils/pandas_utils.py index 96c65b87..2cc4d01c 100644 --- a/exchange_calendars/utils/pandas_utils.py +++ b/exchange_calendars/utils/pandas_utils.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from zoneinfo import ZoneInfo diff --git a/exchange_calendars/xbkk_holidays.py b/exchange_calendars/xbkk_holidays.py index 90a8b2ad..7c63c733 100644 --- a/exchange_calendars/xbkk_holidays.py +++ b/exchange_calendars/xbkk_holidays.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime import pandas as pd diff --git a/tests/test_calendar_helpers.py b/tests/test_calendar_helpers.py index b2192509..8f4c47a9 100644 --- a/tests/test_calendar_helpers.py +++ b/tests/test_calendar_helpers.py @@ -1,7 +1,5 @@ """Tests for calendar_helpers module.""" -from __future__ import annotations - from collections import abc import datetime from datetime import time diff --git a/tests/test_exchange_calendar.py b/tests/test_exchange_calendar.py index 3ce62c71..1eb135dd 100644 --- a/tests/test_exchange_calendar.py +++ b/tests/test_exchange_calendar.py @@ -9,7 +9,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import annotations from collections import abc from datetime import time @@ -722,7 +721,7 @@ def _get_sessions_with_times_different_to_next_session( Returns ------- - list of pd.Datetimeindex + list of pd.DatetimeIndex [0] sessions with earlier next session [1] sessions with later next session """ @@ -1117,12 +1116,12 @@ def non_sessions(self) -> pd.DatetimeIndex: @property def sessions_range_defined_by_non_sessions( self, - ) -> tuple[tuple[pd.Timestamp, pd.Timestamp], pd.Datetimeindex] | None: + ) -> tuple[tuple[pd.Timestamp, pd.Timestamp], pd.DatetimeIndex] | None: """Range containing sessions although defined with non-sessions. Returns ------- - tuple[tuple[pd.Timestamp, pd.Timestamp], pd.Datetimeindex]: + tuple[tuple[pd.Timestamp, pd.Timestamp], pd.DatetimeIndex]: [0] tuple[pd.Timestamp, pd.Timestamp]: [0] range start as non-session date. [1] range end as non-session date. @@ -1869,7 +1868,7 @@ def early_closes_sample_time(self) -> abc.Iterator[pd.Timedelta | None]: yield None @pytest.fixture - def early_closes_weekdays(self) -> abc.Iterator[tuple(int)]: + def early_closes_weekdays(self) -> abc.Iterator[tuple[int]]: """Weekdays with non-standard close times. `test_early_closes_weekdays` will check that all sessions on these