if we are index sliceable, then return my slicer, otherwise return None
326791
def convert_to_index_sliceable(obj, key):
    
    idx = obj.index
    if isinstance(key, slice):
        return idx._convert_slice_indexer(key, kind='getitem')

    elif isinstance(key, str):

        # we are an actual column
        if obj._data.items.contains(key):
            return None

        # We might have a datetimelike string that we can translate to a
        # slice here via partial string indexing
        if idx.is_all_dates:
            try:
                return idx._get_string_slice(key)
            except (KeyError, ValueError, NotImplementedError):
                return None

    return None
574826
def __get_slice(data, slice_number, axis=0, flipH=False, flipV=False):
    
    if axis == 0:
        data2d =  data[slice_number, :, :]
    elif axis == 1:
        data2d = data[:, slice_number, :]
    elif axis == 2:
        data2d = data[:, :, slice_number]
    else:
        logger.error("axis number error")
        print("axis number error")
        return None

    if flipV:
        if data2d is not None:
            data2d = data2d[-1:0:-1,:]
    if flipH:
        if data2d is not None:
            data2d = data2d[:, -1:0:-1]
    return data2d
329447
function fromIndex(a, index) {
    var arr = is.isArguments(a) ? arraySlice.call(a) : a;
    return arraySlice.call(arr, index, arr.length);
}
511200
function(timeSlice) {
      var i = tr.b.findLowIndexInSortedArray(
          this.timeSlices,
          function(slice) { return slice.start; },
          timeSlice.start);
      if (this.timeSlices[i] !== timeSlice)
        return undefined;
      return i;
    }
888626
def slice!(slice = nil)
      raise(Exception, "Slicing unavailable!") unless sliced?
      if slice.present?
        if slice.to_i.in?(1..slice_number)
          @current_slice = slice.to_i
        else
          raise(ArgumentError, "Slice number must be Integer in (1..#{slice_number}). #{slice.inspect} passed.")
        end
      end
      self
    end
332685
def __getitem_slice(self, slce):
        
        scaled_indices = (self._step * n for n in slce.indices(self._len))
        start_offset, stop_offset, new_step = scaled_indices
        return newrange(self._start + start_offset,
                        self._start + stop_offset,
                        new_step)
803649
def at_index(iterable, index):
    # type: (Iterable[T], int) -> T
    "
    try:
        if index < 0:
            return deque(iterable, maxlen=abs(index)).popleft()

        return next(itertools.islice(iterable, index, index + 1))
    except (StopIteration, IndexError) as e:
        raise_from(IndexError('Index "%d" out of range' % index), e)
921522
def get_value(self, index=None):
        

        if self.value is None:
            return self.default
        if index is not None:
            if self.value[index] is None:
                return self.default
            else:
                value = self.value[index]
        else:
            value = self.value

        return value
378152
def get_tuple(nuplet, index, default=None):
    
    if nuplet is None:
        return default
    try:
        return nuplet[index]
    except IndexError:
        return default
1021800
def slice(self, start=None, stop=None, step=None):
        
        check_type(start, int)
        check_type(stop, int)
        check_type(step, int)

        if step is not None and step < 0:
            raise ValueError('Only positive steps are currently supported')

        return _series_str_result(self, weld_str_slice, start=start, stop=stop, step=step)
274150
def normalize_slice(length, index):
    ""
    is_int = False
    if isinstance(index, int):
        is_int = True
        index = slice(index, index+1)
    if index.start is None:
        index = slice(0, index.stop, index.step)
    if index.stop is None:
        index = slice(index.start, length, index.step)
    if index.start < -1:         # XXX why must this be -1?
        index = slice(length - index.start, index.stop, index.step)
    if index.stop < -1:          # XXX why must this be -1?
        index = slice(index.start, length - index.stop, index.step)
    if index.step is not None:
        raise NotImplementedError("You can't use steps with slicing yet")
    if is_int:
        if index.start < 0 or index.start > length:
            raise IndexError("index out of bounds: %r for length %s" % (index, length))
    return index
974341
def _slice_required_len(slice_obj):
    
    if slice_obj.step and slice_obj.step != 1:
        return None
    # (None, None, *) requires the entire list
    if slice_obj.start is None and slice_obj.stop is None:
        return None

    # Negative indexes are hard without knowing the collection length
    if slice_obj.start and slice_obj.start < 0:
        return None
    if slice_obj.stop and slice_obj.stop < 0:
        return None

    if slice_obj.stop:
        if slice_obj.start and slice_obj.start > slice_obj.stop:
            return 0
        return slice_obj.stop
    return slice_obj.start + 1
892186
def _get_slice_request_data(self, index):
        '''
        
        '''
        # Do a check on list indices for early error detection
        if not is_slice_or_dim_range(index):
            single_depth = self._get_single_depth(index)
            # Single value indices for first single_depth values
            if single_depth > 0:
                # We have integer request first
                subindicies = index[:single_depth]
                sublist = self
                # Use the other side of __getitem__ to grab subindices
                for sind in subindicies:
                    sublist = sublist[sind]
                # If we still have some index requests left or dimension
                # restrictions, then return a FixedListSubset
                if single_depth < len(index) or isinstance(sublist, FixedListSubset):
                    new_dim_ranges = self._combine_dimension_lists(self._dim_ranges, index)
                    return self.builder(sublist, *new_dim_ranges[single_depth:])
                # Otherwise our sublist is actually an element of the
                # original data, so just return it
                else:
                    return sublist
        new_dim_ranges = self._combine_dimension_lists(self._dim_ranges, index)
        return self.builder(self._data, *new_dim_ranges)
1206597
static Slice compactSlice(Slice slice, int index, int length)
    {
        if (slice.isCompact() && index == 0 && length == slice.length()) {
            return slice;
        }
        return Slices.copyOf(slice, index, length);
    }
1160829
def slice_on_length(self, data_len, *addSlices):
        '''
        
        '''
        if len(self.ordered_ranges) + len(addSlices) == 0:
            return slice(None,None,None)
        ranges = self.ordered_ranges
        if len(addSlices) > 0:
            ranges = ranges + DimensionRange(*addSlices).ordered_ranges
        return self._combine_lists_of_ranges_on_length(data_len, *ranges)
815798
def _slice(self, slicer):
        
        if isinstance(slicer, tuple):
            col, loc = slicer
            if not com.is_null_slice(col) and col != 0:
                raise IndexError("{0} only contains one item".format(self))
            return self.values[loc]
        return self.values[slicer]
1351585
function slice(start, end) {
    var index = -1,
        object = Object(this),
        length = object.length >>> 0,
        result = [];

    start = toInteger(start);
    start = start < 0 ? max(length + start, 0) : min(start, length);
    start--;
    end = end == null ? length : toInteger(end);
    end = end < 0 ? max(length + end, 0) : min(end, length);

    while ((++index, ++start) < end) {
      if (start in object) {
        result[index] = object[start];
      }
    }
    return result;
  }