Skip to content

Commit d2bc6a4

Browse files
check_untyped_defs pandas.core.tools.datetimes
1 parent 6ea4eed commit d2bc6a4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pandas/core/tools/datetimes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import abc
22
from datetime import datetime, time
33
from functools import partial
4-
from typing import Optional, TypeVar, Union
4+
from typing import List, Optional, TypeVar, Union
55

66
import numpy as np
77

@@ -325,7 +325,9 @@ def _convert_listlike_datetimes(
325325
if not isinstance(arg, (DatetimeArray, DatetimeIndex)):
326326
return DatetimeIndex(arg, tz=tz, name=name)
327327
if tz == "utc":
328-
arg = arg.tz_convert(None).tz_localize(tz)
328+
# error: Item "DatetimeIndex" of "Union[DatetimeArray, DatetimeIndex]"
329+
# has no attribute "tz_convert" [union-attr]
330+
arg = arg.tz_convert(None).tz_localize(tz) # type: ignore[union-attr]
329331
return arg
330332

331333
elif is_datetime64_ns_dtype(arg):
@@ -1038,7 +1040,7 @@ def _convert_listlike(arg, format):
10381040
if infer_time_format and format is None:
10391041
format = _guess_time_format_for_array(arg)
10401042

1041-
times = []
1043+
times: List[Optional[time]] = []
10421044
if format is not None:
10431045
for element in arg:
10441046
try:

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ check_untyped_defs=False
224224
[mypy-pandas.core.reshape.reshape]
225225
check_untyped_defs=False
226226

227-
[mypy-pandas.core.tools.datetimes]
228-
check_untyped_defs=False
229-
230227
[mypy-pandas.io.excel._openpyxl]
231228
check_untyped_defs=False
232229

0 commit comments

Comments
 (0)