Restore the file
776653
def restore(self):
        ''
        #
        #
        # As of 2016-06-15, Jottacloud.com has changed their restore api
        # To restore, this is what's done
        #
        # HTTP POST to https://www.jottacloud.com/web/restore/trash/list
        # Data:
        #     hash:undefined
        #     files:@0025d37be5329a18eece18dd93f793509e8_dGVzdF9kZWxldGUudHh0
        #
        # where `files` is a comma separated list, and each item is constructed thus:
        #  @<uuid of path>_<base64 encoded file name>
        #
        if not self.deleted:
            raise JFSError('Tried to restore a not deleted file')
        raise NotImplementedError('Jottacloud has changed the restore API. Please use jottacloud.com in a browser, for now.') #  TODO: figure out how to solve this
        url = 'https://www.jottacloud.com/rest/webrest/%s/action/restore' % self.jfs.username
        data = {'paths[]': self.path.replace(JFS_ROOT, ''),
                'web': 'true',
                'ts': int(time.time()),
                'authToken': 0}
        r = self.jfs.post(url, content=data)
        return r
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();

	}
1003143
public void restoreState() {
    h0=s0;
    h1=s1;
    h2=s2;
    h3=s3;
    h4=s4;
    
    length = saveLength;
    
    finalBuffer.clear();
    finalBuffer.put(saveBuffer);
  }
110707
def restore_from_object(self, obj):
        

        info = pickle.loads(obj)
        data = info["data"]
        tmpdir = tempfile.mkdtemp("restore_from_object", dir=self.logdir)
        checkpoint_path = os.path.join(tmpdir, info["checkpoint_name"])

        for file_name, file_contents in data.items():
            with open(os.path.join(tmpdir, file_name), "wb") as f:
                f.write(file_contents)

        self.restore(checkpoint_path)
        shutil.rmtree(tmpdir)
117020
public function restore()
    {
        $this->offsetRef = $this->offset;
        $this->lineRef = $this->line;
        $this->rowRef = $this->row;
    }
938204
def restore(inputfile, destination_root):
    

    ecode = 0
    try:
        anchore_print('Restoring anchore system from backup file %s ...' % (str(inputfile.name)))
        restoredir = config.restore(destination_root, inputfile)
        anchore_print("Anchore restored.")
    except Exception as err:
        anchore_print_err('operation failed')
        ecode = 1

    sys.exit(ecode)
1336728
function restore() {
    if (isOriginal) return;
    else isOriginal = true;
    ['log', 'debug', 'info', 'warn', 'error'].forEach((item) => {
        console[item] = originalConsoleFunctions[item];
    });
}
567970
void restoreFromSnapshot() throws IOException {
    Zxid snapshotZxid = persistence.getSnapshotZxid();
    LOG.debug("The last applied zxid in snapshot is {}", snapshotZxid);
    if (snapshotZxid != Zxid.ZXID_NOT_EXIST &&
        lastDeliveredZxid == Zxid.ZXID_NOT_EXIST) {
      // Restores from snapshot only if the lastDeliveredZxid == ZXID_NOT_EXIST,
      // which means it's the application's first time recovery.
      File snapshot = persistence.getSnapshotFile();
      try (FileInputStream fin = new FileInputStream(snapshot)) {
        LOG.debug("Restoring application's state from snapshot {}", snapshot);
        stateMachine.restore(fin);
        lastDeliveredZxid = snapshotZxid;
      }
    }
  }
