@@ -120,7 +120,7 @@ class TimedeltaArray(dtl.TimelikeOps):
120
120
"ceil" ,
121
121
]
122
122
123
- # Note: ndim must be defined to ensure NaT.__richcmp (TimedeltaArray)
123
+ # Note: ndim must be defined to ensure NaT.__richcmp__ (TimedeltaArray)
124
124
# operates pointwise.
125
125
126
126
def _box_func (self , x ) -> Union [Timedelta , NaTType ]:
@@ -520,7 +520,7 @@ def __mul__(self, other) -> "TimedeltaArray":
520
520
def __truediv__ (self , other ):
521
521
# timedelta / X is well-defined for timedelta-like or numeric X
522
522
523
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
523
+ if isinstance (other , self . _recognized_scalars ):
524
524
other = Timedelta (other )
525
525
if other is NaT :
526
526
# specifically timedelta64-NaT
@@ -577,7 +577,7 @@ def __truediv__(self, other):
577
577
@unpack_zerodim_and_defer ("__rtruediv__" )
578
578
def __rtruediv__ (self , other ):
579
579
# X / timedelta is defined only for timedelta-like X
580
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
580
+ if isinstance (other , self . _recognized_scalars ):
581
581
other = Timedelta (other )
582
582
if other is NaT :
583
583
# specifically timedelta64-NaT
@@ -620,7 +620,7 @@ def __rtruediv__(self, other):
620
620
def __floordiv__ (self , other ):
621
621
622
622
if is_scalar (other ):
623
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
623
+ if isinstance (other , self . _recognized_scalars ):
624
624
other = Timedelta (other )
625
625
if other is NaT :
626
626
# treat this specifically as timedelta-NaT
@@ -684,7 +684,7 @@ def __floordiv__(self, other):
684
684
def __rfloordiv__ (self , other ):
685
685
686
686
if is_scalar (other ):
687
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
687
+ if isinstance (other , self . _recognized_scalars ):
688
688
other = Timedelta (other )
689
689
if other is NaT :
690
690
# treat this specifically as timedelta-NaT
@@ -730,21 +730,21 @@ def __rfloordiv__(self, other):
730
730
@unpack_zerodim_and_defer ("__mod__" )
731
731
def __mod__ (self , other ):
732
732
# Note: This is a naive implementation, can likely be optimized
733
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
733
+ if isinstance (other , self . _recognized_scalars ):
734
734
other = Timedelta (other )
735
735
return self - (self // other ) * other
736
736
737
737
@unpack_zerodim_and_defer ("__rmod__" )
738
738
def __rmod__ (self , other ):
739
739
# Note: This is a naive implementation, can likely be optimized
740
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
740
+ if isinstance (other , self . _recognized_scalars ):
741
741
other = Timedelta (other )
742
742
return other - (other // self ) * self
743
743
744
744
@unpack_zerodim_and_defer ("__divmod__" )
745
745
def __divmod__ (self , other ):
746
746
# Note: This is a naive implementation, can likely be optimized
747
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
747
+ if isinstance (other , self . _recognized_scalars ):
748
748
other = Timedelta (other )
749
749
750
750
res1 = self // other
@@ -754,7 +754,7 @@ def __divmod__(self, other):
754
754
@unpack_zerodim_and_defer ("__rdivmod__" )
755
755
def __rdivmod__ (self , other ):
756
756
# Note: This is a naive implementation, can likely be optimized
757
- if isinstance (other , ( timedelta , np . timedelta64 , Tick ) ):
757
+ if isinstance (other , self . _recognized_scalars ):
758
758
other = Timedelta (other )
759
759
760
760
res1 = other // self
0 commit comments