From 7a822e434874dcbc166084573b9a173b06b3bb82 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Thu, 31 Aug 2017 11:43:27 -0700 Subject: [PATCH 1/2] Delete declarations that are never used --- pandas/_libs/tslib.pyx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 5dd30072fb7aa..2312855a3acd1 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -1054,8 +1054,6 @@ cdef class _Timestamp(datetime): int ndim if isinstance(other, _Timestamp): - if isinstance(other, _NaT): - return _cmp_nat_dt(other, self, _reverse_ops[op]) ots = other elif isinstance(other, datetime): if self.nanosecond == 0: @@ -3882,7 +3880,7 @@ fields = ['year', 'quarter', 'month', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond', 'week', 'dayofyear', 'weekofyear', 'days_in_month', 'daysinmonth', 'dayofweek', 'weekday_name', 'days', 'seconds', 'microseconds', - 'nanoseconds', 'qyear', 'quarter'] + 'nanoseconds', 'qyear'] for field in fields: prop = property(fget=lambda self: np.nan) setattr(NaTType, field, prop) @@ -4620,7 +4618,6 @@ def build_field_sarray(ndarray[int64_t] dtindex): """ cdef: Py_ssize_t i, count = 0 - int isleap pandas_datetimestruct dts ndarray[int32_t] years, months, days, hours, minutes, seconds, mus @@ -5270,7 +5267,6 @@ cpdef _isleapyear_arr(ndarray years): def monthrange(int64_t year, int64_t month): cdef: int64_t days - int64_t day_of_week if month < 1 or month > 12: raise ValueError("bad month number 0; must be 1-12") From 3ebd4abbfec415eaa673fabbb0416440d898dc97 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Thu, 31 Aug 2017 11:52:17 -0700 Subject: [PATCH 2/2] Fixup, had removed check in the wrong place --- pandas/_libs/tslib.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 2312855a3acd1..50e0b77c6d3a0 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -1054,6 +1054,8 @@ cdef class _Timestamp(datetime): int ndim if isinstance(other, _Timestamp): + if isinstance(other, _NaT): + return _cmp_nat_dt(other, self, _reverse_ops[op]) ots = other elif isinstance(other, datetime): if self.nanosecond == 0: @@ -2620,8 +2622,6 @@ cdef class _Timedelta(timedelta): int ndim if isinstance(other, _Timedelta): - if isinstance(other, _NaT): - return _cmp_nat_dt(other, self, _reverse_ops[op]) ots = other elif isinstance(other, timedelta): ots = Timedelta(other)