WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE LEFT [:-num:]
349344
def not_right(self, num):
        
        if not self.list:
            self._build_list()

        if num == None:
            return self.list[:-1:]
        if num <= 0:
            return []

        return self.list[:-num:]
95024
def _linear_selection(self, non_empty_slices, num_slices):
        """"""

        num_non_empty = len(non_empty_slices)

        # # trying to skip 5% slices at the tails (bottom clipping at 0)
        # skip_count = max(0, np.around(num_non_empty * 0.05).astype('int16'))
        # # only when possible
        # if skip_count > 0 and (num_non_empty - 2 * skip_count > num_slices):
        #     non_empty_slices = non_empty_slices[skip_count: -skip_count]
        #     num_non_empty = len(non_empty_slices)

        sampled_indices = np.linspace(0, num_non_empty, num=min(num_non_empty, num_slices),
                                      endpoint=False)
        slices_in_dim = non_empty_slices[np.around(sampled_indices).astype('int64')]

        return slices_in_dim
732361
def from_slice(cls, coord):
        """"""
        if coord.step is not None:
            raise NotImplementedError('no slice step support')
        elif coord.start is not None and coord.stop is not None:
            return DoubleSlice.from_slice(coord)
        elif coord.start is not None:
            xcol, xrow, col, row = cls._parse(coord.start)
            if xcol is not None:
                return StartCell(cls._cint(xcol), cls._rint(xrow))
            elif col is not None:
                return StartCol(cls._cint(col))
            return StartRow(cls._rint(row))
        elif coord.stop is not None:
            xcol, xrow, col, row = cls._parse(coord.stop)
            if xcol is not None:
                return StopCell(cls._cint(xcol) + 1, cls._rint(xrow) + 1)
            elif col is not None:
                return StopCol(cls._cint(col) + 1)
            return StopRow(cls._rint(row) + 1)
        return cls()
868449
def __flip(self, sliceimg):
        
        if self.flipH:
            sliceimg = sliceimg[:, -1:0:-1]

        if self.flipV:
            sliceimg = sliceimg [-1:0:-1,:]

        return sliceimg
620370
def slice! *args
      b, l = get_beginning_and_length *args
      head, sliced, tail = ()
      sliced = l.nil? ? self.slice(b) : self.slice(b, l)
      head = self.slice(0, b)
      l = 1 if l.nil?
      tail = self.slice((b + l)..-1)
      self.clear
      self.concat head + tail
      sliced
    end
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);
  }
1267057
def STORE_SLICE_3(self, instr):
        ''

        upper = self.ast_stack.pop()
        lower = self.ast_stack.pop()
        value = self.ast_stack.pop()
        expr = self.ast_stack.pop()
        
        kw = dict(lineno=instr.lineno, col_offset=0)
        slice = _ast.Slice(lower=lower, step=None, upper=upper, **kw)
        subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Store(), **kw)
        
        if isinstance(expr, _ast.AugAssign):
            assign = expr
            result = cmp_ast(expr.target, subscr)
            
            assert result
        else:
            assign = _ast.Assign(targets=[subscr], value=expr, **kw)
            
        self.ast_stack.append(assign)
85245
def bisect_index(a, x):
    
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError
1356863
def _slice(index, n_samples, margin=None):
    """"""
    if margin is None:
        margin = (0, 0)
    assert isinstance(n_samples, (tuple, list))
    assert len(n_samples) == 2
    before, after = n_samples
    assert isinstance(margin, (tuple, list))
    assert len(margin) == 2
    margin_before, margin_after = margin
    before += margin_before
    after += margin_after
    index = int(index)
    before = int(before)
    after = int(after)
    return slice(max(0, index - before), index + after, None)
142475
def pick_slices(img, num_slices_per_view):
    

    slices = list()
    for view in range(len(img.shape)):
        dim_size = img.shape[view]
        non_empty_slices = np.array(
            [sl for sl in range(dim_size) if np.count_nonzero(get_axis(img, view, sl)) > 0])
        num_non_empty = len(non_empty_slices)

        # trying to 5% slices at the tails (bottom clipping at 0)
        skip_count = max(0, np.around(num_non_empty * 0.05).astype('int16'))
        # only when possible
        if skip_count > 0 and (num_non_empty - 2 * skip_count >= num_slices_per_view):
            non_empty_slices = non_empty_slices[skip_count: -skip_count]
            num_non_empty = len(non_empty_slices)

        # sampling non-empty slices only
        sampled_indices = np.linspace(0, num_non_empty, num=min(num_non_empty, num_slices_per_view),
                                      endpoint=False)
        slices_in_dim = non_empty_slices[np.around(sampled_indices).astype('int64')]

        # ensure you do not overshoot
        slices_in_dim = [sn for sn in slices_in_dim if sn >= 0 or sn <= num_non_empty]

        slices.append(slices_in_dim)

    return slices
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)
421840
def mul(left, right):
    
    from .mv_mul import MvMul
    length = max(left, right)
    if length == 1:
        return Mul(left, right)
    return MvMul(left, right)
630693
def bisect_left(self, val):
        
        _maxes = self._maxes

        if not _maxes:
            return 0

        pos = bisect_left(_maxes, val)

        if pos == len(_maxes):
            return self._len

        idx = bisect_left(self._lists[pos], val)

        return self._loc(pos, idx)
385328
def __cutRaw(self, oiraw, maxLength):
        ''''''
        vec = []
        m = re.findall(u".*?[。？！；;!?]", oiraw)
        num, l, last = 0, 0, 0
        for i in range(len(m)):
            if(num + len(m[i]) >= maxLength):
                vec.append("".join(m[last:i]))
                last = i
                num = len(m[i])
            else:
                num += len(m[i])
            l += len(m[i])
        if(len(oiraw)-l + num >= maxLength):
            vec.append("".join(m[last:len(m)]))
            vec.append(oiraw[l:])
        else:
            vec.append(oiraw[l-num:])
        return vec
424490
def get_left_right(seq):
    
    cseq = seq.strip(GAPS)
    leftjust = seq.index(cseq[0])
    rightjust = seq.rindex(cseq[-1])

    return leftjust, rightjust
708128
def Slice_6(self, func):
        
        s0 = [d for d in func.slice_param.start]
        s0 = [0] + s0
        e0 = [d for d in func.slice_param.stop]
        e0 = [self._batch_size] + e0
        s1 = [0] * len(self._var_dict[func.input[0]].dim)
        e1 = [d for d in self._var_dict[func.input[0]].dim]
        nl = []
        for i, (m, n, s, e) in enumerate(zip(s0, e0, s1, e1)):
            if m > s or n < e:
                starts = s1[:]
                ends = e1[:]
                starts[i] = m
                ends[i] = n
                n = onnx.helper.make_node(
                    "Slice",
                    func.input,
                    func.output,
                    name=func.name,
                    starts=starts,
                    ends=ends,
                )
                nl.append(n)

        if not nl:
            # full equal, no slice
            # we have to create a node
            # to pass the data
            starts = s1[:]
            ends = e1[:]
            n = onnx.helper.make_node(
                "Slice",
                func.input,
                func.output,
                name=func.name,
                starts=starts,
                ends=ends,
            )
            nl.append(n)

        for i in range(len(nl)-1):
            fork = fork_name("SliceIter")
            del nl[i].output[:]
            nl[i].output.extend([fork])
            del nl[i+1].input[:]
            nl[i+1].input.extend([fork])

        return nl
1181272
function offsetLeft (elem) {
    let left = 0

    do {
      if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft
    } while (elem = elem.offsetParent )

    return left
  }