Save any outstanding items. This returns a Deferred which will
        errback if Tor was unhappy with anything, or callback with
        this TorConfig object on success.
976045
def save(self):
        

        if not self.needs_save():
            return defer.succeed(self)

        args = []
        directories = []
        for (key, value) in self.unsaved.items():
            if key == 'HiddenServices':
                self.config['HiddenServices'] = value
                # using a list here because at least one unit-test
                # cares about order -- and conceivably order *could*
                # matter here, to Tor...
                services = list()
                # authenticated services get flattened into the HiddenServices list...
                for hs in value:
                    if IOnionClient.providedBy(hs):
                        parent = IOnionClient(hs).parent
                        if parent not in services:
                            services.append(parent)
                    elif isinstance(hs, (EphemeralOnionService, EphemeralHiddenService)):
                        raise ValueError(
                            "Only filesystem based Onion services may be added"
                            " via TorConfig.hiddenservices; ephemeral services"
                            " must be created with 'create_onion_service'."
                        )
                    else:
                        if hs not in services:
                            services.append(hs)

                for hs in services:
                    for (k, v) in hs.config_attributes():
                        if k == 'HiddenServiceDir':
                            if v not in directories:
                                directories.append(v)
                                args.append(k)
                                args.append(v)
                            else:
                                raise RuntimeError("Trying to add hidden service with same HiddenServiceDir: %s" % v)
                        else:
                            args.append(k)
                            args.append(v)
                continue

            if isinstance(value, list):
                for x in value:
                    # FIXME XXX
                    if x is not DEFAULT_VALUE:
                        args.append(key)
                        args.append(str(x))

            else:
                args.append(key)
                args.append(value)

            # FIXME in future we should wait for CONF_CHANGED and
            # update then, right?
            real_name = self._find_real_name(key)
            if not isinstance(value, list) and real_name in self.parsers:
                value = self.parsers[real_name].parse(value)
            self.config[real_name] = value

        # FIXME might want to re-think this, but currently there's no
        # way to put things into a config and get them out again
        # nicely...unless you just don't assign a protocol
        if self.protocol:
            d = self.protocol.set_conf(*args)
            d.addCallback(self._save_completed)
            return d

        else:
            self._save_completed()
            return defer.succeed(self)
197864
def save(self):
        
        result = yield gen.Task(RedisSession._redis_client.set,
                                self._key, self.dumps())
        LOGGER.debug('Saved session %s (%r)', self.id, result)
        raise gen.Return(result)
783782
def save(self):
        
        with open(self.filename, 'w') as f:
            ujson.dump(self.config, f, indent=4)
1262822
def save(self, fp=None):
        
        self.settings['storage'] = {
            'state_separator': self.state_separator
        }
        self.do_save(fp)
925589
public void saveLater() {
        if (executor.isShutdown() || savePending.getAndSet(true))
            return;   // Already pending.
        executor.schedule(saver, delay, delayTimeUnit);
    }
99872
def save(self, running=None):
        
        LOGGER.debug("InjectorCachedGear.save")
        ret = True

        if running is not None:
            self.running = running

        if self.service is None:
            self.service = InjectorCachedGearService.make_admin_on_demand_service(self)

        if self.service is not None and not self.service.is_started:
            self.service.start()

        args = {'properties': {'OPERATION': 'PUSH_GEAR_IN_CACHE',
                               'REMOTE_GEAR': str(self.injector_gear_2_json()).replace("'", '"'),
                               'CACHE_ID': InjectorCachedGearService.cache_id}}

        result = InjectorCachedGearService.requester.call(args).get()
        if result.rc != 0:
            err_msg = 'InjectorCachedGear.save - Problem while saving gear ( id : ' + self.id + \
                      'Reason: ' + str(result.response_content) + '-' + str(result.error_message) + \
                      " (" + str(result.rc) + ")"
            LOGGER.warning(err_msg)
            ret = False

        return ret
813087
def put(self, item, block=True, timeout=None, dup_callback=None):
        
        if not self.is_duplicated(item):
            super(CachedQueue, self).put(item, block, timeout)
        else:
            if dup_callback:
                dup_callback(item)
1312297
def save(self, *args, **kwargs):
        
        if not self.id:  # this is a totally new instance, create uuid value
            self.url_uuid = str(uuid.uuid4()).replace("-", "")
        super(ObfuscatedUrlInfo, self).save(*args, **kwargs)
1199864
def save(options={:validate => true})
      context = self.new_record? ? :create : :update
      return false if options[:validate] && !valid?(context)
      
      run_callbacks(context) do
        if context == :create
          key = self.class.persistence.insert(self)
        else
          key = self.class.persistence.update(self)
        end
        self.persist!
        key
      end
    end
323412
function () {
            var result = new $.Deferred();
            this.storage.load()
                .then(function (data) {
                    var oldKeys = this.getKeys();
                    this.data = data;
                    result.resolve();
                    this.trigger(PREFERENCE_CHANGE, {
                        ids: _.union(this.getKeys(), oldKeys)
                    });
                }.bind(this))
                .fail(function (error) {
                    result.reject(error);
                });
            return result.promise();
        }
909785
def save(self, async=False, callback=None, encrypted=True):
        

        if self._new_password and encrypted:
            self.password = Sha1.encrypt(self._new_password)

        controller = NURESTSession.get_current_session().login_controller
        controller.password = self._new_password
        controller.api_key = None

        data = json.dumps(self.to_dict())
        request = NURESTRequest(method=HTTP_METHOD_PUT, url=self.get_resource_url(), data=data)

        if async:
            return self.send_request(request=request, async=async, local_callback=self._did_save, remote_callback=callback)
        else:
            connection = self.send_request(request=request)
            return self._did_save(connection)
18828
def save(self):
        
        storage = get_media_storage()
        for storage_name in self.cleaned_data['selected_files']:
            full_path = storage.path(storage_name)
            try:
                storage.delete(storage_name)
                self.success_files.append(full_path)
            except OSError:
                self.error_files.append(full_path)
16300
def save_self(execute_hooks = true)
      # short-circuit if the resource is not dirty
      return saved? unless dirty_self?

      if execute_hooks
        new? ? create_with_hooks : update_with_hooks
      else
        _persist
      end
      clean?
    end
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
853682
def save(self, safe=None):
        
        self._session.insert(self, safe=safe)
        self._session.flush()
705502
public function commit()
    {
        foreach ($this->deferredItem as $item) {
            $this->save($item);
        }
        
        $this->deferredItem = [];
    }
995304
def store(self, deferred_result):
        
        self._counter += 1
        self._stored[self._counter] = deferred_result
        return self._counter