Skip to content

Commit 5053889

Browse files
committed
CLN: switch from isinstance to treat_tz_asdateutil
1 parent b4fd497 commit 5053889

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pandas/_libs/tslibs/conversion.pyx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +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.zoneinfo import tzfile as du_tzfile1
9-
from dateutil.tz.tz import tzfile as du_tzfile2
10-
118
import pytz
129

1310
# stdlib datetime imports
@@ -32,7 +29,7 @@ from pandas._libs.tslibs.util cimport (
3229
from pandas._libs.tslibs.timedeltas cimport cast_from_unit
3330
from pandas._libs.tslibs.timezones cimport (
3431
is_utc, is_tzlocal, is_fixed_offset, get_utcoffset, get_dst_info,
35-
get_timezone, maybe_get_tz, tz_compare)
32+
get_timezone, maybe_get_tz, tz_compare, treat_tz_as_dateutil)
3633
from pandas._libs.tslibs.timezones import UTC
3734
from pandas._libs.tslibs.parsing import parse_datetime_string
3835

@@ -366,10 +363,7 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz,
366363
else:
367364
obj.value = pydatetime_to_dt64(ts, &obj.dts)
368365
# GH 24329 Take DST offset into account
369-
# Two check in if necessary because class
370-
# differs on Windows and Linux
371-
if (isinstance(ts.tzinfo, du_tzfile1) or
372-
isinstance(ts.tzinfo, du_tzfile2)):
366+
if treat_tz_as_dateutil(ts.tzinfo):
373367
if ts.tzinfo.is_ambiguous(ts):
374368
dst_offset = ts.tzinfo.dst(ts)
375369
obj.value += int(dst_offset.total_seconds() * 1e9)

0 commit comments

Comments
 (0)