Custom save method does the following:
            * save shortcuts if HSTORE is enabled
493531
def save(self, *args, **kwargs):
        
        if 'node' not in self.shortcuts:
            self.shortcuts['node'] = self.device.node

        if 'user' not in self.shortcuts and self.device.node.user:
            self.shortcuts['user'] = self.device.node.user

        if 'layer' not in self.shortcuts and 'nodeshot.core.layers' in settings.INSTALLED_APPS:
            self.shortcuts['layer'] = self.device.node.layer

        super(Interface, self).save(*args, **kwargs)
720934
def save_shortcuts(self):
        """"""
        self.check_shortcuts()
        for shortcut in self.source_model.shortcuts:
            shortcut.save()
464061
private function setSaveHandler() {

		if (PHP_VERSION_ID >= 50400) {

			$this->storageEngine = new NativeSessionWrapper();

			if(!session_set_save_handler($this->storageEngine, FALSE)) {
				throw new \RuntimeException('Could not  set session save handler.');
			}

		}

	}
249589
private function saveLibraries() {
    // Keep track of the number of libraries that have been saved
    $newOnes = 0;
    $oldOnes = 0;

    // Go through libraries that came with this package
    foreach ($this->h5pC->librariesJsonData as $libString => &$library) {
      // Find local library identifier
      $libraryId = $this->h5pC->getLibraryId($library, $libString);

      // Assume new library
      $new = TRUE;
      if ($libraryId) {
        // Found old library
        $library['libraryId'] = $libraryId;

        if ($this->h5pF->isPatchedLibrary($library)) {
          // This is a newer version than ours. Upgrade!
          $new = FALSE;
        }
        else {
          $library['saveDependencies'] = FALSE;
          // This is an older version, no need to save.
          continue;
        }
      }

      // Indicate that the dependencies of this library should be saved.
      $library['saveDependencies'] = TRUE;

      // Convert metadataSettings values to boolean & json_encode it before saving
      $library['metadataSettings'] = isset($library['metadataSettings']) ?
        H5PMetadata::boolifyAndEncodeSettings($library['metadataSettings']) :
        NULL;

      $this->h5pF->saveLibraryData($library, $new);

      // Save library folder
      $this->h5pC->fs->saveLibrary($library);

      // Remove cached assets that uses this library
      if ($this->h5pC->aggregateAssets && isset($library['libraryId'])) {
        $removedKeys = $this->h5pF->deleteCachedAssets($library['libraryId']);
        $this->h5pC->fs->deleteCachedAssets($removedKeys);
      }

      // Remove tmp folder
      H5PCore::deleteFileTree($library['uploadDirectory']);

      if ($new) {
        $newOnes++;
      }
      else {
        $oldOnes++;
      }
    }

    // Go through the libraries again to save dependencies.
    foreach ($this->h5pC->librariesJsonData as &$library) {
      if (!$library['saveDependencies']) {
        continue;
      }

      // TODO: Should the table be locked for this operation?

      // Remove any old dependencies
      $this->h5pF->deleteLibraryDependencies($library['libraryId']);

      // Insert the different new ones
      if (isset($library['preloadedDependencies'])) {
        $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['preloadedDependencies'], 'preloaded');
      }
      if (isset($library['dynamicDependencies'])) {
        $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['dynamicDependencies'], 'dynamic');
      }
      if (isset($library['editorDependencies'])) {
        $this->h5pF->saveLibraryDependencies($library['libraryId'], $library['editorDependencies'], 'editor');
      }

      // Make sure libraries dependencies, parameter filtering and export files gets regenerated for all content who uses this library.
      $this->h5pF->clearFilteredParameters($library['libraryId']);
    }

    // Tell the user what we've done.
    if ($newOnes && $oldOnes) {
      if ($newOnes === 1)  {
        if ($oldOnes === 1)  {
          // Singular Singular
          $message = $this->h5pF->t('Added %new new H5P library and updated %old old one.', array('%new' => $newOnes, '%old' => $oldOnes));
        }
        else {
          // Singular Plural
          $message = $this->h5pF->t('Added %new new H5P library and updated %old old ones.', array('%new' => $newOnes, '%old' => $oldOnes));
        }
      }
      else {
        // Plural
        if ($oldOnes === 1)  {
          // Plural Singular
          $message = $this->h5pF->t('Added %new new H5P libraries and updated %old old one.', array('%new' => $newOnes, '%old' => $oldOnes));
        }
        else {
          // Plural Plural
          $message = $this->h5pF->t('Added %new new H5P libraries and updated %old old ones.', array('%new' => $newOnes, '%old' => $oldOnes));
        }
      }
    }
    elseif ($newOnes) {
      if ($newOnes === 1)  {
        // Singular
        $message = $this->h5pF->t('Added %new new H5P library.', array('%new' => $newOnes));
      }
      else {
        // Plural
        $message = $this->h5pF->t('Added %new new H5P libraries.', array('%new' => $newOnes));
      }
    }
    elseif ($oldOnes) {
      if ($oldOnes === 1)  {
        // Singular
        $message = $this->h5pF->t('Updated %old H5P library.', array('%old' => $oldOnes));
      }
      else {
        // Plural
        $message = $this->h5pF->t('Updated %old H5P libraries.', array('%old' => $oldOnes));
      }
    }

    if (isset($message)) {
      $this->h5pF->setInfoMessage($message);
    }
  }
