@@ -387,6 +387,10 @@ cdef class _Timestamp(ABCTimestamp):
387
387
dtype = object ,
388
388
)
389
389
390
+ elif not isinstance (self , _Timestamp):
391
+ # cython semantics, args have been switched and this is __radd__
392
+ return other.__add__ (self )
393
+
390
394
return NotImplemented
391
395
392
396
def __sub__ (self , other ):
@@ -1051,7 +1055,7 @@ timedelta}, default 'raise'
1051
1055
return Period(self , freq = freq)
1052
1056
1053
1057
@property
1054
- def dayofweek (self ):
1058
+ def dayofweek (self ) -> int :
1055
1059
"""
1056
1060
Return day of the week.
1057
1061
"""
@@ -1092,7 +1096,7 @@ timedelta}, default 'raise'
1092
1096
return self._get_date_name_field('month_name', locale )
1093
1097
1094
1098
@property
1095
- def dayofyear(self ):
1099
+ def dayofyear(self ) -> int :
1096
1100
"""
1097
1101
Return the day of the year.
1098
1102
"""
@@ -1115,7 +1119,7 @@ timedelta}, default 'raise'
1115
1119
return ((self.month - 1) // 3) + 1
1116
1120
1117
1121
@property
1118
- def days_in_month(self ):
1122
+ def days_in_month(self ) -> int :
1119
1123
"""
1120
1124
Return the number of days in the month.
1121
1125
"""
@@ -1428,16 +1432,7 @@ default 'raise'
1428
1432
1429
1433
return base1 + base2
1430
1434
1431
- def _has_time_component (self ) -> bool:
1432
- """
1433
- Returns if the Timestamp has a time component
1434
- in addition to the date part
1435
- """
1436
- return (self.time() != _zero_time
1437
- or self.tzinfo is not None
1438
- or self.nanosecond != 0)
1439
-
1440
- def to_julian_date(self ):
1435
+ def to_julian_date (self ) -> np.float64:
1441
1436
"""
1442
1437
Convert TimeStamp to a Julian Date.
1443
1438
0 Julian date is noon January 1, 4713 BC.
@@ -1474,11 +1469,6 @@ default 'raise'
1474
1469
np.array([self .value], dtype = ' i8' ), tz = self .tz)[0 ]
1475
1470
return Timestamp(normalized_value).tz_localize(self .tz)
1476
1471
1477
- def __radd__ (self , other ):
1478
- # __radd__ on cython extension types like _Timestamp is not used, so
1479
- # define it here instead
1480
- return self + other
1481
-
1482
1472
1483
1473
# Add the min and max fields at the class level
1484
1474
cdef int64_t _NS_UPPER_BOUND = np.iinfo(np.int64).max
0 commit comments