@@ -33,7 +33,7 @@ from numpy cimport (
3333cnp.import_array()
3434
3535
36- cimport pandas._libs.util as util
36+ from pandas._libs cimport util
3737
3838from pandas._libs.hashtable cimport Int64Vector
3939from pandas._libs.tslibs.util cimport (
@@ -42,8 +42,7 @@ from pandas._libs.tslibs.util cimport (
4242 is_timedelta64_object,
4343)
4444
45- from pandas._libs.tslibs import Timestamp
46- from pandas._libs.tslibs.timedeltas import Timedelta
45+ from pandas._libs.tslibs.base cimport ABCTimestamp, ABCTimedelta
4746from pandas._libs.tslibs.timezones cimport tz_compare
4847
4948
@@ -329,7 +328,7 @@ cdef class Interval(IntervalMixin):
329328 raise ValueError (f" invalid option for 'closed': {closed}" )
330329 if not left <= right:
331330 raise ValueError (" left side of interval must be <= right side" )
332- if (isinstance (left, Timestamp ) and
331+ if (isinstance (left, ABCTimestamp ) and
333332 not tz_compare(left.tzinfo, right.tzinfo)):
334333 # GH 18538
335334 raise ValueError (" left and right must have the same time zone, got "
@@ -341,7 +340,7 @@ cdef class Interval(IntervalMixin):
341340 def _validate_endpoint (self , endpoint ):
342341 # GH 23013
343342 if not (is_integer_object(endpoint) or is_float_object(endpoint) or
344- isinstance (endpoint, (Timestamp, Timedelta ))):
343+ isinstance (endpoint, (ABCTimestamp, ABCTimedelta ))):
345344 raise ValueError (" Only numeric, Timestamp and Timedelta endpoints "
346345 " are allowed when constructing an Interval." )
347346
@@ -371,7 +370,7 @@ cdef class Interval(IntervalMixin):
371370 right = self .right
372371
373372 # 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 ):
375374 left = left._short_repr
376375 right = right._short_repr
377376
0 commit comments