Save or update the private state needed by the cloud provider.
777592
def _save_or_update(self):
        
        with self._resource_lock:
            if not self._config or not self._config._storage_path:
                raise Exception("self._config._storage path is undefined")
            if not self._config._base_name:
                raise Exception("self._config._base_name is undefined")
            if not os.path.exists(self._config._storage_path):
                os.makedirs(self._config._storage_path)
            path = self._get_cloud_provider_storage_path()
            with open(path, 'wb') as storage:
                pickle.dump(self._config, storage, pickle.HIGHEST_PROTOCOL)
                pickle.dump(self._subscriptions, storage,
                            pickle.HIGHEST_PROTOCOL)
94759
function saveState () {
    winston.info('Saving current state');
    jsonfile.writeFileSync(STATE_FILE, {
        subscriptions: subscriptions,
        callback: callback,
        history: history,
        version: CURRENT_VERSION
    }, {
        spaces: 4
    });
}
493351
def save(self):
        """"""
        logger.debug("Save the GUI state to `%s`.", self.path)
        _save_json(self.path, {k: v for k, v in self.items()
                               if k not in ('config_dir', 'name')})
1296357
def save_authorization(self, authorization_form, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceAdminSession.update_resource
        if authorization_form.is_for_update():
            return self.update_authorization(authorization_form, *args, **kwargs)
        else:
            return self.create_authorization(authorization_form, *args, **kwargs)
1244174
function make_private() {
  return {
    stats: {
      start: Date.now(),
      act: {
        calls: 0,
        done: 0,
        fails: 0,
        cache: 0
      },
      actmap: {}
    },
    actdef: {},
    transport: {
      register: []
    },
    plugins: {},
    ignore_plugins: {}
  }
}
978019
function savePrivateProfile(objPrivateProfile, address, attestor_address, onDone){
	db.query(
		"INSERT "+db.getIgnore()+" INTO private_profiles (unit, payload_hash, attestor_address, address, src_profile) VALUES(?,?,?,?,?)", 
		[objPrivateProfile.unit, objPrivateProfile.payload_hash, attestor_address, address, JSON.stringify(objPrivateProfile.src_profile)], 
		function (res) {
			var private_profile_id = (res.insertId && res.affectedRows) ? res.insertId : 0;

			var insert_fields = function(current_src_profile) {
				var arrQueries = [];
				var isSrcProfileUpdated = false;
				for (var field in objPrivateProfile.src_profile){
					var arrValueAndBlinding = objPrivateProfile.src_profile[field];
					if (ValidationUtils.isArrayOfLength(arrValueAndBlinding, 2)) {
						if (!current_src_profile || !current_src_profile[field] || !ValidationUtils.isArrayOfLength(current_src_profile[field], 2)) {
							if (current_src_profile) {
								isSrcProfileUpdated = true;
								current_src_profile[field] = arrValueAndBlinding;
							}
							db.addQuery(arrQueries, "INSERT INTO private_profile_fields (private_profile_id, field, value, blinding) VALUES(?,?,?,?)", 
							[private_profile_id, field, arrValueAndBlinding[0], arrValueAndBlinding[1] ]);
						}
					}
				}
				if (isSrcProfileUpdated)
					db.addQuery(arrQueries, "UPDATE private_profiles SET src_profile=? WHERE private_profile_id=?", [JSON.stringify(current_src_profile), private_profile_id]);
				async.series(arrQueries, onDone);
			}

			if (!private_profile_id) { // already saved profile but with new fields being revealed
				db.query("SELECT private_profile_id, src_profile FROM private_profiles WHERE payload_hash=?", [objPrivateProfile.payload_hash], function(rows) {
					if (!rows.length)
						throw Error("can't insert private profile "+JSON.stringify(objPrivateProfile));
					private_profile_id = rows[0].private_profile_id;
					var src_profile = JSON.parse(rows[0].src_profile);
					insert_fields(src_profile);
				});
			}
			else
				insert_fields();

		}
	);
}
472968
def PushState(self, **_):
    """"""
    if self.verbose:
      logging.debug("Storing state %r", self.state)
    self.state_stack.append(self.state)
412810
function Save()
    {
        $this->contentRights->Save();
        if (!$this->rights)
        {
            $this->rights = new BackendContainerRights();
        }
        $this->rights->SetEdit($this->Value('Edit'));
        $this->rights->SetRemove($this->Value('Remove'));
        $this->rights->SetContentRights($this->contentRights->Rights());
        $this->rights->Save();
    }
842624
def update_state(self):
        
        response = self.api_interface.get_device_state(self, id_override=self.parent.object_id(),
                                                       type_override=self.parent.object_type())
        self._update_state_from_response(response)
287145
def _save(self, data):
        
        self.state = data.get('state')
        self.created = dt_time(data.get('created'))
        self.updated = dt_time(data.get('updated'))
40756
public function restoreState()
    {
        if ($data = $this->stateService->getByKey(self::IDENTIFIER)) {
            list($this->total, $this->status, $this->updateRequested) = $data;
        }
    }
983652
def put(self, request, *args, **kwargs):
        
        with reversion.create_revision():
            reversion.set_user(request.user)
            reversion.set_comment('changed through the RESTful API from ip %s' % request.META['REMOTE_ADDR'])
            return self.update(request, *args, **kwargs)
914696
def save(self, updateBy=None, *args, **kwargs):
        '''
        
        '''

        if (
            self.staffMember and self.staffMember.userAccount and not self.user
        ) or (
            isinstance(updateBy,StaffMember) and self.staffMember.userAccount
        ):
            self.user = self.staffMember.userAccount
        elif (
            self.user and getattr(self.user,'staffmember',None) and not self.staffMember
        ) or (
            isinstance(updateBy,User) and getattr(self.user,'staffmember',None)
        ):
            self.staffMember = self.user.staffmember

        # Don't replace the name if it has been given, but do fill it out if it is blank.
        if not self.name:
            if self.user and self.user.get_full_name():
                self.name = self.user.get_full_name()
            elif self.staffMember:
                self.name = self.staffMember.fullName or self.staffMember.privateEmail
            elif self.location:
                self.name = self.location.name

        super(TransactionParty, self).save(*args, **kwargs)
774990
void saveState(Bundle outState) {
        outState.putString(STATE_CURRENT_PATH, currentPath);
        outState.putSerializable(STATE_FOLDERS, folders);
        outState.putSerializable(STATE_NEXT_TOKENS, nextTokens);
    }
474048
public void onSaveInstanceState(Bundle outState) {
    if (state != State.IDLE) {
      throw new IllegalStateException("Cannot handle onSaveInstanceState while " + state);
    }
    rootBundle = outState;

    state = State.SAVING;

    // Make a dwindling copy of the services, in case one is deleted as a side effect
    // of another's onSave.
    List<Map.Entry<String, BundleService>> servicesToBeSaved =
        new ArrayList<>(scopedServices.entrySet());

    while (!servicesToBeSaved.isEmpty()) {
      Map.Entry<String, BundleService> entry = servicesToBeSaved.remove(0);
      if (scopedServices.containsKey(entry.getKey())) entry.getValue().saveToRootBundle(rootBundle);
    }

    state = State.IDLE;
  }
462836
public void updatePrivate(int taskId, boolean priv) {
		getResourceFactory().getApiResource("/task/" + taskId + "/private")
				.entity(new TaskPrivate(priv), MediaType.APPLICATION_JSON_TYPE)
				.put();
	}
269922
async def update_state(self, msg, _context):
        """"""

        name = msg.get('name')
        status = msg.get('new_status')

        await self.service_manager.update_state(name, status)