@@ -78,20 +78,20 @@ except ImportError:
78
78
npdivmod = _npdivmod
79
79
80
80
81
- cdef inline _floor_int64(v, u ):
82
- return v - np.remainder(v, u )
81
+ cdef inline _floor_int64(values, unit ):
82
+ return values - np.remainder(values, unit )
83
83
84
- cdef inline _ceil_int64(v, u ):
85
- return v + np.remainder(- v, u )
84
+ cdef inline _ceil_int64(values, unit ):
85
+ return values + np.remainder(- values, unit )
86
86
87
- cdef inline _rounddown_int64(v, u ):
88
- return _ceil_int64(v - u // 2 , u )
87
+ cdef inline _rounddown_int64(values, unit ):
88
+ return _ceil_int64(values - unit // 2 , unit )
89
89
90
- cdef inline _roundup_int64(v, u ):
91
- return _floor_int64(v + u // 2 , u )
90
+ cdef inline _roundup_int64(values, unit ):
91
+ return _floor_int64(values + unit // 2 , unit )
92
92
93
93
94
- def round_nsint64 (values , mode: RoundTo , freq ):
94
+ def round_nsint64 (values , mode , freq ):
95
95
"""
96
96
Applies rounding mode at given frequency
97
97
@@ -123,15 +123,16 @@ def round_nsint64(values, mode: RoundTo, freq):
123
123
# for odd unit there is no need of a tie break
124
124
if unit % 2 :
125
125
return _rounddown_int64(values, unit)
126
- d, r = npdivmod(values, unit)
126
+ quotient, remainder = npdivmod(values, unit)
127
127
mask = np.logical_or(
128
- r > (unit // 2 ),
129
- np.logical_and(r == (unit // 2 ), d % 2 )
128
+ remainder > (unit // 2 ),
129
+ np.logical_and(remainder == (unit // 2 ), quotient % 2 )
130
130
)
131
- d [mask] += 1
132
- return d * unit
131
+ quotient [mask] += 1
132
+ return quotient * unit
133
133
134
- raise NotImplementedError (mode)
134
+ # this should be unreachable
135
+ assert False , " should never arrive here"
135
136
136
137
137
138
# This is PITA. Because we inherit from datetime, which has very specific
0 commit comments