@@ -33,7 +33,7 @@ from numpy cimport (
33
33
cnp.import_array()
34
34
35
35
36
- cimport pandas._libs.util as util
36
+ from pandas._libs cimport util
37
37
38
38
from pandas._libs.hashtable cimport Int64Vector
39
39
from pandas._libs.tslibs.util cimport (
@@ -42,8 +42,7 @@ from pandas._libs.tslibs.util cimport (
42
42
is_timedelta64_object,
43
43
)
44
44
45
- from pandas._libs.tslibs import Timestamp
46
- from pandas._libs.tslibs.timedeltas import Timedelta
45
+ from pandas._libs.tslibs.base cimport ABCTimestamp, ABCTimedelta
47
46
from pandas._libs.tslibs.timezones cimport tz_compare
48
47
49
48
@@ -329,7 +328,7 @@ cdef class Interval(IntervalMixin):
329
328
raise ValueError (f" invalid option for 'closed': {closed}" )
330
329
if not left <= right:
331
330
raise ValueError (" left side of interval must be <= right side" )
332
- if (isinstance (left, Timestamp ) and
331
+ if (isinstance (left, ABCTimestamp ) and
333
332
not tz_compare(left.tzinfo, right.tzinfo)):
334
333
# GH 18538
335
334
raise ValueError (" left and right must have the same time zone, got "
@@ -341,7 +340,7 @@ cdef class Interval(IntervalMixin):
341
340
def _validate_endpoint (self , endpoint ):
342
341
# GH 23013
343
342
if not (is_integer_object(endpoint) or is_float_object(endpoint) or
344
- isinstance (endpoint, (Timestamp, Timedelta ))):
343
+ isinstance (endpoint, (ABCTimestamp, ABCTimedelta ))):
345
344
raise ValueError (" Only numeric, Timestamp and Timedelta endpoints "
346
345
" are allowed when constructing an Interval." )
347
346
@@ -371,7 +370,7 @@ cdef class Interval(IntervalMixin):
371
370
right = self .right
372
371
373
372
# TODO: need more general formatting methodology here
374
- if isinstance (left, Timestamp ) and isinstance (right, Timestamp ):
373
+ if isinstance (left, ABCTimestamp ) and isinstance (right, ABCTimestamp ):
375
374
left = left._short_repr
376
375
right = right._short_repr
377
376
0 commit comments