更新mainStem的同步状态数据
176459
public void single(MainStemEventData data) {
        Assert.notNull(data);
        Long nid = ArbitrateConfigUtils.getCurrentNid();
        if (!check()) {
            return;
        }

        data.setNid(nid);// 设置当前的nid
        String path = StagePathUtils.getMainStem(data.getPipelineId());
        byte[] bytes = JsonUtils.marshalToByte(data);// 初始化的数据对象
        try {
            zookeeper.writeData(path, bytes);
        } catch (ZkException e) {
            throw new ArbitrateException("mainStem_single", data.toString(), e);
        }
        activeData = data;
    }
492030
function reloadState(model, notify) {
    return function reload() {
        let { pathname, histories } = model,
            method = actionTypes.replace;

        // 更新监听
        return notify({
            pathname, method, histories, length: histories.length
        });
    };
}
945969
public void update(int[] goldIndex, int[] predictIndex)
    {
        for (int i = 0; i < goldIndex.length; ++i)
        {
            if (goldIndex[i] == predictIndex[i])
                continue;
            else // 预测与答案不一致
            {
                parameter[goldIndex[i]]++; // 奖励正确的特征函数（将它的权值加一）
                if (predictIndex[i] >= 0 && predictIndex[i] < parameter.length)
                    parameter[predictIndex[i]]--; // 惩罚招致错误的特征函数（将它的权值减一）
                else
                {
                    throw new IllegalArgumentException("更新参数时传入了非法的下标");
                }
            }
        }
    }
260417
def start_system(components, bind_to, hooks={}):
    """"""
    deps = build_deps_graph(components)
    started_components = start_components(components, deps, None)

    run_hooks(hooks, started_components)

    if type(bind_to) is str:
        master = started_components[bind_to]
    else:
        master = bind_to

    setattr(master, '__components', started_components)
    return master
1012616
def install(replace_existing=False):
    """"""
    bunch = AutoBunch()
    bunch.name = 'DAPA'
    bunch.protocol = 'dapa'
    bunch.force = 'true'
    # bunch.delay=200

    install_programmer('dapa', bunch, replace_existing=replace_existing)
514471
function() {
		this.cpu = new CPU( this );
		this.apu = new APU( this );
		this.ppu = new PPU( this );
		this.memory = new Memory( this );

		this.loadCartridge( this.cartridge );
	}
1253226
def update(self, n=1):
    """"""
    with self._lock:
      self._pbar.update(n)
      self.refresh()
70146
public function change() {
		$this->table('queue_processes')
			->addColumn('workerkey', 'string', [
				'length' => 45,
				'null' => false,
				'default' => null,
				'encoding' => 'utf8mb4',
				'collation' => 'utf8mb4_unicode_ci',
			])
			->save();

		$this->table('queue_processes')
			->addIndex(['workerkey'], ['unique' => true])
			->save();
	}
1105076
def update_system_path():
        """"""
        cwd = os.getcwd()
        lib_dir = os.path.join(os.getcwd(), 'lib_')
        lib_latest = os.path.join(os.getcwd(), 'lib_latest')

        # insert the lib_latest directory into the system Path if no other lib directory found. This
        # entry will be bumped to index 1 after adding the current working directory.
        if not [p for p in sys.path if lib_dir in p]:
            sys.path.insert(0, lib_latest)

        # insert the current working directory into the system Path for the App, ensuring that it is
        # always the first entry in the list.
        try:
            sys.path.remove(cwd)
        except ValueError:
            pass
        sys.path.insert(0, cwd)
4896
function _updateWorkingSetState() {
        if (MainViewManager.getPaneCount() === 1 &&
                MainViewManager.getWorkingSetSize(MainViewManager.ACTIVE_PANE) === 0) {
            $workingSetViewsContainer.hide();
            $gearMenu.hide();
        } else {
            $workingSetViewsContainer.show();
            $gearMenu.show();
        }
    }