311399
def save(self, source: IO):
        
        write = source.write

        write(pack(
            '>IHH',
            ClassFile.MAGIC,
            self.version.minor,
            self.version.major
        ))

        self._constants.pack(source)

        write(self.access_flags.pack())
        write(pack(
            f'>HHH{len(self._interfaces)}H',
            self._this,
            self._super,
            len(self._interfaces),
            *self._interfaces
        ))

        self.fields.pack(source)
        self.methods.pack(source)
        self.attributes.pack(source)
133055
public function actionSave()
    {
        if(Yii::$app->request->isAjax)
        {
            $p = Yii::$app->request->post();
            // after find there are old values (see modules/OneFile::afterFind())
            $model = OneFile::findOne($p['file_id']);
            // so, change them for new defs (see modules/OneFile::beforeSave())
            $model->vars = json_decode($p['defs']);
            $model->save(false, ['defs']);
            
            echo $p['file_id'];
        }
    }
32634
def register_actions(self, shortcut_manager):
        
        self.add_callback_to_shortcut_manager('save', partial(self.call_action_callback, "on_save_activate"))
        self.add_callback_to_shortcut_manager('save_as', partial(self.call_action_callback, "on_save_as_activate"))
        self.add_callback_to_shortcut_manager('save_as_copy', partial(self.call_action_callback,
                                                                      "on_save_as_copy_activate"))
        self.add_callback_to_shortcut_manager('save_state_as', partial(self.call_action_callback,
                                                                       "on_save_selected_state_as_activate"))
        self.add_callback_to_shortcut_manager('substitute_state', partial(self.call_action_callback,
                                                                          "on_substitute_selected_state_activate"))
        self.add_callback_to_shortcut_manager('substitute_library_with_template',
                                              partial(self.call_action_callback,
                                                      "on_substitute_library_with_template_activate"))
        self.add_callback_to_shortcut_manager('open', partial(self.call_action_callback, "on_open_activate"))
        self.add_callback_to_shortcut_manager('open_library_state_separately',
                                              self.on_open_library_state_separately_activate)
        self.add_callback_to_shortcut_manager('new', partial(self.call_action_callback, "on_new_activate"))
        self.add_callback_to_shortcut_manager('quit', partial(self.call_action_callback, "on_quit_activate"))

        self.add_callback_to_shortcut_manager('is_start_state', partial(self.call_action_callback,
                                                                        "on_toggle_is_start_state_active"))
        callback_function = partial(self.call_action_callback, "on_add_transitions_from_closest_sibling_state_active")
        self.add_callback_to_shortcut_manager('transition_from_closest_sibling_state', callback_function)
        callback_function = partial(self.call_action_callback, "on_add_transitions_to_closest_sibling_state_active")
        self.add_callback_to_shortcut_manager('transition_to_closest_sibling_state', callback_function)
        callback_function = partial(self.call_action_callback, "on_add_transitions_to_parent_state_active")
        self.add_callback_to_shortcut_manager('transition_to_parent_state', callback_function)
        self.add_callback_to_shortcut_manager('group', partial(self.call_action_callback, "on_group_states_activate"))
        self.add_callback_to_shortcut_manager('ungroup', partial(self.call_action_callback,
                                                                 "on_ungroup_state_activate"))

        self.add_callback_to_shortcut_manager('start', partial(self.call_action_callback, "on_start_activate"))
        self.add_callback_to_shortcut_manager('start_from_selected', partial(self.call_action_callback,
                                                                             "on_start_from_selected_state_activate"))
        self.add_callback_to_shortcut_manager('run_to_selected', partial(self.call_action_callback,
                                                                         "on_run_to_selected_state_activate"))

        self.add_callback_to_shortcut_manager('stop', partial(self.call_action_callback, "on_stop_activate"))
        self.add_callback_to_shortcut_manager('pause', partial(self.call_action_callback, "on_pause_activate"))
        self.add_callback_to_shortcut_manager('step_mode', partial(self.call_action_callback, "on_step_mode_activate"))
        self.add_callback_to_shortcut_manager('step', partial(self.call_action_callback, "on_step_into_activate"))
        self.add_callback_to_shortcut_manager('backward_step', partial(self.call_action_callback,
                                                                       "on_backward_step_activate"))

        self.add_callback_to_shortcut_manager('reload', partial(self.call_action_callback, "on_refresh_all_activate"))

        self.add_callback_to_shortcut_manager('show_data_flows', self.show_data_flows_toggled_shortcut)
        self.add_callback_to_shortcut_manager('show_data_values', self.show_data_values_toggled_shortcut)
        self.add_callback_to_shortcut_manager('data_flow_mode', self.data_flow_mode_toggled_shortcut)
        self.add_callback_to_shortcut_manager('show_aborted_preempted', self.show_aborted_preempted)

        self.add_callback_to_shortcut_manager('fullscreen', self.on_toggle_full_screen_mode)
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;
  }
