@@ -511,60 +511,20 @@ def _maybe_cast_slice_bound(self, label, side, kind):
511511
512512 return label
513513
514- def _get_string_slice (self , key , use_lhs = True , use_rhs = True ):
515- freq = getattr (self , 'freqstr' ,
516- getattr (self , 'inferred_freq' , None ))
514+ def _get_string_slice (self , key ):
517515 if is_integer (key ) or is_float (key ) or key is NaT :
518516 self ._invalid_indexer ('slice' , key )
519- loc = self ._partial_td_slice (key , freq , use_lhs = use_lhs ,
520- use_rhs = use_rhs )
517+ loc = self ._partial_td_slice (key )
521518 return loc
522519
523- def _partial_td_slice (self , key , freq , use_lhs = True , use_rhs = True ):
520+ def _partial_td_slice (self , key ):
524521
525522 # given a key, try to figure out a location for a partial slice
526523 if not isinstance (key , compat .string_types ):
527524 return key
528525
529526 raise NotImplementedError
530527
531- # TODO(wesm): dead code
532- # parsed = _coerce_scalar_to_timedelta_type(key, box=True)
533-
534- # is_monotonic = self.is_monotonic
535-
536- # # figure out the resolution of the passed td
537- # # and round to it
538-
539- # # t1 = parsed.round(reso)
540-
541- # t2 = t1 + to_offset(parsed.resolution) - Timedelta(1, 'ns')
542-
543- # stamps = self.asi8
544-
545- # if is_monotonic:
546-
547- # # we are out of range
548- # if (len(stamps) and ((use_lhs and t1.value < stamps[0] and
549- # t2.value < stamps[0]) or
550- # ((use_rhs and t1.value > stamps[-1] and
551- # t2.value > stamps[-1])))):
552- # raise KeyError
553-
554- # # a monotonic (sorted) series can be sliced
555- # left = (stamps.searchsorted(t1.value, side='left')
556- # if use_lhs else None)
557- # right = (stamps.searchsorted(t2.value, side='right')
558- # if use_rhs else None)
559-
560- # return slice(left, right)
561-
562- # lhs_mask = (stamps >= t1.value) if use_lhs else True
563- # rhs_mask = (stamps <= t2.value) if use_rhs else True
564-
565- # # try to find a the dates
566- # return (lhs_mask & rhs_mask).nonzero()[0]
567-
568528 @Substitution (klass = 'TimedeltaIndex' )
569529 @Appender (_shared_docs ['searchsorted' ])
570530 def searchsorted (self , value , side = 'left' , sorter = None ):
0 commit comments