849997
def update_console(self):
        """"""
        self.chain.connection.log("Detecting console connection")
        is_console = self.driver.is_console(self.users_text)
        if is_console is not None:
            self.is_console = is_console
114124
public function actionUpdate()
    {
        
        $this->outVerbose("Updating language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "'...");
        $sortingMethod = tao_helpers_translation_TranslationFile::SORT_ASC_I;
        
       	// Get virgin translations from the source code and manifest.
       	$filePaths = array();
        foreach (self::$WHITE_LIST as $subFolder) {
            $filePaths[] = $this->options['input'] . DIRECTORY_SEPARATOR. $subFolder;
        }
        
       	$extensions = array('php', 'tpl', 'js', 'ejs');
       	$sourceCodeExtractor = new tao_helpers_translation_SourceCodeExtractor($filePaths, $extensions);
       	$sourceCodeExtractor->extract();
    	
       	$translationFile = new tao_helpers_translation_POFile();
        $translationFile->setSourceLanguage(tao_helpers_translation_Utils::getDefaultLanguage());
        $translationFile->setTargetLanguage($this->options['language']);
       	$translationFile->addTranslationUnits($sourceCodeExtractor->getTranslationUnits());
       	
        $file = MenuService::getStructuresFilePath($this->options['extension']);
        if (!is_null($file)) {
            $structureExtractor = new tao_helpers_translation_StructureExtractor(array($file));
           	$structureExtractor->extract();
            $structureUnits = $structureExtractor->getTranslationUnits();
            $this->outVerbose(count($structureUnits) . ' units extracted from structures.xml.');
            $translationFile->addTranslationUnits($structureUnits);
        }

       	// For each TU that was recovered, have a look in an older version
       	// of the translations.
       	$oldFilePath = $this->buildLanguagePath($this->options['extension'], $this->options['language']) . '/' .self::DEF_PO_FILENAME;
       	$translationFileReader = new tao_helpers_translation_POFileReader($oldFilePath);
       	$translationFileReader->read();
       	$oldTranslationFile = $translationFileReader->getTranslationFile();
       	
       	foreach ($oldTranslationFile->getTranslationUnits() as $oldTu) {
       		if (($newTu = $translationFile->getBySource($oldTu)) !== null && $oldTu->getTarget() != '') {
       			// No duplicates in TFs so I simply add it whatever happens.
       			// If it already has the same one, it means we will update it.
       			$newTu->setTarget($oldTu->getTarget());
       		}
       	}
        
       	$sortedTranslationFile = new tao_helpers_translation_POFile();
        $sortedTranslationFile->setSourceLanguage($translationFile->getSourceLanguage());
        $sortedTranslationFile->setTargetLanguage($translationFile->getTargetLanguage());
       	$sortedTranslationFile->addTranslationUnits($translationFile->sortBySource($sortingMethod));
       	$this->preparePOFile($sortedTranslationFile, true);
       	
       	// Write the new ones.
       	$poFileWriter = new tao_helpers_translation_POFileWriter($oldFilePath, $sortedTranslationFile);
       	$poFileWriter->write();
        $this->outVerbose("PO translation file '" . basename($oldFilePath) . "' in '" . $this->options['language'] . "' updated for extension '" . $this->options['extension'] . "'.");

		$translatableProperties = array(OntologyRdfs::RDFS_LABEL, OntologyRdfs::RDFS_COMMENT);

		// We now deal with RDF models.
        foreach ($this->getOntologyFiles() as $f){
                // Loop on 'master' models.
				$translationFile = $this->extractPoFileFromRDF($f, $translatableProperties);

                // The slave RDF file is the translation of the ontology that we find in /extId/Locales/langCode.
                $slavePOFilePath = $this->buildLanguagePath($this->options['extension'], $this->options['language']) . '/' . $this->getOntologyPOFileName($f);
                if (file_exists($slavePOFilePath)){
                    // Read the existing RDF Translation file for this RDF model.
                    $poReader = new tao_helpers_translation_POFileReader($slavePOFilePath);
                    $poReader->read();
                    $slavePOFile = $poReader->getTranslationFile();
                    
                    // Try to update translation units found in the master PO file with
                    // targets found in the old translation of the ontology.
                    foreach ($slavePOFile->getTranslationUnits() as $oTu){
                        $translationFile->addTranslationUnit($oTu);
                    }
                    
                    // Remove Slave PO file. It will be overwritten by the modified Master PO file.
                    tao_helpers_File::remove($slavePOFilePath);
                }
                
                // Write Master PO file as the new Slave PO file.
                $rdfWriter = new tao_helpers_translation_POFileWriter($slavePOFilePath, $translationFile);
                $rdfWriter->write();
                $this->outVerbose("Translation model {$this->getOntologyPOFileName($f)}  in '" . $this->options['language'] . "' updated for extension '" . $this->options['extension'] . "'.");
        }
        
       	$this->outVerbose("Language '" . $this->options['language'] . "' updated for extension '" . $this->options['extension'] . "'.");
        
    }
525305
private function updateRootDirOnTargetFile(): void
    {
        $realTemplateTestsPath = realpath(self::ROOT_TEMPLATE_PATH . self::TEST_DIR);
        if (0 === \strpos($this->templateFile->getPath(), $realTemplateTestsPath)) {
            $updatedPath = str_replace(
                '/src/',
                '/tests/',
                $this->targetFile->getPath()
            );
            $this->targetFile->setPath($updatedPath);
        }
    }
1341435
def main_update(self):
		
		# Renice updater thread to limit overload
		try:
			os.nice(1)
		except AttributeError as er:
			pass # os.nice is not available on windows
		time.sleep(self.refresh)

		try:
			while True:
				# We pick a timestamp to take in account the time used by update()
				timestamp=time.time()

				# Update data with user's defined function
				self.update()

				# We use this trick because we cannot use signals in a backoffice threads
				# and alarm() mess up with readline() in the main thread.
				delay=(timestamp+self.refresh)-time.time()
				if delay > 0:
					if delay > self.refresh:
						time.sleep(self.refresh)
					else:
						time.sleep(delay)

				# Commit change exactly every 'refresh' seconds, whatever update() takes long.
				# Commited values are a bit old, but for RRD, punctuals values
				# are better than fresh-but-not-time-constants values.
				self.commit()

		except Exception as e:
			self.error=e
			raise
695668
def add_system(self, system):
        '''
        
        '''
        if system not in self._systems:
            system.set_world(self)
            self._systems.append(system)
        else:
            raise DuplicateSystemError(system)
1292337
def zGetRefresh(self):
        """"""
        OpticalSystem._dde_link.zGetRefresh()
        OpticalSystem._dde_link.zSaveFile(self._sync_ui_file)
        self._iopticalsystem.LoadFile (self._sync_ui_file, False)
71373
def init(ctx):
    
    # install hooks
    git = ctx.obj['vcs']
    click.echo("Installing hooks...", nl=False)
    for old in ['commit-msg']:
        path = os.path.join(git.path, '.git/hooks', old)
        if os.path.exists(path):
            os.remove(path)
    for new in ['pre-commit', 'pre-push']:
        git.install_hook(new, hooks_manager.get_hook(new))
    click.echo("Done.")

    # add a config file if one does not exist
    config_path = os.path.join(git.path, 'eci.yaml')
    if not os.path.exists(config_path):
        click.echo("Placing a trivial config file in your project...", nl=False)
        with open(config_path, 'w') as f:
            f.write(yaml.safe_dump(
                {'tests': ['echo please modify to run your tests', 'true']}))
        click.echo("Done.")

    # initialize lock
    locking.init(git)

    # update installed version
    click.echo("Updating installed version...", nl=False)
    set_installed_version(git, easyci.__version__)
    click.echo("Done.")