Skip to content

Commit e83ff29

Browse files
committed
CLN: switch from isinstance to treat_tz_asdateutil
1 parent 664d928 commit e83ff29

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pandas/_libs/tslibs/conversion.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ cimport numpy as cnp
55
from numpy cimport int64_t, int32_t, intp_t, ndarray
66
cnp.import_array()
77

8-
from dateutil.tz import tzfile as _dateutil_tzfile
9-
108
import pytz
119

1210
# stdlib datetime imports
@@ -31,7 +29,7 @@ from pandas._libs.tslibs.util cimport (
3129
from pandas._libs.tslibs.timedeltas cimport cast_from_unit
3230
from pandas._libs.tslibs.timezones cimport (
3331
is_utc, is_tzlocal, is_fixed_offset, get_utcoffset, get_dst_info,
34-
get_timezone, maybe_get_tz, tz_compare)
32+
get_timezone, maybe_get_tz, tz_compare, treat_tz_as_dateutil)
3533
from pandas._libs.tslibs.timezones import UTC
3634
from pandas._libs.tslibs.parsing import parse_datetime_string
3735

@@ -385,9 +383,8 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz,
385383
else:
386384
obj.value = pydatetime_to_dt64(ts, &obj.dts)
387385
# GH 24329 Take DST offset into account
388-
# use dateutil.tz.tzfile to check type
389386
if ts.tzinfo is not None:
390-
if isinstance(ts.tzinfo, _dateutil_tzfile):
387+
if treat_tz_as_dateutil(ts.tzinfo):
391388
if ts.tzinfo.is_ambiguous(ts):
392389
dst_offset = ts.tzinfo.dst(ts)
393390
obj.value += int(dst_offset.total_seconds() * 1e9)

0 commit comments

Comments
 (0)