|
64 | 64 | Series,
|
65 | 65 | Timedelta,
|
66 | 66 | Timestamp,
|
67 |
| - compat, |
68 | 67 | )
|
69 | 68 | import pandas._testing as tm
|
70 | 69 | from pandas.core import ops
|
|
81 | 80 | del pa
|
82 | 81 | has_pyarrow = True
|
83 | 82 |
|
84 |
| -zoneinfo = None |
85 |
| -if compat.PY39: |
86 |
| - # Import "zoneinfo" could not be resolved (reportMissingImports) |
87 |
| - import zoneinfo # type: ignore[assignment] |
| 83 | +import zoneinfo |
88 | 84 |
|
89 |
| - # Although zoneinfo can be imported in Py39, it is effectively |
90 |
| - # "not available" without tzdata/IANA tz data. |
91 |
| - # We will set zoneinfo to not found in this case |
92 |
| - try: |
93 |
| - zoneinfo.ZoneInfo("UTC") # type: ignore[attr-defined] |
94 |
| - except zoneinfo.ZoneInfoNotFoundError: # type: ignore[attr-defined] |
95 |
| - zoneinfo = None |
| 85 | +try: |
| 86 | + zoneinfo.ZoneInfo("UTC") |
| 87 | +except zoneinfo.ZoneInfoNotFoundError: |
| 88 | + zoneinfo = None # type: ignore[assignment] |
96 | 89 |
|
97 | 90 |
|
98 | 91 | # ----------------------------------------------------------------
|
@@ -1221,7 +1214,12 @@ def iris(datapath) -> DataFrame:
|
1221 | 1214 | timezone(timedelta(hours=-1), name="foo"),
|
1222 | 1215 | ]
|
1223 | 1216 | if zoneinfo is not None:
|
1224 |
| - TIMEZONES.extend([zoneinfo.ZoneInfo("US/Pacific"), zoneinfo.ZoneInfo("UTC")]) |
| 1217 | + TIMEZONES.extend( |
| 1218 | + [ |
| 1219 | + zoneinfo.ZoneInfo("US/Pacific"), # type: ignore[list-item] |
| 1220 | + zoneinfo.ZoneInfo("UTC"), # type: ignore[list-item] |
| 1221 | + ] |
| 1222 | + ) |
1225 | 1223 | TIMEZONE_IDS = [repr(i) for i in TIMEZONES]
|
1226 | 1224 |
|
1227 | 1225 |
|
@@ -1964,9 +1962,7 @@ def using_copy_on_write() -> bool:
|
1964 | 1962 |
|
1965 | 1963 | warsaws = ["Europe/Warsaw", "dateutil/Europe/Warsaw"]
|
1966 | 1964 | if zoneinfo is not None:
|
1967 |
| - warsaws.append( |
1968 |
| - zoneinfo.ZoneInfo("Europe/Warsaw") # pyright: ignore[reportGeneralTypeIssues] |
1969 |
| - ) |
| 1965 | + warsaws.append(zoneinfo.ZoneInfo("Europe/Warsaw")) # type: ignore[arg-type] |
1970 | 1966 |
|
1971 | 1967 |
|
1972 | 1968 | @pytest.fixture(params=warsaws)
|
|
0 commit comments