Define the common setting that any restore activity will have
975720
protected function define_settings() {

        // All the settings related to this activity will include this prefix
        $settingprefix = $this->info->modulename . '_' . $this->info->moduleid . '_';

        // All these are common settings to be shared by all activities

        // Define activity_include (to decide if the whole task must be really executed)
        // Dependent of:
        // - activities root setting
        // - section_included setting (if exists)
        $settingname = $settingprefix . 'included';
        $activity_included = new restore_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true);
        $activity_included->get_ui()->set_icon(new image_icon('icon', get_string('pluginname', $this->modulename),
            $this->modulename, array('class' => 'iconlarge icon-post')));
        $this->add_setting($activity_included);
        // Look for "activities" root setting
        $activities = $this->plan->get_setting('activities');
        $activities->add_dependency($activity_included);
        // Look for "section_included" section setting (if exists)
        $settingname = 'section_' . $this->info->sectionid . '_included';
        if ($this->plan->setting_exists($settingname)) {
            $section_included = $this->plan->get_setting($settingname);
            $section_included->add_dependency($activity_included);
        }

        // Define activity_userinfo. Dependent of:
        // - users root setting
        // - section_userinfo setting (if exists)
        // - activity_included setting.
        $settingname = $settingprefix . 'userinfo';
        $defaultvalue = false;
        if (isset($this->info->settings[$settingname]) && $this->info->settings[$settingname]) { // Only enabled when available
            $defaultvalue = true;
        }

        $activity_userinfo = new restore_activity_userinfo_setting($settingname, base_setting::IS_BOOLEAN, $defaultvalue);
        if (!$defaultvalue) {
            // This is a bit hacky, but if there is no user data to restore, then
            // we replace the standard check-box with a select menu with the
            // single choice 'No', and the select menu is clever enough that if
            // there is only one choice, it just displays a static string.
            //
            // It would probably be better design to have a special UI class
            // setting_ui_checkbox_or_no, rather than this hack, but I am not
            // going to do that today.
            $activity_userinfo->set_ui(new backup_setting_ui_select($activity_userinfo, '-',
                    array(0 => get_string('no'))));
        } else {
            $activity_userinfo->get_ui()->set_label('-');
        }

        $this->add_setting($activity_userinfo);

        // Look for "users" root setting
        $users = $this->plan->get_setting('users');
        $users->add_dependency($activity_userinfo);

        // Look for "section_userinfo" section setting (if exists)
        $settingname = 'section_' . $this->info->sectionid . '_userinfo';
        if ($this->plan->setting_exists($settingname)) {
            $section_userinfo = $this->plan->get_setting($settingname);
            $section_userinfo->add_dependency($activity_userinfo);
        }

        // Look for "activity_included" setting.
        $activity_included->add_dependency($activity_userinfo);

        // End of common activity settings, let's add the particular ones.
        $this->define_my_settings();
    }
543292
public final void restoreDefaults() {
        SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences();

        if (getPreferenceScreen() != null) {
            restoreDefaults(getPreferenceScreen(), sharedPreferences);
        }
    }
