Restore mets.xml to previous state
964665
def restore(self, chksum, choose_first=False):
        
        log = getLogger('ocrd.workspace_backup.restore')
        bak = None
        candidates = glob(join(self.backup_directory, '%s*' % chksum))
        if not candidates:
            log.error("No backup found: %s" % chksum)
            return
        if len(candidates) > 1 and not choose_first:
            raise Exception("Not unique, could be\n%s" % '\n'.join(candidates))
        bak = candidates[0]
        self.add()
        log.info("Restoring from %s/mets.xml" % bak)
        src = join(bak, 'mets.xml')
        dest = self.workspace.mets_target
        log.debug('cp "%s" "%s"', src, dest)
        copy(src, dest)
        self.workspace.reload_mets()
15269
def restore(cls, path=None):
        

        if path is None:
            path = cls._PATH_API_CONTEXT_DEFAULT

        with open(path, cls._FILE_MODE_READ) as file_:
            return cls.from_json(file_.read())
232543
def restore(self):
        """"""
        if self.current_editor is not None:
            self.collapseAll()
            editor_id = self.editor_ids[self.current_editor]
            self.root_item_selected(self.editor_items[editor_id])
1070728
def Restore(cls, state):
        """"""

        target = SlotIdentifier.FromString(state.get('target'))
        data = base64.b64decode(state.get('data'))
        var_id = state.get('var_id')
        valid = state.get('valid')

        return ConfigEntry(target, var_id, data, valid)
1146091
private function reindexResources() {
        if (count($this->resToReindex) == 0) {
            return;
        }

        $this->begin();
        foreach (array_unique($this->resToReindex) as $i) {
            try {
                $res = $this->getResourceByUri($i);
                $res->setMetadata($res->getMetadata());
                $res->updateMetadata();
            } catch (Deleted $e) {
                
            } catch (NotFound $e) {
                
            }
        }
        $this->resToReindex = [];
        $this->commit();
    }
1302337
def monkey_restore():
    """"""
    for k, v in originals.items():
        setattr(time_mod, k, v)
    
    global epoch
    epoch = None
43946
private void restoreData() {
		Map<String, ?> map = preferenceUtils.getAll();
		Set<String> strings = map.keySet();

		for (String string : strings) {
			if (string.startsWith(SharedPreferenceUtils.keyTestMode)) {
				preferenceUtils.restoreKey(string);
			}
		}

		refreshKeyValues();

	}
559776
def recoverFile(filename):
    
    ret = libxml2mod.xmlRecoverFile(filename)
    if ret is None:raise treeError('xmlRecoverFile() failed')
    return xmlDoc(_obj=ret)
767588
def restore(self, filename):
        
        matfile = loadmat(filename)

        if matfile['dim'] == 1:
            matfile['solution'] = matfile['solution'][0, :]

        self.elapsed_time = matfile['elapsed_time'][0, 0]
        self.solution = matfile['solution']

        return self
858164
def restoreXml(self, xml):
        
        self.uiFilterTXT.setText(xml.get('filter', ''))
        
        xlevels = xml.find('levels')
        xloggerlevels = xml.find('logger_levels')
        xtree = xml.find('tree')
        
        if xlevels is not None and xlevels.text:
            self.setActiveLevels(map(int, xlevels.text.split(',')))
        if xloggerlevels is not None and xloggerlevels.text:
            for key in xloggerlevels.text.split(','):
                logger, lvl = key.split(':')
                lvl = int(lvl)
                self.setLoggerLevel(logger, lvl)
        
        if xtree is not None:
            self.uiRecordTREE.restoreXml(xtree)
480354
function restore_options() {
  // Use default value showChangeLog = true.
  chrome.storage.sync.get({
    showChangeLog: true
  }, function (items) {
    document.getElementById('show_changelog').checked = items.showChangeLog;
  });
}
725140
def restore(self):
        
        sys = set(self._sys_modules.keys())
        for mod_name in sys.difference(self._saved_modules):
            del self._sys_modules[mod_name]
528345
protected function restoreSwitchState()
    {
        if ($this->backupSwitchExpression !== null) {
            $this->renderingContext->getViewHelperVariableContainer()->addOrUpdate(\TYPO3\Fluid\ViewHelpers\SwitchViewHelper::class, 'switchExpression', $this->backupSwitchExpression);
        }
        if ($this->backupBreakState !== false) {
            $this->renderingContext->getViewHelperVariableContainer()->addOrUpdate(\TYPO3\Fluid\ViewHelpers\SwitchViewHelper::class, 'break', true);
        }
    }
851664
public void restoreAfterSafeModeRestart() {
    // Put the sessionsToCtxFromDisk entries into their respective
    // SessionNotifierThreads instances
    for (Map.Entry<String, SessionNotificationCtx> entry :
          sessionsToCtxFromDisk.entrySet()) {
      // The conf and the conf related properties are missing in the
      // sessionsToCtx objects
      entry.getValue().setConf(conf);
      handleToNotifier(entry.getKey()).sessionsToCtx.put(entry.getKey(),
                                                          entry.getValue());
      sessionsToCtxFromDisk.remove(entry);
    }

    // Put the deletedSessions into the the respective SessionNotifierThreads
    for (String deletedSessionHandle : deletedSessionsFromDisk) {
      SessionNotifierThread notifierThread =
        handleToNotifier(deletedSessionHandle);
      if (notifierThread.sessionsToCtx.get(deletedSessionHandle) != null) {
        notifierThread.deletedSessions.put(deletedSessionHandle,
                                            notifierThread);
      }
      deletedSessionsFromDisk.remove(deletedSessionHandle);
    }

    // We can now start the notifier threads
    for (int i = 0; i < numNotifierThreads; i++) {
      notifierThreads[i].start();
    }
  }
635799
def restore(path, rev)
      resp = request('/files/restore', path: path, rev: rev)
      FileMetadata.new(resp)
    end
718786
def workspace_from_nothing(self, directory, mets_basename='mets.xml', clobber_mets=False):
        
        if directory is None:
            directory = tempfile.mkdtemp(prefix=TMP_PREFIX)
        if not exists(directory):
            makedirs(directory)

        mets_fpath = join(directory, mets_basename)
        if not clobber_mets and exists(mets_fpath):
            raise Exception("Not clobbering existing mets.xml in '%s'." % directory)
        mets = OcrdMets.empty_mets()
        with open(mets_fpath, 'wb') as fmets:
            log.info("Writing %s", mets_fpath)
            fmets.write(mets.to_xml(xmllint=True))

        return Workspace(self, directory, mets)
1311663
def restoreXml(self, xml):
        
        self.uiRecordTREE.restoreXml(xml.find('tree'))
        
        # restore the query
        xquery = xml.find('query')
        if xquery is not None:
            self.setQuery(Q.fromXml(xquery[0]))