WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE RIGHT [-num:]
550232
def right(self, num=None):
        
        if num == None:
            return self.last.node
        if num <= 0:
            return []

        if not self.list:
            self._build_list()
        return self.list[-num:]
144287
function(arr, num) {
    if (isUndefined(num)) return arr[0];
    if (num < 0) num = 0;
    return arr.slice(0, num);
  }
1033128
function wrap(num, min, max) {
        return num - floor((num - min) / (max - min)) * (max - min)
    }
193753
function(arr, num) {
    if (isUndefined(num)) return arr[arr.length - 1];
    var start = arr.length - num < 0 ? 0 : arr.length - num;
    return arr.slice(start);
  }
1304027
def _process_slice(self, arg):
        
        start = arg.start
        stop = arg.stop
        step = arg.step

        nrows = self._info['nrows']
        if step is None:
            step = 1
        if start is None:
            start = 0
        if stop is None:
            stop = nrows

        if start < 0:
            start = nrows + start
            if start < 0:
                raise IndexError("Index out of bounds")

        if stop < 0:
            stop = nrows + start + 1

        if stop < start:
            # will return an empty struct
            stop = start

        if stop > nrows:
            stop = nrows
        return slice(start, stop, step)
791320
def trim_zeros(self):
              
        tmp = self.numpy()
        f = len(self)-len(_numpy.trim_zeros(tmp, trim='f'))
        b = len(self)-len(_numpy.trim_zeros(tmp, trim='b'))
        return self[f:len(self)-b]
1095457
def get_X_slice(self, rmind):
        ''''''
        if self.forest.optimize_memory_use:
            return self.forest.X[:, rmind][self.subsample]
        else:
            return self.X[:, rmind]
326804
def _create_slice(self, key):
        """"""

        if isinstance(key, slice):
            step = key.step
            if step is None:
                step = 1

            if step != 1:
                raise ArgumentError("You cannot slice with a step that is not equal to 1", step=key.step)

            start_address = key.start
            end_address = key.stop - 1

            start_i, start_seg = self._find_address(start_address)
            end_i, _end_seg = self._find_address(end_address)

            if start_seg is None or start_i != end_i:
                raise ArgumentError("Slice would span invalid data in memory",
                                    start_address=start_address, end_address=end_address)

            block_offset = start_address - start_seg.start_address
            block_length = end_address - start_address + 1

            return start_seg, block_offset, block_offset + block_length
        elif isinstance(key, int):
            start_i, start_seg = self._find_address(key)
            if start_seg is None:
                raise ArgumentError("Requested invalid address", address=key)

            return start_seg, key - start_seg.start_address, None
        else:
            raise ArgumentError("Unknown type of address key", address=key)
23175
def slice_to(self, s):
        '''
        
        '''
        result = ''
        if self.slice_check():
            result = self.current[self.bra:self.ket]
        return result
1112184
def safe_slice(list_, *args):
    
    if len(args) == 3:
        start = args[0]
        stop  = args[1]
        step  = args[2]
    else:
        step = 1
        if len(args) == 2:
            start = args[0]
            stop  = args[1]
        else:
            start = 0
            stop = args[0]
    len_ = len(list_)
    if stop > len_:
        stop = len_
    return list_[slice(start, stop, step)]
557744
def interpolate_slice(slice_rows, slice_cols, interpolator):
    """"""
    fine_rows = np.arange(slice_rows.start, slice_rows.stop, slice_rows.step)
    fine_cols = np.arange(slice_cols.start, slice_cols.stop, slice_cols.step)
    return interpolator(fine_cols, fine_rows)
417838
def slice( start, length )
      unless start.matched? or length.matched?
        if start < 0 or start + length > shape.last
          raise "Range must be in 0 ... #{shape.last} " +
                "(was #{start} ... #{start + length})"
        end
      end
      start = INT.new start unless start.matched?
      length = INT.new length unless length.matched?
      index = Variable.new Hornetseye::INDEX( length )
      Lambda.new( index, @term.subst( @index => index ).
                         skip( index, start ) ).unroll
    end
615587
def slice(self, offset=0):
        
        if self.bytes is None:
            start = 0
            stop  = start + self.nbytes
        elif type(self.bytes) is int:
            start = self.bytes
            stop  = start + self.nbytes
        else:
            start = self.bytes[0]
            stop  = self.bytes[1] + 1

        return slice(start + offset, stop + offset)
404863
def null_slice(slice_):
    
    try:
        slice_ = as_slice(slice_)
    except TypeError:
        return False

    if isinstance(slice_, numpy.ndarray) and numpy.all(slice_):
        return True
    if isinstance(slice_, slice) and slice_ in (
            slice(None, None, None), slice(0, None, 1)
    ):
        return True
755730
function SlicesFactory(width, height, lineXArray, lineYArray, options) {
  checkArgs.apply(null, arguments);

  var slices;

  if (options) {
    slices = new Slices(width, height, lineXArray, lineYArray, options);
  } else {
    slices = new Slices(width, height, lineXArray, lineYArray);
  }

  return slices.slice();
}
173448
def slice_into_pieces(seq, n):
    """"""
    length = len(seq)
    if length % n == 0:
        size = length // n
    else:
        size = length // n + 1
    for it in slice_by_size(seq, size):
        yield it
800611
function slice(str, len, fromLeft) {
    return fromLeft ? str.slice(-len) : str.slice(0, len);
  }