Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted.
190450
def _partition_index_names(provisioned_index_names, index_names):
    ''''''
    existing_index_names = set()
    new_index_names = set()
    for name in index_names:
        if name in provisioned_index_names:
            existing_index_names.add(name)
        else:
            new_index_names.add(name)
    index_names_to_be_deleted = provisioned_index_names - existing_index_names
    return existing_index_names, new_index_names, index_names_to_be_deleted
843911
def _combine_sets(self, sets, final_set):
        
        if self._has_sortedsets:
            self.cls.get_connection().zinterstore(final_set, list(sets))
        else:
            final_set = super(ExtendedCollectionManager, self)._combine_sets(sets, final_set)
        return final_set
986873
def delete_all(self):
        '''
        '''
        try:
            self.conn.indices.delete_mapping(
                index=self.index, doc_type=self.type_tag)
        except TransportError:
            logger.warn('type %r in index %r already deleted',
                        self.index, self.type_tag, exc_info=True)
        try:
            self.conn.indices.delete_mapping(
                index=self.index, doc_type=self.type_assoc)
        except TransportError:
            logger.warn('type %r in index %r already deleted',
                        self.index, self.type_assoc, exc_info=True)
745683
def prune_clusters(clusters, index, n=3):
    
    torem = set(c for c in clusters if c.size < n)
    pruned_clusters = [c for c in clusters if c.size >= n]
    terms_torem = []
    for term, clusters in index.items():
        index[term] = clusters - torem
        if len(index[term]) == 0:
            terms_torem.append(term)
    for t in terms_torem:
        del index[t]
    return pruned_clusters, index
317347
protected void reallocateIndexes() {
        indexes = new Integer[getFilteredModel().getSize()];
        for (int i = 0; i < indexes.length; i++) {
            indexes[i] = new Integer(i);
        }
        applyComparator();
    }
562363
def delete(self, loc):
        
        new_codes = [np.delete(level_codes, loc) for level_codes in self.codes]
        return MultiIndex(levels=self.levels, codes=new_codes,
                          names=self.names, verify_integrity=False)
1143396
private void createIndexes(Table t) {
        for (String indexName : t.getIndexHoldersByName().keySet()) {
            if (!indexName.startsWith("PRIMARY")) {
                createIndex(t, t.getIndexHolderByName(indexName));
            }
        }
    }
1179567
private SortedSet<String> mergeSets(SortedSet<String> primary, Set<String> secondary) {
    SortedSet<String> result = primary;
    if (!secondary.isEmpty()) {
      result = new TreeSet<>();
      result.addAll(primary);
      result.addAll(secondary);
    }
    return result;
  }
284699
def _reindex_with_indexers(self, reindexers, fill_value=None, copy=False,
                               allow_dups=False):
        

        # reindex doing multiple operations on different axes if indicated
        new_data = self._data
        for axis in sorted(reindexers.keys()):
            index, indexer = reindexers[axis]
            baxis = self._get_block_manager_axis(axis)

            if index is None:
                continue

            index = ensure_index(index)
            if indexer is not None:
                indexer = ensure_int64(indexer)

            # TODO: speed up on homogeneous DataFrame objects
            new_data = new_data.reindex_indexer(index, indexer, axis=baxis,
                                                fill_value=fill_value,
                                                allow_dups=allow_dups,
                                                copy=copy)

        if copy and new_data is self._data:
            new_data = new_data.copy()

        return self._constructor(new_data).__finalize__(self)
1323864
def _delete_from_indices(self, pipeline):
        
        s = Set(self.key()['_indices'])
        z = Set(self.key()['_zindices'])
        for index in s.members:
            pipeline.srem(index, self.id)
        for index in z.members:
            pipeline.zrem(index, self.id)
        pipeline.delete(s.key)
        pipeline.delete(z.key)