785137
def save(self, fp=None):
        
        self.storage.settings['markov'] = self.get_settings_json()
        self.storage.save(fp)
1183302
function saveDepths(depths, callback) {

  async.parallel([
      async.apply(store.getStore().setDepth.bind(store.getStore()), depths.parentUrl, depths.parentDepth ),
      async.apply(store.getStore().setDepth.bind(store.getStore()), depths.linkUri, depths.linkDepth )
  ],
  function(error){
      callback(error, depths);
  });
}
859451
def save(self, where=None, fetch_when_save=None):
        
        if where and not isinstance(where, leancloud.Query):
            raise TypeError('where param type should be leancloud.Query, got %s', type(where))

        if where and where._query_class._class_name != self._class_name:
            raise TypeError('where param\'s class name not equal to the current object\'s class name')

        if where and self.is_new():
            raise TypeError('where params works only when leancloud.Object is saved')

        unsaved_children = []
        unsaved_files = []
        self._find_unsaved_children(self._attributes, unsaved_children, unsaved_files)
        if unsaved_children or unsaved_files:
            self._deep_save(unsaved_children, unsaved_files, exclude=self._attributes)

        data = self._dump_save()
        fetch_when_save = 'true' if fetch_when_save else 'false'

        if self.is_new():
            response = client.post('/classes/{0}?fetchWhenSave={1}'.format(self._class_name, fetch_when_save), data)
        else:
            url = '/classes/{0}/{1}?fetchWhenSave={2}'.format(self._class_name, self.id, fetch_when_save)
            if where:
                url += '&where=' + json.dumps(where.dump()['where'], separators=(',', ':'))
            response = client.put(url, data)

        self._update_data(response.json())
