Update the target name of constructed IndexTerm recursively
4659
private void updateIndexTermTargetName() {
        if (defaultTitle == null) {
            defaultTitle = targetFile;
        }
        for (final IndexTerm indexterm : indexTermList) {
            updateIndexTermTargetName(indexterm);
        }
    }
721429
def update(self, *a, **ka):
        
        prefix = ''
        if a and isinstance(a[0], basestring):
            prefix = a[0].strip('.') + '.'
            a = a[1:]
        for key, value in dict(*a, **ka).items():
            self[prefix + key] = value
1371761
def build_index(self, idx_name, _type='default'):
        ""
        indexes = {}
        has_non_string_values = False
        for key, item in self.data.items():
            if idx_name in item:
                value = item[idx_name]
                # A non-string index value switches it into a lazy one.
                if not isinstance(value, six.string_types):
                    has_non_string_values = True
                if value not in indexes:
                    indexes[value] = set([])
                indexes[value].add(key)
        self.indexes[idx_name] = indexes
        if self._meta.lazy_indexes or has_non_string_values:
            # Every index is lazy
            _type = 'lazy'
        self.index_defs[idx_name] = {'type': _type}
887328
def update_tree(root, executed_acts, total_rew):
    
    root.value = max(total_rew, root.value)
    root.visits += 1
    new_nodes = 0

    node = root
    for step, act in enumerate(executed_acts):
        if act not in node.children:
            node.children[act] = Node()
            new_nodes += 1
        node = node.children[act]
        node.value = max(total_rew, node.value)
        node.visits += 1

    return new_nodes
521978
def rename_index(self, old_name, new_name=None):
        
        old_name = self._normalize_identifier(old_name)
        normalized_new_name = self._normalize_identifier(new_name)

        if old_name == normalized_new_name:
            return self

        if not self.has_index(old_name):
            raise IndexDoesNotExist(old_name, self._name)

        if self.has_index(normalized_new_name):
            raise IndexAlreadyExists(normalized_new_name, self._name)

        old_index = self._indexes[old_name]

        if old_index.is_primary():
            self.drop_primary_key()

            return self.set_primary_key(old_index.get_columns(), new_name)

        del self._indexes[old_name]

        if old_index.is_unique():
            return self.add_unique_index(old_index.get_columns(), new_name)

        return self.add_index(old_index.get_columns(), new_name, old_index.get_flags())
1232097
def _reindex(self):
        
        self.index = []
        for path in self.paths:
            target_path = os.path.normpath(os.path.join(BASE_PATH,
                                                        path))
            for root, subdirs, files in os.walk(target_path):
                for f in files:
                    self.index.append(
                        (os.path.join(root, f).lower(),
                         os.path.join(root, f)))
521271
public void updateSubTerm() {
        if (subTerms.size() == 1) {
            // if there is only one subterm, it is necessary to update
            final IndexTerm term = subTerms.get(0); // get the only subterm
            if (term.getTermPrefix() == IndexTermPrefix.SEE) {
                //if the only subterm is index-see update it to index-see-also
                term.setTermPrefix(IndexTermPrefix.SEE_ALSO);
            }
//            subTerms.set(0, term);
        }
    }
482228
def _update_index_on_df(df, index_names):
    """"""
    if index_names:
        df = df.set_index(index_names)
        # Remove names from unnamed indexes
        index_names = _denormalize_index_names(index_names)
        df.index.names = index_names
    return df