899185
protected function define_settings() {

        // Define overwrite_conf to decide if course configuration will be restored over existing one.
        $overwrite = new restore_course_overwrite_conf_setting('overwrite_conf', base_setting::IS_BOOLEAN, false);
        $overwrite->set_ui(new backup_setting_ui_select($overwrite, $overwrite->get_name(),
            array(1 => get_string('yes'), 0 => get_string('no'))));
        $overwrite->get_ui()->set_label(get_string('setting_overwrite_conf', 'backup'));
        if ($this->get_target() == backup::TARGET_NEW_COURSE) {
            $overwrite->set_value(true);
            $overwrite->set_status(backup_setting::LOCKED_BY_CONFIG);
            $overwrite->set_visibility(backup_setting::HIDDEN);
            $course = (object)['fullname' => null, 'shortname' => null, 'startdate' => null];
        } else {
            $course = get_course($this->get_courseid());
        }
        $this->add_setting($overwrite);

        $fullnamedefaultvalue = $this->get_info()->original_course_fullname;
        $fullname = new restore_course_defaultcustom_setting('course_fullname', base_setting::IS_TEXT, $fullnamedefaultvalue);
        $fullname->set_ui(new backup_setting_ui_defaultcustom($fullname, get_string('setting_course_fullname', 'backup'),
            ['customvalue' => $fullnamedefaultvalue, 'defaultvalue' => $course->fullname]));
        $this->add_setting($fullname);

        $shortnamedefaultvalue = $this->get_info()->original_course_shortname;
        $shortname = new restore_course_defaultcustom_setting('course_shortname', base_setting::IS_TEXT, $shortnamedefaultvalue);
        $shortname->set_ui(new backup_setting_ui_defaultcustom($shortname, get_string('setting_course_shortname', 'backup'),
            ['customvalue' => $shortnamedefaultvalue, 'defaultvalue' => $course->shortname]));
        $this->add_setting($shortname);

        $startdatedefaultvalue = $this->get_info()->original_course_startdate;
        $startdate = new restore_course_defaultcustom_setting('course_startdate', base_setting::IS_INTEGER, $startdatedefaultvalue);
        $startdate->set_ui(new backup_setting_ui_defaultcustom($startdate, get_string('setting_course_startdate', 'backup'),
            ['customvalue' => $startdatedefaultvalue, 'defaultvalue' => $course->startdate, 'type' => 'date_time_selector']));
        $this->add_setting($startdate);

        $keep_enrols = new restore_course_generic_setting('keep_roles_and_enrolments', base_setting::IS_BOOLEAN, false);
        $keep_enrols->set_ui(new backup_setting_ui_select($keep_enrols, $keep_enrols->get_name(), array(1=>get_string('yes'), 0=>get_string('no'))));
        $keep_enrols->get_ui()->set_label(get_string('setting_keep_roles_and_enrolments', 'backup'));
        if ($this->get_target() != backup::TARGET_CURRENT_DELETING and $this->get_target() != backup::TARGET_EXISTING_DELETING) {
            $keep_enrols->set_value(false);
            $keep_enrols->set_status(backup_setting::LOCKED_BY_CONFIG);
            $keep_enrols->set_visibility(backup_setting::HIDDEN);
        }
        $this->add_setting($keep_enrols);

        $keep_groups = new restore_course_generic_setting('keep_groups_and_groupings', base_setting::IS_BOOLEAN, false);
        $keep_groups->set_ui(new backup_setting_ui_select($keep_groups, $keep_groups->get_name(), array(1=>get_string('yes'), 0=>get_string('no'))));
        $keep_groups->get_ui()->set_label(get_string('setting_keep_groups_and_groupings', 'backup'));
        if ($this->get_target() != backup::TARGET_CURRENT_DELETING and $this->get_target() != backup::TARGET_EXISTING_DELETING) {
            $keep_groups->set_value(false);
            $keep_groups->set_status(backup_setting::LOCKED_BY_CONFIG);
            $keep_groups->set_visibility(backup_setting::HIDDEN);
        }
        $this->add_setting($keep_groups);

    }
652112
def restoreSettings(self, settings):
        
        settings.beginGroup(self.objectName())
        
        curr_prof = None
        curr_name = unwrapVariant(settings.value('current'))
        
        profiles = []
        for prof_name in settings.childGroups():
            settings.beginGroup(prof_name)
            
            prof_str = unwrapVariant(settings.value('profile'))
            profile  = XViewProfile.fromString(prof_str)
            profile.setName(prof_name)
            
            if prof_name == curr_name:
                curr_prof = profile
            
            profiles.append(profile)
            
            settings.endGroup()
        
        self.blockSignals(True)
        self._profileCombo.blockSignals(True)
        self.setProfiles(profiles)
        
        if curr_prof:
            self.setCurrentProfile(curr_prof)
        
        self._profileCombo.blockSignals(False)
        self.blockSignals(False)
        
        settings.endGroup()
590808
private void commonInit() {
        listenerFlag = HTTP_SESSION_NO_LISTENER;
        deferWriteUntilNextTick = 0;
        mLastWriteTime = -1;
        removingSessionFromCache = false;
        _refCount = 0;
        _version = initialCacheId;
    }
