clean_indexes()

        Sort subs and reset their index attribute. Should be called after
        destructive operations like split or such.
964580
def clean_indexes(self):
        
        self.sort()
        for index, item in enumerate(self):
            item.index = index + 1
277549
def list_remove_by_index(l, index):
    ''''''
    if index < 0 or index >= len(l):
        raise ValueError('index out of range')
    if index == (len(l) - 1):
        l.pop()
    elif index == 0:
        l = l[1:]
    else:
        l = l[0:index] + l[index+1:]

    return l
1192507
def clear(self):
        """"""
        self._len = 0
        del self._maxes[:]
        del self._lists[:]
        del self._keys[:]
        del self._index[:]
830129
function(data, indexes, atLevel) {
    var done = false;
    var startSort = function() {
      for (var i = 0; i < indexes.length; i++) {
        var access_target = data[indexes[i]].access.split(/[\]\[]+/).filter(function (f) {
          return !!f;
        });
        var isContinuos = true;
        var lastContinousIndex = i;
        for (var j = i + 1; j < indexes.length; j++) {
          var access_comparison = data[indexes[j]].access.split(/[\]\[]+/).filter(function (f) {
            return !!f;
          });
          var areEqual = access_comparison[atLevel] === access_target[atLevel];
          if (areEqual && !isContinuos) {
            // we have a problem huston.
            var copy = data[indexes[j]];
            data.splice(indexes[j], 1);
            data.splice(lastContinousIndex+1, 0, copy);
            isContinuos = true;
            lastContinousIndex = i;
            j = i;
          }
          else if (!areEqual) isContinuos = false;
          else if (areEqual)  lastContinousIndex = j;
        }
      }
      done = true;
    };
    while (!done) {
      startSort();
    }
  }
339330
public void sortSubTerms() {
        final int subTermNum = subTerms.size();

        if (subTerms != null && subTermNum > 0) {
            Collections.sort(subTerms);
            for (final IndexTerm subTerm : subTerms) {
                subTerm.sortSubTerms();
            }
        }
    }
569335
function cleanAlphabet(alphabet) {
    return alphabet.split('').filter(function (item, pos, self) {
      return self.indexOf(item) === pos;
    }).join('');
  }
304735
def reset_index(self, **kwargs):
        
        drop = kwargs.get("drop", False)
        new_index = pandas.RangeIndex(len(self.index))
        if not drop:
            if isinstance(self.index, pandas.MultiIndex):
                # TODO (devin-petersohn) ensure partitioning is properly aligned
                new_column_names = pandas.Index(self.index.names)
                new_columns = new_column_names.append(self.columns)
                index_data = pandas.DataFrame(list(zip(*self.index))).T
                result = self.data.from_pandas(index_data).concat(1, self.data)
                return self.__constructor__(result, new_index, new_columns)
            else:
                new_column_name = (
                    self.index.name
                    if self.index.name is not None
                    else "index"
                    if "index" not in self.columns
                    else "level_0"
                )
                new_columns = self.columns.insert(0, new_column_name)
                result = self.insert(0, new_column_name, self.index)
                return self.__constructor__(result.data, new_index, new_columns)
        else:
            # The copies here are to ensure that we do not give references to
            # this object for the purposes of updates.
            return self.__constructor__(
                self.data.copy(), new_index, self.columns.copy(), self._dtype_cache
            )
892676
protected function dropIndexes()
    {
        foreach ($this->sortedTables() as $table) {
            if ($table->exists()) {
                $table->save(HandlerInterface::DROP_INDEXES, false);
            }
        }
    }
1090939
def _clean(c):
    
    if isdir(c.sphinx.target):
        rmtree(c.sphinx.target)
762945
def _cleanup(self, kill, verbose):
        
        if kill:
            removed_indices = self.g.prune()

            self.nout -= len(removed_indices)

            if verbose and removed_indices:
                print('Removing %s' % removed_indices)

            for j in removed_indices:
                self.inv_map.pop(j[0])
559936
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.items():
            if assoc.expiresIn == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
1224535
def cleanup_strings(strings, strip: true)
      strings = Array(strings).flatten.map! { |s| cleanup_string(s, strip: strip) }
      strings.reject!(&:blank?)
      strings
    end
356879
def remove(self, index):
        """"""
        assert index < self.count
        last_index = self.count - 1
        data = self.get(index)

        if index == last_index:
            # easy case - nothing to do except zero last chunk
            last_data = data
            moved = None
        else:
            last_data = self.get(last_index)
            # copy the last chunk's data over the data to be deleted
            data[0:self.chunk_size] = last_data
            moved = last_index

        # zero last chunk's data
        last_data[0:self.chunk_size] = [0] * self.chunk_size
        self.count -= 1

        # provide which index has now moved
        return moved
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
839936
def sort_index(self):
        
        sort = sorted_list_indexes(self._index)
        # sort index
        self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in sort]
        # each column
        for c in range(len(self._data)):
            self._data[c] = blist([self._data[c][i] for i in sort]) if self._blist else [self._data[c][i] for i in sort]
618282
def remove_index(self, index):
        ''
        index_rm, single = convert_key_to_index(force_list(self.indices.keys()), index)
        if single:
            index_rm = [index_rm]

        index_new = [i for i in range(len(self.indices)) if i not in index_rm]

        if not index_new: # no index left
            self.clear(True)
            return

        names = mget_list(force_list(self.indices.keys()), index_new)
        items = [mget_list(i, index_new) for i in self.items()]
        self.clear(True)
        _MI_init(self, items, names)
302835
def _split_index(params):
    
    if isinstance(params, list):
        return [params[0], _split_index(params[1])]
    elif isinstance(params, dict):
        if INDEX in params.keys():
            return _split_index(params[VALUE])
        result = dict()
        for key in params:
            result[key] = _split_index(params[key])
        return result
    else:
        return params