Restore Image resource from backup
542253
public function reset() {
		if (!$this->_image_resource_backup) {
			throw new ImageException('Cannot restore, no backup has been taken for image resource');
		}

		$cloned = $this->cloneResource($this->_image_resource_backup);

		$this->_image_resource = $cloned['resource'];
		$this->updateImageInfo($cloned['width'], $cloned['height']);
		return $this;
	}
237274
def restore(self, remotepath):
		''' 
		'''
		rpath = get_pcs_path(remotepath)
		# by default, only 1000 items, more than that sounds a bit crazy
		pars = {
			'method' : 'listrecycle' }

		self.pd("Searching for fs_id to restore")
		return self.__get(pcsurl + 'file', pars, self.__restore_search_act, rpath)
471906
def restore(self, res_id, backup_snap=None):
        
        name = self._get_name()
        out = self._cli.restore_snap(name, res_id, backup_snap)
        ex.raise_if_err(out, 'failed to restore snap {}.'.format(name),
                        default=ex.VNXSnapError)
1183063
def _getProcessedImage(self):
        """"""
        if self.imageDisp is None:
            self.imageDisp = self.image
            self.levelMin, self.levelMax = self._quickLevels(
                self.imageDisp)
            #list( map(float, self._quickLevels(self.imageDisp)))
        return self.imageDisp
489917
public function restore()
    {
        if ($this->backup instanceof NotSet) {
            if (is_file($this->name)) {
                unlink($this->name);
            }
        } else {
            file_put_contents($this->name, $this->backup);
        }
    }
1076204
def __get_image(conn, vm_):
    '''
    
    '''
    img = config.get_cloud_config_value(
        'image', vm_, __opts__, default='debian-7', search_global=False)
    return conn.ex_get_image(img)
1369748
protected function doRestoreDB() {
		if ($this->Pipeline()->SkipSnapshot) return false;

		return $this->getConfigSetting('RestoreDB') && $this->Pipeline()->PreviousSnapshot();
	}
667439
def restore_state(self):
        """"""
        # restore last source path
        last_source_path = setting(
            'lastSourceDir', self.default_directory, expected_type=str)
        self.source_directory.setText(last_source_path)

        # restore path pdf output
        last_output_dir = setting(
            'lastOutputDir', self.default_directory, expected_type=str)
        self.output_directory.setText(last_output_dir)

        # restore default output dir combo box
        use_default_output_dir = bool(setting(
            'useDefaultOutputDir', True, expected_type=bool))
        self.scenario_directory_radio.setChecked(
            use_default_output_dir)
388039
def restore(ctx, filename):
    
    filename = filename or background_path
    if not os.path.isfile(filename):
        LOG.warning("File {} does not exist. Please point to a valid file".format(filename))
        ctx.abort()
    
    call = ['mongorestore', '--gzip', '--db', 'loqusdb', '--archive={}'.format(filename)]
    
    LOG.info('Restoring database from %s', filename)
    start_time = datetime.now()
    try:
        completed = subprocess.run(call, check=True)
    except subprocess.CalledProcessError as err:
        LOG.warning(err)
        ctx.abort()
    
    LOG.info('Database restored succesfully')
    LOG.info('Time to restore database: {0}'.format(datetime.now()-start_time))
526351
function handleImageLoad (imageUrl) {
  _backingStores.forEach(function (backingStore) {
    if (layerContainsImage(backingStore.layer, imageUrl)) {
      invalidateBackingStore(backingStore.id);
    }
  });
}
401916
function(originalImage, scaledImageDataUri, log) {
        "use strict";

        var reader = new FileReader(),
            insertionEffort = new qq.Promise(),
            originalImageDataUri = "";

        reader.onload = function() {
            originalImageDataUri = reader.result;
            insertionEffort.success(qq.ExifRestorer.restore(originalImageDataUri, scaledImageDataUri));
        };

        reader.onerror = function() {
            log("Problem reading " + originalImage.name + " during attempt to transfer EXIF data to scaled version.", "error");
            insertionEffort.failure();
        };

        reader.readAsDataURL(originalImage);

        return insertionEffort;
    }
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)
1288283
def _restore_file(path, delete_backup=True):
    
    backup_base = '/var/local/woven-backup'
    backup_path = ''.join([backup_base,path])
    if exists(backup_path):
        if delete_backup:
            sudo('mv -f %s %s'% (backup_path,path))
        else:
            sudo('cp -f %s %s'% (backup_path,path))
952530
def restore(self, url):
        """"""
        self._run(
            [
                "heroku",
                "pg:backups:restore",
                "{}".format(url),
                "DATABASE_URL",
                "--app",
                self.name,
                "--confirm",
                self.name,
            ]
        )
974294
def apply(self, resource):
        
        if not isinstance(resource, Image.Image):
            raise ValueError('Unknown resource format')

        original_width, original_height = resource.size

        if self.start[0] < original_width or self.start[1] < original_height:
            left = self.start[0]
            upper = self.start[1]
        else:
            left = 0
            upper = 0

        right = self.start[0] + self.size[0]
        lower = self.start[1] + self.size[1]

        resource_format = resource.format
        resource = resource.crop(
            (
                left,
                upper,
                right if right < original_width else original_width,
                lower if lower < original_height else original_height
            )
        )
        resource.format = resource_format

        return resource
742380
private function restoreOldVersionFile(){
		$oldVersionFilePath = $this->ddToolsDeprecatedPath.$this->ddToolsClassFileName;
		$oldVersionBackupFilePath = $this->ddToolsDeprecatedPath.$this->ddToolsOldVersionBackupFileName;
		
		//Check if an old version of the library is in assets/snippets and its backup exists 
		if(is_file($oldVersionBackupFilePath) && is_file($oldVersionFilePath)){
			//Restore from the backup
			file_put_contents(
				$this->ddToolsDeprecatedPath.$this->ddToolsClassFileName,
				file_get_contents($this->ddToolsDeprecatedPath.$this->ddToolsOldVersionBackupFileName)
			);
			
			//Remove backup
			unlink($oldVersionBackupFilePath);
		}
	}
354916
def restore
      return unless File.exist?(Setting[:histfile])

      File.readlines(Setting[:histfile]).reverse_each { |l| push(l.chomp) }
    end