For inference, will briefly replace the dataset with one that only contains `item`.
509946
def set_item(self,item):
        ""
        self.item = self.x.process_one(item)
        yield None
        self.item = None
413055
function dataset(elem) {
        if (elem.dataset) {
            return JSON.parse(JSON.stringify(elem.dataset));
        }

        var target = {};

        if (elem.hasAttributes()) {
            each(elem.attributes, function (attr) {
                var name = attr.name;
                if (name.indexOf('data-') !== 0) {
                    return true;
                }

                name = name.replace(/^data-/i, '')
                    .replace(/-(\w)/g, function (all, letter) {
                        return letter.toUpperCase();
                    });

                target[name] = attr.value;
            });

            return target;
        }

        return {};
    }
790000
def replace_one(cls, filter, replacement, upsert=False):
        
        return cls.collection.replace_one(
            filter, replacement, upsert
        ).raw_result
779009
function dataSet( element ) {
  if ( document.documentElement.dataset ) {
    return _assign( {}, element.dataset );
  }
  const dataset = {};
  const regex = /^data-(.+)/;
  let attr;
  let match;

  for ( var i = 0; i < element.attributes.length; i++ ) {
    attr = element.attributes[i];
    match = attr.name.match( regex );
    if ( match ) {
      dataset[_toCamelCase( match[1] )] = attr.value;
    }
  }

  return dataset;
}
47425
function patch(element, previous, dataset) {
  if (!previous && !dataset) {
    return dataset;
  }
  var name;
  previous = previous || {};
  dataset = dataset || {};

  for (name in previous) {
    if (dataset[name] === undefined) {
      delete element.dataset[name];
    }
  }

  for (name in dataset) {
    if (previous[name] === dataset[name]) {
      continue;
    }
    element.dataset[name] = dataset[name];
  }

  return dataset;
}
1023978
def _sample_item(self, **kwargs):
        """"""
        if 'fixed_stratum' in kwargs:
            stratum_idx = kwargs['fixed_stratum']
        else:
            stratum_idx = None
        if stratum_idx is not None:
            #: Sample in given stratum
            loc = self.strata._sample_in_stratum(stratum_idx,
                                                 replace=self.replace)
        else:
            loc, stratum_idx = self.strata.sample(pmf = self.strata.weights_,
                                                  replace=self.replace)

        return loc, 1, {'stratum': stratum_idx}
1156555
function (oldItem, newItem) {
        var ctrlElm, items = this.items(), i = items.length;

        // Replace the item in collection
        while (i--) {
          if (items[i] === oldItem) {
            items[i] = newItem;
            break;
          }
        }

        if (i >= 0) {
          // Remove new item from DOM
          ctrlElm = newItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }

          // Remove old item from DOM
          ctrlElm = oldItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }
        }

        // Adopt the item
        newItem.parent(this);
      }
572227
def getDataset(self, itemId):
        """"""
        if self._url.lower().find('datasets') > -1:
            url = self._url
        else:
            url = self._url + "/datasets"
        return OpenDataItem(url=url,
                            itemId=itemId,
                            securityHandler=self._securityHandler,
                            proxy_url=self._proxy_url,
                            proxy_port=self._proxy_port)
308622
def remove(client, names):
    """"""
    from renku.models.refs import LinkReference
    datasets = {name: client.dataset_path(name) for name in names}

    if not datasets:
        raise click.BadParameter(
            'use dataset name or identifier', param_hint='names'
        )

    unknown = [
        name
        for name, path in datasets.items() if not path or not path.exists()
    ]
    if unknown:
        raise click.BadParameter(
            'unknown datasets ' + ', '.join(unknown), param_hint='names'
        )

    datasets = set(datasets.values())

    with progressbar(
        datasets,
        label='Removing metadata files'.ljust(30),
        item_show_func=lambda item: str(item) if item else '',
    ) as bar:
        for dataset in bar:
            if dataset and dataset.exists():
                dataset.unlink()

    with progressbar(
        list(LinkReference.iter_items(client, common_path='datasets')),
        label='Removing aliases'.ljust(30),
        item_show_func=lambda item: item.name if item else '',
    ) as bar:
        for ref in bar:
            if ref.reference in datasets:
                ref.delete()

    click.secho('OK', fg='green')
254903
def data(self, data, part=False, dataset=''):
        
        return super().data(data, part)
793485
function(items){
      var delta = this.set(items) || {};
      var deleted = delta.deleted;

      Dataset.setAccumulateState(true);
      if (deleted)
        for (var i = 0, object; object = deleted[i]; i++)
          object.destroy();
      Dataset.setAccumulateState(false);

      return delta.inserted;
    }
160124
def from_dataset(cls, dataset, **kwargs):
        """"""
        m = cls(dataset.dim_x, dataset.dim_y, **kwargs)
        m.dataset = dataset
        return m
940089
public void transform(DataSet dataSet) {
        dataSet.setFeatures(dataSet.getFeatures().subRowVector(mean));
        dataSet.setFeatures(dataSet.getFeatures().divRowVector(std));
    }
1327948
def removeDataset(self, dataset):
        
        for datasetRecord in models.Dataset.select().where(
                        models.Dataset.id == dataset.getId()):
            datasetRecord.delete_instance(recursive=True)
968292
private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) {

        if (replacersList == null || replacersList.isEmpty())
            return dataSet;

        ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet);
        // convert to set to remove duplicates
        Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList);
        for (Replacer replacer : replacers) {
            replacer.addReplacements(replacementSet);
        }

        return replacementSet;
    }
1061293
def replaceItem(self, child, href):
        """"""
        assert isinstance(child, Base), "child item must be a hypercat Catalogue or Resource"
        for i in range(len(self.items)):
            if(self.items[i].href == href):
                self.items[i] = child   # Replace existing
                return
        assert False, "No such child item to replace as "+href
1055328
@SuppressWarnings("unchecked")
    private IDataSet performReplacements(IDataSet dataSet) {
        if (!dbUnitConfig.getProperties().containsKey("replacers")) {
            return dataSet;
        }
        return performReplacements(dataSet, (List<Replacer>) dbUnitConfig.getProperties().get("replacers"));
    }