@@ -333,8 +333,7 @@ def get_window_indexer(input, win, minp, index, closed,
333
333
bint l_closed = False
334
334
bint r_closed = False
335
335
336
- if closed not in [' right' , ' left' , ' both' , ' neither' ]:
337
- closed = ' right'
336
+ assert closed in [' right' , ' left' , ' both' , ' neither' ]
338
337
339
338
if closed in [' right' , ' both' ]:
340
339
r_closed = True
@@ -359,7 +358,7 @@ def get_window_indexer(input, win, minp, index, closed,
359
358
360
359
361
360
def roll_count (ndarray[double_t] input , int64_t win , int64_t minp ,
362
- object index , closed = ' right ' ):
361
+ object index , object closed ):
363
362
cdef:
364
363
double val, count_x = 0.0
365
364
int64_t s, e, nobs, N
@@ -440,7 +439,7 @@ cdef inline void remove_sum(double val, int64_t *nobs, double *sum_x) nogil:
440
439
441
440
442
441
def roll_sum (ndarray[double_t] input , int64_t win , int64_t minp ,
443
- object index , str closed ):
442
+ object index , object closed ):
444
443
cdef:
445
444
double val, prev_x, sum_x = 0
446
445
int64_t s, e
@@ -556,7 +555,7 @@ cdef inline void remove_mean(double val, Py_ssize_t *nobs, double *sum_x,
556
555
557
556
558
557
def roll_mean (ndarray[double_t] input , int64_t win , int64_t minp ,
559
- object index , str closed ):
558
+ object index , object closed ):
560
559
cdef:
561
560
double val, prev_x, result, sum_x = 0
562
561
int64_t s, e
@@ -681,7 +680,7 @@ cdef inline void remove_var(double val, double *nobs, double *mean_x,
681
680
682
681
683
682
def roll_var (ndarray[double_t] input , int64_t win , int64_t minp ,
684
- object index , str closed , int ddof = 1 ):
683
+ object index , object closed , int ddof = 1 ):
685
684
"""
686
685
Numerically stable implementation using Welford's method.
687
686
"""
@@ -824,7 +823,7 @@ cdef inline void remove_skew(double val, int64_t *nobs, double *x, double *xx,
824
823
825
824
826
825
def roll_skew (ndarray[double_t] input , int64_t win , int64_t minp ,
827
- object index , str closed ):
826
+ object index , object closed ):
828
827
cdef:
829
828
double val, prev
830
829
double x = 0 , xx = 0 , xxx = 0
@@ -952,7 +951,7 @@ cdef inline void remove_kurt(double val, int64_t *nobs, double *x, double *xx,
952
951
953
952
954
953
def roll_kurt (ndarray[double_t] input , int64_t win , int64_t minp ,
955
- object index , str closed ):
954
+ object index , object closed ):
956
955
cdef:
957
956
double val, prev
958
957
double x = 0 , xx = 0 , xxx = 0 , xxxx = 0
@@ -1022,7 +1021,7 @@ def roll_kurt(ndarray[double_t] input, int64_t win, int64_t minp,
1022
1021
1023
1022
1024
1023
def roll_median_c (ndarray[float64_t] input , int64_t win , int64_t minp ,
1025
- object index , str closed ):
1024
+ object index , object closed ):
1026
1025
cdef:
1027
1026
double val, res, prev
1028
1027
bint err= 0 , is_variable
@@ -1148,7 +1147,7 @@ cdef inline numeric calc_mm(int64_t minp, Py_ssize_t nobs,
1148
1147
1149
1148
1150
1149
def roll_max (ndarray[numeric] input , int64_t win , int64_t minp ,
1151
- object index , str closed ):
1150
+ object index , object closed ):
1152
1151
"""
1153
1152
Moving max of 1d array of any numeric type along axis=0 ignoring NaNs.
1154
1153
@@ -1168,7 +1167,7 @@ def roll_max(ndarray[numeric] input, int64_t win, int64_t minp,
1168
1167
1169
1168
1170
1169
def roll_min (ndarray[numeric] input , int64_t win , int64_t minp ,
1171
- object index , str closed ):
1170
+ object index , object closed ):
1172
1171
"""
1173
1172
Moving max of 1d array of any numeric type along axis=0 ignoring NaNs.
1174
1173
@@ -1185,7 +1184,7 @@ def roll_min(ndarray[numeric] input, int64_t win, int64_t minp,
1185
1184
1186
1185
1187
1186
cdef _roll_min_max(ndarray[numeric] input , int64_t win, int64_t minp,
1188
- object index, str closed, bint is_max):
1187
+ object index, object closed, bint is_max):
1189
1188
"""
1190
1189
Moving min/max of 1d array of any numeric type along axis=0
1191
1190
ignoring NaNs.
@@ -1312,7 +1311,7 @@ cdef _roll_min_max(ndarray[numeric] input, int64_t win, int64_t minp,
1312
1311
1313
1312
1314
1313
def roll_quantile (ndarray[float64_t , cast = True ] input , int64_t win ,
1315
- int64_t minp , object index , str closed ,
1314
+ int64_t minp , object index , object closed ,
1316
1315
double quantile ):
1317
1316
"""
1318
1317
O(N log(window)) implementation using skip list
@@ -1376,7 +1375,7 @@ def roll_quantile(ndarray[float64_t, cast=True] input, int64_t win,
1376
1375
1377
1376
1378
1377
def roll_generic (ndarray[float64_t , cast = True ] input ,
1379
- int64_t win , int64_t minp , object index , str closed ,
1378
+ int64_t win , int64_t minp , object index , object closed ,
1380
1379
int offset , object func ,
1381
1380
object args , object kwargs ):
1382
1381
cdef:
0 commit comments