@@ -213,7 +213,8 @@ cdef class IndexEngine:
213
213
return self.monotonic_dec == 1
214
214
215
215
cdef inline _do_monotonic_check(self ):
216
- cdef object is_unique
216
+ cdef:
217
+ bint is_unique
217
218
try :
218
219
values = self ._get_index_values()
219
220
self .monotonic_inc, self .monotonic_dec, is_unique = \
@@ -236,10 +237,10 @@ cdef class IndexEngine:
236
237
cdef _call_monotonic(self , values):
237
238
return algos.is_monotonic(values, timelike = False )
238
239
239
- def get_backfill_indexer (self , other , limit = None ):
240
+ def get_backfill_indexer (self , other: np. ndarray , limit = None ) -> np.ndarray :
240
241
return algos.backfill(self._get_index_values(), other , limit = limit)
241
242
242
- def get_pad_indexer (self , other , limit = None ):
243
+ def get_pad_indexer(self , other: np. ndarray , limit = None ) -> np.ndarray :
243
244
return algos.pad(self._get_index_values(), other , limit = limit)
244
245
245
246
cdef _make_hash_table(self , Py_ssize_t n ):
@@ -477,13 +478,13 @@ cdef class DatetimeEngine(Int64Engine):
477
478
values = np.asarray(values).view(' i8' )
478
479
return self .mapping.lookup(values)
479
480
480
- def get_pad_indexer (self , other , limit = None ):
481
+ def get_pad_indexer (self , other: np. ndarray , limit = None ) -> np.ndarray :
481
482
if other.dtype != self._get_box_dtype():
482
483
return np.repeat(- 1 , len (other)).astype(' i4' )
483
484
other = np.asarray(other).view(' i8' )
484
485
return algos.pad(self ._get_index_values(), other, limit = limit)
485
486
486
- def get_backfill_indexer (self , other , limit = None ):
487
+ def get_backfill_indexer (self , other: np. ndarray , limit = None ) -> np.ndarray :
487
488
if other.dtype != self._get_box_dtype():
488
489
return np.repeat(- 1 , len (other)).astype(' i4' )
489
490
other = np.asarray(other).view(' i8' )
@@ -506,16 +507,13 @@ cdef class PeriodEngine(Int64Engine):
506
507
cdef _get_index_values(self ):
507
508
return super (PeriodEngine, self ).vgetter().view(" i8" )
508
509
509
- cdef void _call_map_locations(self , values):
510
- # super(...) pattern doesn't seem to work with `cdef`
511
- Int64Engine._call_map_locations(self , values.view(' i8' ))
512
-
513
510
cdef _call_monotonic(self , values):
514
511
# super(...) pattern doesn't seem to work with `cdef`
515
512
return Int64Engine._call_monotonic(self , values.view(' i8' ))
516
513
517
514
def get_indexer (self , values ):
518
- cdef ndarray[int64_t, ndim= 1 ] ordinals
515
+ cdef:
516
+ ndarray[int64_t, ndim= 1 ] ordinals
519
517
520
518
super (PeriodEngine, self )._ensure_mapping_populated()
521
519
@@ -524,14 +522,14 @@ cdef class PeriodEngine(Int64Engine):
524
522
525
523
return self .mapping.lookup(ordinals)
526
524
527
- def get_pad_indexer (self , other , limit = None ):
525
+ def get_pad_indexer (self , other: np. ndarray , limit = None ) -> np.ndarray :
528
526
freq = super (PeriodEngine, self ).vgetter().freq
529
527
ordinal = periodlib.extract_ordinals(other, freq)
530
528
531
529
return algos.pad(self._get_index_values(),
532
530
np.asarray(ordinal ), limit = limit)
533
531
534
- def get_backfill_indexer (self , other , limit = None ):
532
+ def get_backfill_indexer(self , other: np. ndarray , limit = None ) -> np.ndarray :
535
533
freq = super (PeriodEngine, self ).vgetter().freq
536
534
ordinal = periodlib.extract_ordinals(other, freq)
537
535
0 commit comments