Expands slices containing steps into a list.
185632
def _expand_slice(self, indices):
        
        keys = list(self.data.keys())
        expanded = []
        for idx, ind in enumerate(indices):
            if isinstance(ind, slice) and ind.step is not None:
                dim_ind = slice(ind.start, ind.stop)
                if dim_ind == slice(None):
                    condition = self._all_condition()
                elif dim_ind.start is None:
                    condition = self._upto_condition(dim_ind)
                elif dim_ind.stop is None:
                    condition = self._from_condition(dim_ind)
                else:
                    condition = self._range_condition(dim_ind)
                dim_vals = unique_iterator(k[idx] for k in keys)
                expanded.append(set([k for k in dim_vals if condition(k)][::int(ind.step)]))
            else:
                expanded.append(ind)
        return tuple(expanded)
117095
def column_stack_2d(data):
    """"""
    return list(list(itt.chain.from_iterable(_)) for _ in zip(*data))
1100518
function expandFiles(files, basePath) {
    var expandedFiles = [];
    files = files ? _.isArray(files) ? files : [files] : [];

    _.forEach(files, function(fileName) {
        expandedFiles = _.union(
            expandedFiles,
            glob.sync(path.join(basePath, fileName), { dot: true, nodir: true })
        );
    });

    return expandedFiles;
}
368556
def _fill_slices(self, sls):
        """"""
        # Fill '...' entries with ':'
        nfill = self.ndim - len(sls)
        fsls = list()
        for sl in sls:
            if sl is Ellipsis:
                while nfill:
                    fsls.append(slice(None, None))
                    nfill -= 1
                fsls.append(slice(None, None))
            else:
                fsls.append(sl)

        # Append ':' to the end
        for _ in range(self.ndim - len(fsls)):
            fsls.append(slice(None, None))

        return fsls
22975
def _consolidate_slices(slices):
    
    result = []
    last_slice = slice(None)
    for slice_ in slices:
        if not isinstance(slice_, slice):
            raise ValueError('list element is not a slice: %r' % slice_)
        if (result and last_slice.stop == slice_.start and
                _is_one_or_none(last_slice.step) and
                _is_one_or_none(slice_.step)):
            last_slice = slice(last_slice.start, slice_.stop, slice_.step)
            result[-1] = last_slice
        else:
            result.append(slice_)
            last_slice = slice_
    return result
877398
def _slice_generator(self, index):
        """"""
        start, stop, step = index.indices(len(self))
        for i in range(start, stop, step):
            yield self.get_blob(i)
979981
function(slices) {
      this.haveTopLevelSlicesBeenBuilt = false;
      slices.forEach(function(slice) {
        slice.parentContainer = this.parentContainer_;
        this.slices.push(slice);
      }, this);
    }
1034343
def split(self):
        
        ranges = []
        for bound in self.bounds:
            range = VersionRange(None)
            range.bounds = [bound]
            ranges.append(range)
        return ranges
44639
def expand_region(tuple_of_s, a, b, start=0, stop=None):
    ''''''
    return tuple(expand_slice(s, a, b, start=start, stop=stop)
                 for s in tuple_of_s)
624920
def cut(list_, index=0):
    """"""
    if isinstance(index, int):
        cut_ = lambda x: x[index]
    else:
        cut_ = lambda x: getattr(x, index)
    return list(map(cut_, list_))
1151207
def expandDescendants(self, branches):
        
        return sum([b.descendants() for b in branches], []) + \
            [b.source for b in branches]
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
689321
public static <T> List<T> sub(List<T> list, int start, int end, int step) {
		if (list == null || list.isEmpty()) {
			return null;
		}

		final int size = list.size();
		if (start < 0) {
			start += size;
		}
		if (end < 0) {
			end += size;
		}
		if (start == size) {
			return new ArrayList<>(0);
		}
		if (start > end) {
			int tmp = start;
			start = end;
			end = tmp;
		}
		if (end > size) {
			if (start >= size) {
				return new ArrayList<>(0);
			}
			end = size;
		}

		if (step <= 1) {
			return list.subList(start, end);
		}

		final List<T> result = new ArrayList<>();
		for (int i = start; i < end; i += step) {
			result.add(list.get(i));
		}
		return result;
	}
1143655
def expand_path(path):
    """"""

    paths = []
    path = os.path.expanduser(path)
    path = os.path.expandvars(path)

    if os.path.isdir(path):

        for (dir, dirs, files) in os.walk(path):
            for file in files:
                paths.append(os.path.join(dir, file))
    else:
        paths.extend(glob(path))

    return paths
1036264
def visit_Slice(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        elems = [self.visit(node.lower), self.visit(node.upper)]
        if node.step is not None:
            elems.append(self.visit(node.step))
        return ':'.join(elems)
1133682
def splits(self):
        
        return list(map(lambda x: self.select_code(x), self.code))
637578
def expand_nested(self, cats):
        """"""
        down = '│'
        right = '└──'

        def get_children(parent):
            return [e() for e in parent._entries.values() if e._container == 'catalog']

        if len(cats) == 0:
            return

        cat = cats[0]
        old = list(self.options.items())
        name = next(k for k, v in old if v == cat)
        index = next(i for i, (k, v) in enumerate(old) if v == cat)
        if right in name:
            prefix = f'{name.split(right)[0]}{down} {right}'
        else:
            prefix = right

        children = get_children(cat)
        for i, child in enumerate(children):
            old.insert(index+i+1, (f'{prefix} {child.name}', child))
        self.widget.options = dict(old)