|
1 | 1 | """
|
2 | 2 | Base and utility classes for tseries type pandas objects.
|
3 | 3 | """
|
4 |
| -from datetime import datetime, tzinfo |
5 |
| -from typing import TYPE_CHECKING, Any, List, Optional, TypeVar, Union, cast |
| 4 | +from datetime import datetime |
| 5 | +from typing import TYPE_CHECKING, Any, List, Optional, Tuple, TypeVar, Union, cast |
6 | 6 |
|
7 | 7 | import numpy as np
|
8 | 8 |
|
9 | 9 | from pandas._libs import NaT, Timedelta, iNaT, join as libjoin, lib
|
10 |
| -from pandas._libs.tslibs import BaseOffset, Resolution, Tick, timezones |
| 10 | +from pandas._libs.tslibs import BaseOffset, Resolution, Tick |
11 | 11 | from pandas._typing import Callable, Label
|
12 | 12 | from pandas.compat.numpy import function as nv
|
13 | 13 | from pandas.errors import AbstractMethodError
|
@@ -672,8 +672,6 @@ class DatetimeTimedeltaMixin(DatetimeIndexOpsMixin, Int64Index):
|
672 | 672 | but not PeriodIndex
|
673 | 673 | """
|
674 | 674 |
|
675 |
| - tz: Optional[tzinfo] |
676 |
| - |
677 | 675 | # Compat for frequency inference, see GH#23789
|
678 | 676 | _is_monotonic_increasing = Index.is_monotonic_increasing
|
679 | 677 | _is_monotonic_decreasing = Index.is_monotonic_decreasing
|
@@ -931,22 +929,9 @@ def join(
|
931 | 929 | sort=sort,
|
932 | 930 | )
|
933 | 931 |
|
934 |
| - def _maybe_utc_convert(self, other): |
935 |
| - this = self |
936 |
| - if not hasattr(self, "tz"): |
937 |
| - return this, other |
938 |
| - |
939 |
| - if isinstance(other, type(self)): |
940 |
| - if self.tz is not None: |
941 |
| - if other.tz is None: |
942 |
| - raise TypeError("Cannot join tz-naive with tz-aware DatetimeIndex") |
943 |
| - elif other.tz is not None: |
944 |
| - raise TypeError("Cannot join tz-naive with tz-aware DatetimeIndex") |
945 |
| - |
946 |
| - if not timezones.tz_compare(self.tz, other.tz): |
947 |
| - this = self.tz_convert("UTC") |
948 |
| - other = other.tz_convert("UTC") |
949 |
| - return this, other |
| 932 | + def _maybe_utc_convert(self: _T, other: Index) -> Tuple[_T, Index]: |
| 933 | + # Overridden by DatetimeIndex |
| 934 | + return self, other |
950 | 935 |
|
951 | 936 | # --------------------------------------------------------------------
|
952 | 937 | # List-Like Methods
|
|
0 commit comments