Skip to content

Commit 37cb788

Browse files
fangchenliJulianWgs
authored andcommitted
use type annotations in timezones.pyi (pandas-dev#41769)
1 parent 97faa71 commit 37cb788

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

pandas/_libs/tslibs/timezones.pyi

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1+
from __future__ import annotations
2+
13
from datetime import (
24
datetime,
35
tzinfo,
46
)
5-
from typing import (
6-
Callable,
7-
Optional,
8-
Union,
9-
)
7+
from typing import Callable
108

119
import numpy as np
1210

1311
# imported from dateutil.tz
1412
dateutil_gettz: Callable[[str], tzinfo]
1513

16-
1714
def tz_standardize(tz: tzinfo) -> tzinfo: ...
18-
19-
def tz_compare(start: Optional[tzinfo], end: Optional[tzinfo]) -> bool: ...
20-
15+
def tz_compare(start: tzinfo | None, end: tzinfo | None) -> bool: ...
2116
def infer_tzinfo(
22-
start: Optional[datetime], end: Optional[datetime],
23-
) -> Optional[tzinfo]: ...
17+
start: datetime | None,
18+
end: datetime | None,
19+
) -> tzinfo | None: ...
2420

2521
# ndarrays returned are both int64_t
2622
def get_dst_info(tz: tzinfo) -> tuple[np.ndarray, np.ndarray, str]: ...
27-
28-
def maybe_get_tz(tz: Optional[Union[str, int, np.int64, tzinfo]]) -> Optional[tzinfo]: ...
29-
30-
def get_timezone(tz: tzinfo) -> Union[tzinfo, str]: ...
31-
32-
def is_utc(tz: Optional[tzinfo]) -> bool: ...
23+
def maybe_get_tz(tz: str | int | np.int64 | tzinfo | None) -> tzinfo | None: ...
24+
def get_timezone(tz: tzinfo) -> tzinfo | str: ...
25+
def is_utc(tz: tzinfo | None) -> bool: ...

0 commit comments

Comments
 (0)