@@ -78,20 +78,20 @@ except ImportError:
7878 npdivmod = _npdivmod
7979
8080
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 )
8383
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 )
8686
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 )
8989
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 )
9292
9393
94- def round_nsint64 (values , mode: RoundTo , freq ):
94+ def round_nsint64 (values , mode , freq ):
9595 """
9696 Applies rounding mode at given frequency
9797
@@ -123,15 +123,16 @@ def round_nsint64(values, mode: RoundTo, freq):
123123 # for odd unit there is no need of a tie break
124124 if unit % 2 :
125125 return _rounddown_int64(values, unit)
126- d, r = npdivmod(values, unit)
126+ quotient, remainder = npdivmod(values, unit)
127127 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 )
130130 )
131- d [mask] += 1
132- return d * unit
131+ quotient [mask] += 1
132+ return quotient * unit
133133
134- raise NotImplementedError (mode)
134+ # this should be unreachable
135+ assert False , " should never arrive here"
135136
136137
137138# This is PITA. Because we inherit from datetime, which has very specific
0 commit comments