926963
def reset!(options = {})
      MsRestAzure::Common::Configurable.keys.each do |key|
        default_value = MsRestAzure::Common::Default.options[key]
        instance_variable_set(:"@#{key}", options.fetch(key, default_value))
      end

      if(options[:credentials].nil?)
        # The user has not passed in the credentials. So, the SDK has to
        # build the credentials itself.
        fail ArgumentError, 'tenant_id is nil' if self.tenant_id.nil?
        fail ArgumentError, 'client_id is nil' if self.client_id.nil?
        fail ArgumentError, 'client_secret is nil' if self.client_secret.nil?
        fail ArgumentError, 'active_directory_settings is nil' if self.active_directory_settings.nil?

        self.credentials = MsRest::TokenCredentials.new(
            MsRestAzure::ApplicationTokenProvider.new(
                self.tenant_id, self.client_id, self.client_secret, self.active_directory_settings))
      else
        self.credentials = options[:credentials]
      end

      self
    end
860366
def settings(**kwargs):
    
    from pyemma import config

    old_settings = {}
    try:
        # remember old setting, set new one. May raise ValueError, if invalid setting is given.
        for k, v in kwargs.items():
            old_settings[k] = getattr(config, k)
            setattr(config, k, v)
        yield
    finally:
        # restore old settings
        for k, v in old_settings.items():
            setattr(config, k, v)
1355462
def create_restore_point(self, name=None):
        '''
        '''
        if name is None:
            for i in iter(int, 1):
                name = datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S%f') + '_' + str(i)
                try:
                    self.config_state[name]
                except KeyError:
                    break
                else:
                    pass
        if name in self.config_state:
            raise ValueError('Restore point %s already exists' % name)
        self.config_state[name] = (copy.deepcopy(self.global_registers), copy.deepcopy(self.pixel_registers))
        return name
382216
public static void launchPermissionSettings(Activity activity) {
        Intent intent = new Intent();
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
        activity.startActivity(intent);
    }
1370562
public static br_restoreconfig restoreconfig(nitro_service client, br_restoreconfig resource) throws Exception
	{
		return ((br_restoreconfig[]) resource.perform_operation(client, "restoreconfig"))[0];
	}
1084683
def setup_common_actions(self):
        """"""
        # Filters
        filters_action = create_action(self, _("Edit filename filters..."),
                                       None, ima.icon('filter'),
                                       triggered=self.edit_filter)
        # Show all files
        all_action = create_action(self, _("Show all files"),
                                   toggled=self.toggle_all)
        all_action.setChecked(self.show_all)
        self.toggle_all(self.show_all)

        # Show all files
        single_click_to_open = create_action(
            self,
            _("Single click to open"),
            toggled=self.set_single_click_to_open,
        )
        single_click_to_open.setChecked(self.single_click_to_open)
        return [filters_action, all_action, single_click_to_open]
645377
def get_restore_path(self, status=None):
        
        status = self.get_status() if status is None else status
        return config.get_restore_path(status.name.lower())
1299237
def p_restore(p):
    
    if len(p) == 2:
        id_ = '__DATA__{0}'.format(len(gl.DATAS))
    else:
        id_ = p[2]

    lbl = check_and_make_label(id_, p.lineno(1))
    p[0] = make_sentence('RESTORE', lbl)
118307
def restore_default_configuration():
    

    def restore(target, default_value):
        if target == default_value:
            return default_value

        if not isinstance(target, RedirectBuffer):
            return target

        try:
            target.active = False
            target.close()
        except Exception:
            pass

        return default_value

    sys.stdout = restore(sys.stdout, sys.__stdout__)
    sys.stderr = restore(sys.stderr, sys.__stderr__)
1259066
def restore(self, key, ttl, value):
        """"""
        return self.execute(b'RESTORE', key, ttl, value)
531486
protected function apply_defaults() {
        $this->log('applying restore defaults', backup::LOG_DEBUG);
        restore_controller_dbops::apply_config_defaults($this);
        $this->set_status(backup::STATUS_CONFIGURED);
    }
535209
def restore_state(self):
        
        settings = QSettings()
        try:
            last_path = settings.value('directory', type=str)
        except TypeError:
            last_path = ''
        self.output_directory.setText(last_path)