Generate the Root.Name term from DatasetName, Version, Origin, TIme and Space
349607
def update_name(self, force=False, create_term=False, report_unchanged=True):
        """"""

        updates = []

        self.ensure_identifier()

        name_term = self.find_first('Root.Name')

        if not name_term:
            if create_term:
                name_term = self['Root'].new_term('Root.Name','')
            else:
                updates.append("No Root.Name, can't update name")
                return updates

        orig_name = name_term.value

        identifier = self.get_value('Root.Identifier')

        datasetname = self.get_value('Root.Dataset')

        if datasetname:

            name = self._generate_identity_name()

            if name != orig_name or force:
                name_term.value = name
                updates.append("Changed Name")
            else:
                if report_unchanged:
                    updates.append("Name did not change")

        elif not orig_name:

            if not identifier:
                updates.append("Failed to find DatasetName term or Identity term. Giving up")

            else:
                updates.append("Setting the name to the identifier")
                name_term.value = identifier

        elif orig_name == identifier:
            if report_unchanged:
                updates.append("Name did not change")

        else:
            # There is no DatasetName, so we can't gneerate name, and the Root.Name is not empty, so we should
            # not set it to the identity.
            updates.append("No Root.Dataset, so can't update the name")

        return updates
383734
function generateDataGetter(nameMap){
    return new Function('data', 'return {' +
      basis.object.iterate(nameMap, function(ownName, sourceName){
        ownName = ownName.replace(/"/g, '\\"');
        sourceName = sourceName.replace(/"/g, '\\"');
        return '"' + ownName + '": data["' + sourceName + '"]';
      }) +
    '}');
  }
1030338
def name(self):
        """"""
        parts = self._parts
        if len(parts) == (1 if (self._drv or self._root) else 0):
            return ''
        return parts[-1]
1090280
def _useful_basename(data):
    
    names = dd.get_batches(data)
    if not names:
        names = [dd.get_sample_name(data)]
    batch_name = names[0]
    return "%s-%s" % (batch_name, data["sv"]["variantcaller"])
465789
def _load_dataset(dsid, ds_info, file_handlers, dim='y'):
        """"""
        slice_list = []
        failure = True
        for fh in file_handlers:
            try:
                projectable = fh.get_dataset(dsid, ds_info)
                if projectable is not None:
                    slice_list.append(projectable)
                    failure = False
            except KeyError:
                logger.warning("Failed to load {} from {}".format(dsid, fh),
                               exc_info=True)

        if failure:
            raise KeyError(
                "Could not load {} from any provided files".format(dsid))

        if dim not in slice_list[0].dims:
            return slice_list[0]
        res = xr.concat(slice_list, dim=dim)

        combined_info = file_handlers[0].combine_info(
            [p.attrs for p in slice_list])

        res.attrs = combined_info
        return res
1223231
def generate_dataset_shelve(filename, number_items=1000):
    
    if os.path.exists(filename):
        os.remove(filename)
    data = shelve.open(filename)
    names = get_names()
    totalnames = len(names)
    #init random seeder
    random.seed()
    #calculate items
#    names = random.sample(names, number_items)
    for i in range(number_items):
        data[str(i+1)] = {"name":names[random.randint(0,totalnames-1)],
                     "age":random.randint(1,100),
                     "description":li_words(50, False)}
    data.close()
1000144
def gen_str(src, dst):
        
        return ReilBuilder.build(ReilMnemonic.STR, src, ReilEmptyOperand(), dst)
404613
def dataset(self):
        
        if self.dataset_format:
            return ".".join([self.dataset_name, self.dataset_format])
        return self.dataset_name
239473
def generate_term(self, **kwargs):
        """"""
        term_map = kwargs.pop('term_map')
        if hasattr(term_map, "termType") and\
            term_map.termType == NS_MGR.rr.BlankNode.rdflib:
            return rdflib.BNode()
        if not hasattr(term_map, 'datatype'):
            term_map.datatype = NS_MGR.xsd.anyURI.rdflib
        if hasattr(term_map, "template") and term_map.template is not None:
            template_vars = kwargs
            template_vars.update(self.constants)
            # Call any functions to generate values
            for key, value in template_vars.items():
                if hasattr(value, "__call__"):
                    template_vars[key] = value()
            raw_value = term_map.template.format(**template_vars)
            if term_map.datatype == NS_MGR.xsd.anyURI.rdflib:
                return rdflib.URIRef(raw_value)
            return rdflib.Literal(raw_value,
                                  datatype=term_map.datatype)
        if term_map.reference is not None:
            # Each child will have different mechanisms for referencing the
            # source based
            return self.__generate_reference__(term_map, **kwargs)
1047820
def _context_names():
    """"""
    import inspect

    from renku.models import provenance
    from renku.models._jsonld import JSONLDMixin

    for name in dir(provenance):
        cls = getattr(provenance, name)
        if inspect.isclass(cls) and issubclass(cls, JSONLDMixin):
            yield name
742520
def _get_name_map(saltenv='base'):
    '''
    
    '''
    u_name_map = {}
    name_map = get_repo_data(saltenv).get('name_map', {})

    if not six.PY2:
        return name_map

    for k in name_map:
        u_name_map[k] = name_map[k]
    return u_name_map
765142
def ls(dataset_uri):
    
    dataset = dtoolcore.DataSet.from_uri(dataset_uri)
    for overlay_name in dataset.list_overlay_names():
        click.secho(overlay_name)
865039
def namespace(self, key, glob=False):
        """"""
        if not self.name:
            self.name = os.environ['DJANGO_SETTINGS_MODULE'] 
        ns = '.'.join([key, self._glob]) if glob else '.'.join([self.name, self._glob])
        return ns
125448
function getRootModelName (model) {
    if (!model) {
      throw new Error('Please provide Arrow Model')
    }

    const namespaceDelimiter = '/'
    var parent = model
    while (parent._parent && parent._parent.name) {
      parent = parent._parent
    }
    if (!parent.name) {
      throw new Error('The provided model has no name or parent with name')
    }
    const name = parent.name.split(namespaceDelimiter).pop()
    return {
      nameOnly: name,
      nameOnlyPlural: pluralize(name),
      withNamespace: parent.name
    }
  }
213983
def load_dataset(data_name):
    """"""
    if data_name == 'MR' or data_name == 'Subj':
        train_dataset, output_size = _load_file(data_name)
        vocab, max_len = _build_vocab(data_name, train_dataset, [])
        train_dataset, train_data_lengths = _preprocess_dataset(train_dataset, vocab, max_len)
        return vocab, max_len, output_size, train_dataset, train_data_lengths
    else:
        train_dataset, test_dataset, output_size = _load_file(data_name)
        vocab, max_len = _build_vocab(data_name, train_dataset, test_dataset)
        train_dataset, train_data_lengths = _preprocess_dataset(train_dataset, vocab, max_len)
        test_dataset, test_data_lengths = _preprocess_dataset(test_dataset, vocab, max_len)
        return vocab, max_len, output_size, train_dataset, train_data_lengths, test_dataset, \
               test_data_lengths
791071
def name_parts(self):
        """"""

        default = PartialMixin.ANY

        np = ([(k, default, True)
               for k, _, _ in super(NameQuery, self).name_parts]
              +
              [(k, default, True)
               for k, _, _ in Name._generated_names]
              )

        return np
937182
def _map_term_using_schema(master, path, term, schema_edges):
    
    output = FlatList()
    for k, v in term.items():
        dimension = schema_edges[k]
        if isinstance(dimension, Dimension):
            domain = dimension.getDomain()
            if dimension.fields:
                if is_data(dimension.fields):
                    # EXPECTING A TUPLE
                    for local_field, es_field in dimension.fields.items():
                        local_value = v[local_field]
                        if local_value == None:
                            output.append({"missing": {"field": es_field}})
                        else:
                            output.append({"term": {es_field: local_value}})
                    continue

                if len(dimension.fields) == 1 and is_variable_name(dimension.fields[0]):
                    # SIMPLE SINGLE-VALUED FIELD
                    if domain.getPartByKey(v) is domain.NULL:
                        output.append({"missing": {"field": dimension.fields[0]}})
                    else:
                        output.append({"term": {dimension.fields[0]: v}})
                    continue

                if AND(is_variable_name(f) for f in dimension.fields):
                    # EXPECTING A TUPLE
                    if not isinstance(v, tuple):
                        Log.error("expecing {{name}}={{value}} to be a tuple",  name= k,  value= v)
                    for i, f in enumerate(dimension.fields):
                        vv = v[i]
                        if vv == None:
                            output.append({"missing": {"field": f}})
                        else:
                            output.append({"term": {f: vv}})
                    continue
            if len(dimension.fields) == 1 and is_variable_name(dimension.fields[0]):
                if domain.getPartByKey(v) is domain.NULL:
                    output.append({"missing": {"field": dimension.fields[0]}})
                else:
                    output.append({"term": {dimension.fields[0]: v}})
                continue
            if domain.partitions:
                part = domain.getPartByKey(v)
                if part is domain.NULL or not part.esfilter:
                    Log.error("not expected to get NULL")
                output.append(part.esfilter)
                continue
            else:
                Log.error("not expected")
        elif is_data(v):
            sub = _map_term_using_schema(master, path + [k], v, schema_edges[k])
            output.append(sub)
            continue

        output.append({"term": {k: v}})
    return {"and": output}