1354356
def save(self):
        """"""

        with open(self.store_file_path, 'w') as fh:
            fh.write(json.dumps(self.store, indent=4))
317053
def on_save(self, event):
        ''''''
        dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*',
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            self.settings.save(dlg.GetPath())
917663
def save_or_update_saved_search(params)
      if params[:save_new_search].present? || params[:save_search].present?
        if params[:save_new_search].present?
          @saved_search = new_saved_search(params)
        elsif params[:save_search].present? && params[:saved_search].present?
          @saved_search = update_saved_search(params)
        elsif params[:save_search].present?
          @saved_search = new_saved_search(params)
        end

        if @saved_search.save
          flash[:notice] = t('ransack.saved_search.save.success')
        else
          flash[:error] = t('ransack.saved_search.save.error')
        end
      end
    end
799655
def _persist(self) -> None:
        
        if self._store:
            self._store.save(self._key, self._snapshot)
3003
def save(self, event):
        

        filepath = event.attr["filepath"]

        try:
            filetype = event.attr["filetype"]
        except KeyError:
            filetype = "pys"

        # If saving is already in progress abort
        if self.saving:
            return

        # Use tmpfile to make sure that old save file does not get lost
        # on abort save

        __, tmpfilepath = tempfile.mkstemp()

        if filetype == "xls":
            self._set_save_states()
            self._save_xls(tmpfilepath)
            self._move_tmp_file(tmpfilepath, filepath)
            self._release_save_states()

        elif filetype == "pys" or filetype == "all":
            self._set_save_states()
            if self._save_pys(tmpfilepath):
                # Writing was successful
                self._move_tmp_file(tmpfilepath, filepath)
                self._save_sign(filepath)
            self._release_save_states()

        elif filetype == "pysu":
            self._set_save_states()
            if self._save_pysu(tmpfilepath):
                # Writing was successful
                self._move_tmp_file(tmpfilepath, filepath)
                self._save_sign(filepath)
            self._release_save_states()

        else:
            os.remove(tmpfilepath)
            msg = "Filetype {filetype} unknown.".format(filetype=filetype)
            raise ValueError(msg)

        try:
            os.remove(tmpfilepath)
        except OSError:
            pass
1308057
function (pkg, options) {
    var settingsFile = new SettingsFile(pkg, options);

    var save = settingsFile.save;

    settingsFile.save = _.bind(function (config) {
      return save.call(settingsFile, config)
        .then(function () {
          client.emit('config.global-changed', {
            app: pkg,
            config: config
          });
        });
    }, settingsFile);

    var settingsSet = settingsFile.set;

    settingsFile.set = _.bind(function (config) {
      return settingsSet.call(settingsFile, config)
        .then(function () {
          client.emit('config.global-changed', {
            app: pkg,
            config: config
          });
        });
    }, settingsFile);

    /**
     * Register for global settings changes
     *
     * @param {function} cb Event callback
     */
    settingsFile.onChange = function (cb) {
      client.on('settings.global-changed:' + pkg, cb);
    };

    var instance = settingsFile.instance;

    settingsFile.instance = _.bind(function (id) {
      var returnedInstance = instance.call(settingsFile, id);

      var save = returnedInstance.save;

      returnedInstance.save = _.bind(function (config) {
        return save.call(returnedInstance, config)
          .then(function () {
            client.emit('settings.instance-changed:' + returnedInstance._id, {
              instance: returnedInstance._id,
              config: config
            });
          });
      }, returnedInstance);

      var instanceSet = returnedInstance.set;

      returnedInstance.set = _.bind(function (config) {
        return instanceSet.call(returnedInstance, config)
          .then(function () {
            client.emit('settings.instance-changed:' + returnedInstance._id, {
              instance: returnedInstance._id,
              config: config
            });
          });
      }, returnedInstance);

      /**
       * Register for instance settings changes
       *
       * @param {function} cb Event callback
       */
      returnedInstance.onChange = function (cb) {
        client.on('settings.instance-changed:' + returnedInstance._id, cb);
      };

      return returnedInstance;
    }, settingsFile);

    return settingsFile;
  }