95794
protected function updateTargetIndex()
    {
        $targetIndex = $this->argument('target-index');

        $sourceIndexConfigurator = $this->getModel()
            ->getIndexConfigurator();

        $targetIndexPayload = (new RawPayload())
            ->set('index', $targetIndex)
            ->get();

        $indices = ElasticClient::indices();

        try {
            $indices->close($targetIndexPayload);

            if ($settings = $sourceIndexConfigurator->getSettings()) {
                $targetIndexSettingsPayload = (new RawPayload())
                    ->set('index', $targetIndex)
                    ->set('body.settings', $settings)
                    ->get();

                $indices->putSettings($targetIndexSettingsPayload);
            }

            if ($defaultMapping = $sourceIndexConfigurator->getDefaultMapping()) {
                $targetIndexMappingPayload = (new RawPayload())
                    ->set('index', $targetIndex)
                    ->set('type', '_default_')
                    ->set('body._default_', $defaultMapping)
                    ->get();

                $indices->putMapping($targetIndexMappingPayload);
            }

            $indices->open($targetIndexPayload);
        } catch (Exception $exception) {
            $indices->open($targetIndexPayload);

            throw $exception;
        }

        $this->info(sprintf(
            'The index %s was updated.',
            $targetIndex
        ));
    }
74173
def reindex(self, new_index_name: str, identifier_key: str, **kwargs) -> 'ElasticIndex':
        
        if 'url' not in kwargs:
            kwargs['url'] = self.url
        if 'doc_type' not in kwargs:
            kwargs['doc_type'] = self.doc_type
        if 'mapping' not in kwargs:
            kwargs['mapping'] = self.mapping
        new_index = ElasticIndex(new_index_name, **kwargs)

        for results in self.scroll(size=500):
            new_index.bulk(results, identifier_key)
        return new_index
1235191
def update_index(name, node)
      index = self.index(name)
      old_key = index.key(node)
      new_key = value(node, name)

      # Only replace the key if it's changed
      if old_key != new_key
        remove_from_index(name, old_key)
        add_to_index(name, new_key, node)
      end
    end
1157661
private static void updatePartialIndex(IndexScanPlanNode scan) {
        if (scan.getPredicate() == null && scan.getPartialIndexPredicate() != null) {
            if (scan.isForSortOrderOnly()) {
                scan.setPredicate(Collections.singletonList(scan.getPartialIndexPredicate()));
            }
            scan.setForPartialIndexOnly();
        }
    }
607217
def _BuildIndex(self):
        """"""
        self._index = {}
        for i, k in enumerate(self._keys):
            self._index[k] = i
1145943
def rename_with_num(self, prefix="", new_path=None, remove_desc=True):
        """"""
        # Temporary path #
        if new_path is None: numbered = self.__class__(new_temp_path())
        else:                numbered = self.__class__(new_path)
        # Generator #
        def numbered_iterator():
            for i,read in enumerate(self):
                read.id  = prefix + str(i)
                read.seq = read.seq.upper()
                if remove_desc: read.description = ""
                yield read
        # Do it #
        numbered.write(numbered_iterator())
        numbered.close()
        # Replace it #
        if new_path is None:
            os.remove(self.path)
            shutil.move(numbered, self.path)
        return numbered
898479
private void update(int seqNo, long guessedIndex) {
		long delta = guessedIndex - (((long) this.roc) << 16 | this.seqNum);

		/* update the replay bit mask */
		if (delta > 0) {
			replayWindow = replayWindow << delta;
			replayWindow |= 1;
		} else {
			replayWindow |= (1 << delta);
		}

		if (seqNo > seqNum) {
			seqNum = seqNo & 0xffff;
		}
		if (this.guessedROC > this.roc) {
			roc = guessedROC;
			seqNum = seqNo & 0xffff;
		}
	}
911441
def _clean_index(self):
        ""
        for idx_name, idx_def in self.index_defs.items():
            if idx_def['type'] == 'lazy':
                self.build_index(idx_name)
        for index_name, values in self.indexes.items():
            for value in values:
                if not isinstance(values[value], set):
                    values[value] = set(values[value])
1097362
def recursive_update(_dict, _update):
    
    for k, v in _update.items():
        if isinstance(v, collections.Mapping):
            r = recursive_update(_dict.get(k, {}), v)
            _dict[k] = r
        else:
            _dict[k] = _update[k]
    return _dict