Save and return the object (for chaining).
179890
def save(self, **kwargs):
        """"""
        if self.search_terms is None:
            self.search_terms = ""
        super().save(**kwargs)
        return self
1133788
def saveit(func):
    """"""

    name = '_' + func.__name__

    def _wrapper(self, *args, **kwds):
        if not hasattr(self, name):
            setattr(self, name, func(self, *args, **kwds))
        return getattr(self, name)
    return _wrapper
200690
def save(self, idempotency_key=None):
        """"""
        updated_params = self.serialize(None)
        headers = populate_headers(idempotency_key)

        if not updated_params:
            util.logger.debug("Trying to save already saved object %r", self)
            return defer.succeed(self)

        d = self.request('post', self.instance_url(), updated_params, headers)
        return d.addCallback(self.refresh_from).addCallback(lambda _: self)
1237891
def save(self):
        
        pk_field = self._fields[self._primary_key]
        if not self._data.get(self._primary_key):
            setattr(self, self._primary_key, pk_field._generate_key())
            require_delete = False
        else:
            require_delete = True

        if require_delete:
            self.delete(for_update=True)

        data = self._get_data_dict()
        hash_obj = self.to_hash()
        hash_obj.clear()
        hash_obj.update(data)

        all_index = self._query.all_index()
        all_index.add(self.get_hash_id())

        for field in self._indexes:
            for index in field.get_indexes():
                index.save(self)
1083853
def save(self, commit=True):
        

        db.session.add(self)
        if commit:
            db.session.commit()
        return self
653783
def save(self):
        """"""
        check_bind(self)

        creating = self.id is None
        if creating and not self.__class__._has_schema_method("create"):
            raise MethodNotSupported("{} do not support creating.".format(self.__class__.__name__))
        if not creating and not self.__class__._has_schema_method("update"):
            raise MethodNotSupported("{} do not support updating.".format(self.__class__.__name__))

        try:
            self._resource.save()
        except HTTPError as e:
            if e.response.status_code == 400:
                err_json = e.response.json().get("errors", [])
                msg = pretty_print_error(err_json)
                raise ServerError(msg)
            elif e.response.status_code == 404:
                action = "creating" if creating else "updating"
                raise MethodNotSupported(
                    "{} do not support {}.".format(self.__class__.__name__, action)
                )
            elif e.response.status_code == 409:
                raise ServerError("This {} object already exists".format(self.__class__.__name__))
            else:
                raise e
61635
def restore(self, nosave=False):
        
        if self.exists:
            obj = self.content_type.model_class().objects.get(uid=self.uid)
        else:
            obj = self.content_type.model_class()(uid=self.uid)
        for field in self.fields + self.foreignkeys:
            obj.__setattr__(field, self.get(field))
        if not nosave: obj.save()
        return obj
447150
def save_model(self, request, obj, form, change):
        
        instance = form.save(commit=False)
        if not(instance.created):
            instance.author = request.user
        instance.save()
        form.save_m2m()

        return instance
905530
def save(self):
        
        resp = self._client.put(type(self).api_endpoint, model=self,
            data=self._serialize())

        if 'error' in resp:
            return False
        return True
1043748
def copy(self):
        """"""
        return self.__class__(key=self._key, load=self._load, _set=set(self._set))
1157881
def save_object(object, objectID = nil, request_options = {})
      client.put(Protocol.object_uri(name, get_objectID(object, objectID)), object.to_json, :write, request_options)
    end
810470
def save_object(filename, obj):
    """"""
    logging.info('saving {}...'.format(filename))
    try:
        with gzip.GzipFile(filename, 'wb') as f:
            f.write(pickle.dumps(obj, 1))
    except Exception as e:
        logging.error('save failure: {}'.format(e))
        raise
688863
def saveToObject(self):
        """"""
        for i in range(self.ui.caleditorStack.count()):
            try:
                self.ui.caleditorStack.widget(i).saveToObject()
            except AttributeError:
                logger = logging.getLogger('main')
                logger.debug('index {} does not have method saveToObject'.format(i))
26353
def saveCopy(self) :
        ""
        old_key = self._key
        self.reset(self.collection)
        self.save()
        return (old_key, self._key)
900353
def save_object_to_db(self,
                          obj: Any,
                          table: str,
                          fieldlist: Sequence[str],
                          is_new_record: bool) -> None:
        """"""
        if is_new_record:
            pkvalue = getattr(obj, fieldlist[0])
            if pkvalue is None:
                self.insert_object_into_db_pk_unknown(obj, table, fieldlist)
            else:
                self.insert_object_into_db_pk_known(obj, table, fieldlist)
        else:
            self.update_object_in_db(obj, table, fieldlist)
862868
def save(self, entity):
        """"""
        assert isinstance(entity, Entity), " entity must have an instance of Entity"
        return self.__collection.save(entity.as_dict())
755849
def save(self):
        
        data = super().save()
        data['state_sizes'] = self.state_sizes
        data['reset_on_sentence_end'] = self.reset_on_sentence_end
        return data