Check DataSet for indexed entries and remove all keys without index if indexed entries with
the same name exist.
768283
private void cleanUp(final DataSet ds) {
		Set<String> indexedKeys = Sets.newHashSet();
		for (String key : ds.getDataView().keySet()) {
			// Search for indexed entries
			if (key.contains("#")) {
				// Remember key (without index)
				indexedKeys.add(key.substring(0, key.indexOf("#")));
			}
		}
		// Remove all indexes
		for (String indexedKey : indexedKeys) {
			ds.removeValue(indexedKey);
		}
	}
283728
def _remove_keys_from_dict_with_nonunique_values(self, d, log_fh=None, log_outprefix=None):
        ''''''
        value_counts = collections.Counter(d.values())
        new_d = {}
        writing_log_file = None not in [log_fh, log_outprefix]

        for key in d:
            if value_counts[d[key]] == 1:
                new_d[key] = d[key]
            elif writing_log_file:
                print(log_outprefix, 'Reject because non-unique:', d[key], sep='\t', file=log_fh)

        return new_d
94207
def _filter_desc(self, indexing):
        '''
        

        '''

        # now filter data
        if len(indexing) > 0:
            desc_tmp = np.zeros((len(indexing),len(self.header_desc)),dtype='|S1024')
            data_tmp = np.zeros((len(indexing),len(self.header_data)))
            style_tmp= np.zeros((len(indexing),len(self.header_style)),dtype='|S1024')
            for i in range(len(indexing)):
                for j in range(len(self.header_desc)):
                    desc_tmp[i][j] = self.desc[indexing[i]][j]
                for k in range(len(self.header_data)):
                    data_tmp[i][k] = self.data[indexing[i]][k]
                for l in range(len(self.header_style)):
                    style_tmp[i][l]= self.style[indexing[i]][l]
            self.desc = desc_tmp
            self.data = data_tmp
            self.style= style_tmp
        else:
            print('No filter selected or no data found!')
1077420
def clear_es():
        """"""
        # TODO: should receive a catalog slug.
        ESHypermap.es.indices.delete(ESHypermap.index_name, ignore=[400, 404])
        LOGGER.debug('Elasticsearch: Index cleared')
1013697
def filter_out_none_valued_keys(self, d):
        # type: (typing.Dict[K, V]) -> typing.Dict[K, V]
        """"""
        new_d = {}
        for k, v in d.items():
            if v is not None:
                new_d[k] = v
        return new_d
745675
@Override
  public boolean removeIfEquals(K key, V _value) {
    Entry e = lookupEntry(key);
    if (e == null) {
      metrics.peekMiss();
      return false;
    }
    synchronized (e) {
      e.waitForProcessing();
      if (e.isGone()) {
        metrics.peekMiss();
        return false;
      }
      boolean f = e.hasFreshData(clock);
      if (f) {
        if (!e.equalsValue(_value)) {
          return false;
        }
      } else {
        metrics.peekHitNotFresh();
        return false;
      }
      removeEntry(e);
      return f;
    }
  }
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)
818887
def filter_data(self):
        '''
        '''

        if not self.dataset_cases or not self.analysis_data:
            # colortext.error('No dataset cases or analysis (DDG) data were passed. Cannot filter the data. If you are using an existing dataframe, this may explain why no data was passed.')
            return
        if self.restrict_to or self.remove_cases:

            # Remove any cases with missing data
            available_cases = set(self.analysis_data.keys())
            missing_dataset_cases = [k for k in self.dataset_cases.keys() if k not in available_cases]
            for k in missing_dataset_cases:
                del self.dataset_cases[k]

            cases_to_remove = set()
            if self.restrict_to:
                # Remove cases which do not meet the restriction criteria
                if 'Exposed' in self.restrict_to:
                    for k, v in self.dataset_cases.iteritems():
                        for m in v['PDBMutations']:
                            if (m.get('ComplexExposure') or m.get('MonomericExposure')) <= self.burial_cutoff:
                                cases_to_remove.add(k)
                                break
            if self.remove_cases:
                # Remove cases which meet the removal criteria
                if 'Exposed' in self.remove_cases:
                    for k, v in self.dataset_cases.iteritems():
                        for m in v['PDBMutations']:
                            if (m.get('ComplexExposure') or m.get('MonomericExposure')) > self.burial_cutoff:
                                cases_to_remove.add(k)
                                break

            if cases_to_remove:
                colortext.warning('Filtering out {0} records.'.format(len(cases_to_remove)))

            for k in cases_to_remove:
                del self.dataset_cases[k]
                del self.analysis_data[k]
272720
def removeByIndex(self, index):
        """"""
        if index < len(self._invites) -1 and \
           index >=0:
            self._invites.remove(index)
276658
function filterByKeys(keys, values) {
  var filtered = {};

  forEach(keys, function (name) {
    filtered[name] = values[name];
  });
  return filtered;
}
434374
def cleanup(self):
        
        empty_keys = [k for k, v in self.items() if not v]

        for k in empty_keys:
            del self[k]
1363314
def delete_dataset(self, dataset, delete_nonempty=True):
        

        if not self.dataset_exists(dataset):
            return

        self.client.datasets().delete(projectId=dataset.project_id,
                                      datasetId=dataset.dataset_id,
                                      deleteContents=delete_nonempty).execute()
723352
def delete(self, key):
        ""
        if key in self.data:
            self.delete_from_index(key)
        del self.data[key]
1192307
def delete_dataset(dataset_id,**kwargs):
    
    try:
        d = db.DBSession.query(Dataset).filter(Dataset.id==dataset_id).one()
    except NoResultFound:
        raise HydraError("Dataset %s does not exist."%dataset_id)

    dataset_rs = db.DBSession.query(ResourceScenario).filter(ResourceScenario.dataset_id==dataset_id).all()
    if len(dataset_rs) > 0:
        raise HydraError("Cannot delete %s. Dataset is used by one or more resource scenarios."%dataset_id)

    db.DBSession.delete(d)

    db.DBSession.flush()

    #Remove ORM references to children of this dataset (metadata, collection items)
    db.DBSession.expunge_all()
148498
void cleanUpStaleEntries() {
        for (KeyedRef<K, V> ref = q.poll(); ref != null; ref = q.poll()) {
            map.remove(ref.getKey(), ref); // CONCURRENT remove() operation
        }
    }
85265
def is_complete(self, keys=None, alias=None):
        
        return any(k not in list(self.data.keys()) for k in keys)
576875
def delete_if_not_in_zsets(self, key, member, set_list, client=None):
        
        return self._delete_if_not_in_zsets(
            keys=[key]+set_list,
            args=[member],
            client=client)