Save experiment data, which should be a JSON object and will be stored
    after converting to string.
765826
def update(uid=None):
    
    app.logger.info("PUT /sync route with id: %s" % uid)

    try:
        user = Participant.query.\
            filter(Participant.uniqueid == uid).\
            one()
    except exc.SQLAlchemyError:
        app.logger.error("DB error: Unique user not found.")

    if hasattr(request, 'json'):
        user.datastring = request.data.decode('utf-8').encode(
            'ascii', 'xmlcharrefreplace'
        )
        db_session.add(user)
        db_session.commit()

    try:
        data = json.loads(user.datastring)
    except:
        data = {}

    trial = data.get("currenttrial", None)
    app.logger.info("saved data for %s (current trial: %s)", uid, trial)
    resp = {"status": "user data saved"}
    return jsonify(**resp)
1347279
function data( opts ) {
	var out = {};
	out.github_token = opts.token;
	return JSON.stringify( out );
}
706099
def save_experiment(self, name, variants):
        
        try:
            model.Experiment(
                name=name,
                started_on=datetime.utcnow(),
                variants=[
                    model.Variant(name=v, order=i)
                    for i, v in enumerate(variants)
                ]
            )
            self.Session.commit()
        finally:
            self.Session.close()
844651
def save(self):
        """"""

        import json

        payload = {}
        payload.update(self._store)
        payload["user"] = payload["username"]
        payload["passwd"] = payload["password"]
        del(payload["username"])
        del(payload["password"])

        payload = json.dumps(payload, default=str)
        if not self.URL :
            if "username" not in self._store or "password" not in self._store :
                raise KeyError("You must define self['name'] and self['password'] to be able to create a new user")

            r = self.connection.session.post(self.users.URL, data = payload)
            data = r.json()
            if r.status_code == 201 :
                self._set(data)
            else :
                raise CreationError("Unable to create new user", data)
        else :
            r = self.connection.session.put(self.URL, data = payload)
            data = r.json()
            if r.status_code == 200 :
                self._set(data)
            else :
                raise UpdateError("Unable to update user, status: %s" %r.status_code, data)
764797
def _data_to_json(data):
        
        if type(data) not in [str, unicode]:
            data = json.dumps(data)
        return data
1129974
def save(self, filename):
        ''' 
        '''
        with open(filename, 'w') as outfile:
            json.dump(self.to_json(), outfile)
277248
def store_json(self, filename, dict_to_store):
        """"""
        filename = os.path.join(
            self.data_dir,
            filename + '.data'
        )
        fileops.dump_dict_to_file(
            dict_to_store,
            filename
        )
583216
def save_json(obj, outfile, allow_nan=True, compression=False):
    """"""
    if compression:
        with open(outfile, 'wb') as f:
            dump(obj, f, allow_nan=allow_nan, compression=compression)
    else:
        with open(outfile, 'w') as f:
            dump(obj, f, allow_nan=allow_nan, compression=compression)
    log.info('Saved {} (id: {}) to {}'.format(type(obj), obj.id, outfile))
1325388
def to_json(data, compress=False):
    
    return json.compress(data) if compress else json.dumps(data)
444362
def _record_from_json(value, field):
    """"""
    if _not_null(value, field):
        record = {}
        record_iter = zip(field.fields, value["f"])
        for subfield, cell in record_iter:
            converter = _CELLDATA_FROM_JSON[subfield.field_type]
            if subfield.mode == "REPEATED":
                value = [converter(item["v"], subfield) for item in cell["v"]]
            else:
                value = converter(cell["v"], subfield)
            record[subfield.name] = value
        return record
348957
def to_output(self, value):
        """"""
        return json.loads(resolwe_runtime_utils.save(self.name, str(value)))
236213
def save_json(object, handle, indent=2):
    """"""
    obj_json = json.dumps(object, indent=indent, cls=NumpyJSONEncoder)
    handle.write(obj_json)
932424
def save(self):
        """"""
        data = str.encode( json.dumps(self.simpleAttrs, indent=4, sort_keys=True) )
        with open(self.filename, "wb") as f:
            f.write(data)
595999
def put_json(self, url, data, cls=None, **kwargs):
        
        kwargs['data'] = to_json(data, cls=cls)
        kwargs['headers'] = self.default_headers
        return self.put(url, **kwargs).json()
547612
def save(self, obj):
        """"""
        if not obj.id:
            obj.id = uuid()

        stored_data = {
            'id': obj.id,
            'value': obj.to_data()
        }

        index_vals = obj.indexes() or {}
        for key in obj.__class__.index_names() or []:
            val = index_vals.get(key, '')
            stored_data[key] = DynamoMappings.map_index_val(val)

        table = self.get_class_table(obj.__class__)
        item = Item(table, data=stored_data)

        item.save(overwrite=True)
872827
def save(self, fname):
        
        with open(fname, 'wb') as f:
            json.dump(self, f)
1040775
def save(self, with_data=False):
        
        r = self._client.request('PUT', self.url, json=self._serialize(with_data=with_data))
        return self._deserialize(r.json(), self._manager)