721081
def ensure_index(self, index, mappings=None, settings=None, clear=False):
        
        mappings = mappings or []
        if isinstance(mappings, dict):
            mappings = [mappings]
        exists = self.indices.exists_index(index)
        if exists and not mappings and not clear:
            return
        if exists and clear:
            self.indices.delete_index(index)
            exists = False

        if exists:
            if not mappings:
                self.indices.delete_index(index)
                self.indices.refresh()
                self.indices.create_index(index, settings)
                return

            if clear:
                for maps in mappings:
                    for key in list(maps.keys()):
                        self.indices.delete_mapping(index, doc_type=key)
                self.indices.refresh()
            if isinstance(mappings, SettingsBuilder):
                for name, data in list(mappings.mappings.items()):
                    self.indices.put_mapping(doc_type=name, mapping=data, indices=index)

            else:
                from pyes.mappings import DocumentObjectField, ObjectField

                for maps in mappings:
                    if isinstance(maps, tuple):
                        name, mapping = maps
                        self.indices.put_mapping(doc_type=name, mapping=mapping, indices=index)
                    elif isinstance(maps, dict):
                        for name, data in list(maps.items()):
                            self.indices.put_mapping(doc_type=name, mapping=maps, indices=index)
                    elif isinstance(maps, (DocumentObjectField, ObjectField)):
                        self.put_mapping(doc_type=maps.name, mapping=maps.as_dict(), indices=index)

                return

        if settings:
            if isinstance(settings, dict):
                settings = SettingsBuilder(settings, mappings)
        else:
            if isinstance(mappings, SettingsBuilder):
                settings = mappings
            else:
                settings = SettingsBuilder(mappings=mappings)
        if not exists:
            self.indices.create_index(index, settings)
            self.indices.refresh(index, timesleep=1)
831796
private int combineSubsetBlocks(Mode[] mode_type, int[] mode_length, int index_point) {
        /* bring together same type blocks */
        if (index_point > 1) {
            for (int i = 1; i < index_point; i++) {
                if (mode_type[i - 1] == mode_type[i]) {
                    /* bring together */
                    mode_length[i - 1] = mode_length[i - 1] + mode_length[i];
                    /* decrease the list */
                    for (int j = i + 1; j < index_point; j++) {
                        mode_length[j - 1] = mode_length[j];
                        mode_type[j - 1] = mode_type[j];
                    }
                    index_point--;
                    i--;
                }
            }
        }
        return index_point;
    }
377076
def get_indexes(self, default_indexes=None):
        
        doctype = self.type.get_mapping_type_name()
        indexes = (settings.ES_INDEXES.get(doctype) or
                   settings.ES_INDEXES['default'])
        if isinstance(indexes, six.string_types):
            indexes = [indexes]
        return super(S, self).get_indexes(default_indexes=indexes)
728838
def selectedIndexes(self):
        """"""
        model = self.model()
        indexes = []
        for comp in self._selectedComponents:
            index = model.indexByComponent(comp)
            if index is None:
                # must have been removed from model, discard
                self._selectedComponents.remove(comp)
            else:
                indexes.append(index)
        return indexes
783618
def atIndices(indexable, indices, default=__unique):
    
    """
    if default is __unique:
        return [indexable[i] for i in indices]
    else:
        res = []
        for i in indices:
            try:
                res.append(indexable[i])
            except (IndexError, KeyError):
                res.append(default)
        return res
980781
def delete(self, indexes):
        
        indexes = [indexes] if not isinstance(indexes, (list, blist)) else indexes
        if all([isinstance(i, bool) for i in indexes]):  # boolean list
            if len(indexes) != len(self._index):
                raise ValueError('boolean indexes list must be same size of existing indexes')
            indexes = [i for i, x in enumerate(indexes) if x]
        else:
            indexes = [sorted_index(self._index, x) for x in indexes] if self._sort \
                else [self._index.index(x) for x in indexes]
        indexes = sorted(indexes, reverse=True)  # need to sort and reverse list so deleting works
        for i in indexes:
            del self._data[i]
        # now remove from index
        for i in indexes:
            del self._index[i]
272166
def create_indexes(clas,pool_or_cursor):
    ""
    for index in clas.INDEXES:
      # note: these are specified as either 'field,field,field' or a runnable query. you can put any query you want in there
      query = index if 'create index' in index.lower() else 'create index on %s (%s)'%(clas.TABLE,index)
      commit_or_execute(pool_or_cursor,query)