173255
private void restore() {
    Preferences pref = Preferences
        .userNodeForPackage(ConnectionDialog.class);

    getHostField().setText(pref.get("host", "localhost"));
    getUserField().setText(pref.get("user", "guest"));

    boolean remember = pref.getBoolean("remember", false);
    boolean passwordSet = false;
    getRememberPasswordCheckBox().setSelected(remember);
    if (remember) {
      byte[] cipherText = pref.getByteArray("password", null);
      if (cipherText != null) {
        try {
          Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
          KeyGenerator keygen = KeyGenerator.getInstance("AES");
          SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
          random.setSeed(new byte[]{
            0x60, (byte) 0xFD, 0x28, 0x07, 0x35, 0x4A, 0x0D, 0x3B
          });
          byte[] iv = new byte[16];
          random.nextBytes(iv);
          IvParameterSpec spec = new IvParameterSpec(iv);
          keygen.init(128, random);
          cipher.init(Cipher.DECRYPT_MODE, keygen.generateKey(), spec);
          byte[] clearText = cipher.doFinal(cipherText);
          String password = new String(clearText);
          getPasswordField().setText(password);
          passwordSet = true;
        } catch (Exception e) {
          logger.error("Could not decrypt password", e);
        }
      }
    }
    if (!passwordSet) {
      getPasswordField().setText("");
    }
  }
715748
def restore_from_disk(self, clean_old_snapshot=False):
        
        base_filename = "%s/%s_%s_*.dat" % (self.snapshot_path, self.name, self.expiration)
        availables_snapshots = glob.glob(base_filename)
        last_period = self.current_period - dt.timedelta(days=self.expiration-1)
        for filename in availables_snapshots:
            snapshot_period = dt.datetime.strptime(filename.split('_')[-1].strip('.dat'), "%Y-%m-%d")
            if snapshot_period <  last_period and not clean_old_snapshot:
                continue
            else:
                self._union_bf_from_file(filename)
                if snapshot_period == self.current_period:
                    self._union_bf_from_file(filename, current=True)

            if snapshot_period < last_period and clean_old_snapshot:
                os.remove(filename)
        self.ready = True
471808
public function restore() {
        // if database, import database
        if ($this->_hasDatabaseDump()) {
            $this->restoreDatabase();
        } else {
            // Execute a spawn call in batch mode, to make sure all new columns are there
            $spawnCmd = new Garp_Cli_Command_Spawn();
            $spawnCmd->main(array('b' => true, 'only' => 'db'));
        }

        // set permissions on folders
        $this->setWritePermissions();

        // create snippets
        $this->createSnippets();

        // disable under construction
        Garp_Application::setUnderConstruction(false);
    }
1216140
private static DiscoverInfo restoreInfoFromFile(File file) throws Exception {
        String fileContent;
        try (DataInputStream dis = new DataInputStream(new FileInputStream(file))) {
            fileContent = dis.readUTF();
        }
        if (fileContent == null) {
            return null;
        }
        return PacketParserUtils.parseStanza(fileContent);
    }
1003282
function restore(options) {
  options = _.defaults(options || {}, {
    stdout: true,
    stderr: true
  });

  if (options.stdout)
    process.stdout.write = originalWrites.stdout;

  if (options.stderr)
    process.stderr.write = originalWrites.stderr;
}
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
1175642
def restore(source, offset):
    
    backup_location = os.path.join(
        os.path.dirname(os.path.abspath(source)), source + '.bytes_backup')
    click.echo('Reading backup from: {location}'.format(location=backup_location))

    if not os.path.isfile(backup_location):
        click.echo('No backup found for: {source}'.format(source=source))
        return

    with open(backup_location, 'r+b') as b:
        data = b.read()

    click.echo('Restoring {c} bytes from offset {o}'.format(c=len(data), o=offset))
    with open(source, 'r+b') as f:
        f.seek(offset)
        f.write(data)
        f.flush()

    click.echo('Changes written')
116573
public function restore()
	{
		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.php', $this->getCopied());

		$this->getFilesystem()->delete(app_path() . '/database/seeds/DatabaseSeeder.old');
	}
1323573
def _restore_file_lmt(self):
        # type: (Descriptor) -> None
        
        if not self._restore_file_properties.lmt or self._ase.lmt is None:
            return
        # timestamp() func is not available in py27
        ts = time.mktime(self._ase.lmt.timetuple())
        os.utime(str(self.final_path), (ts, ts))