Save a dashboard's metadata
971427
def save_dash(self, dashboard_id):
        """"""
        session = db.session()
        dash = (session
                .query(models.Dashboard)
                .filter_by(id=dashboard_id).first())
        check_ownership(dash, raise_if_false=True)
        data = json.loads(request.form.get('data'))
        self._set_dash_metadata(dash, data)
        session.merge(dash)
        session.commit()
        session.close()
        return json_success(json.dumps({'status': 'SUCCESS'}))
1373409
def save_metadata(self, file_path):
    
    data = self.metadata
    with open(file_path, 'w')  as out_file:
      json.dump(data, out_file)
684280
def save_data(self):
        """"""
        filename = os.path.join(
            self._get_prefix(),
            self.model.site
        )
        self.store.store_json(
            filename,
            self.model.get_dict()
        )
131604
def write_metadata(self, fp):
        
        super(BaseDataModel, self).write_metadata(fp)
        fp.write_stilde(self.data)
541500
def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret):
    ''''''
    base_dashboards = []
    for base_dashboard_from_pillar in base_dashboards_from_pillar:
        base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar)
        if base_dashboard:
            base_dashboards.append(base_dashboard)
        elif base_dashboard_from_pillar != _DEFAULT_DASHBOARD_PILLAR:
            ret.setdefault('warnings', [])
            warning_message = 'Cannot find dashboard pillar "{0}".'.format(
                base_dashboard_from_pillar)
            if warning_message not in ret['warnings']:
                ret['warnings'].append(warning_message)
    base_dashboards.append(dashboard)

    result_dashboard = {}
    tags = set()
    for dashboard in base_dashboards:
        tags.update(dashboard.get('tags', []))
        result_dashboard.update(dashboard)
    result_dashboard['tags'] = list(tags)
    return result_dashboard
881500
def save_metadata(self, data_dir, feature_name=None):
    """"""
    # Save names if defined
    if self._str2int is not None:
      names_filepath = _get_names_filepath(data_dir, feature_name)
      _write_names_to_file(names_filepath, self.names)
824751
def save(cls, crawler, stage, level, run_id, error=None, message=None):
        """"""
        event = {
            'stage': stage.name,
            'level': level,
            'timestamp': pack_now(),
            'error': error,
            'message': message
        }
        data = dump_json(event)
        conn.lpush(make_key(crawler, "events"), data)
        conn.lpush(make_key(crawler, "events", level), data)
        conn.lpush(make_key(crawler, "events", stage), data)
        conn.lpush(make_key(crawler, "events", stage, level), data)
        conn.lpush(make_key(crawler, "events", run_id), data)
        conn.lpush(make_key(crawler, "events", run_id, level), data)
        return event
706390
def get_dashboard_full(self, db_name):
        """"""
        objects = {}
        dashboards = self.get_objects("type", "dashboard")
        vizs = self.get_objects("type", "visualization")
        searches = self.get_objects("type", "search")
        if db_name not in dashboards:
            return None
        self.pr_inf("Found dashboard: " + db_name)
        objects[db_name] = dashboards[db_name]
        panels = json.loads(dashboards[db_name]['_source']['panelsJSON'])
        for panel in panels:
            if 'id' not in panel:
                continue
            pid = panel['id']
            if pid in searches:
                self.pr_inf("Found search:    " + pid)
                objects[pid] = searches[pid]
            elif pid in vizs:
                self.pr_inf("Found vis:       " + pid)
                objects[pid] = vizs[pid]
                emb = vizs[pid].get('_source', {}).get('savedSearchId', None)
                if emb is not None and emb not in objects:
                    if emb not in searches:
                        self.pr_err('Missing search %s' % emb)
                        return objects
                    objects[emb] = searches[emb]
        return objects
1125055
def save_local_metadata(self):
        
        # save to the set local path and add .json
        with open(self.filepath + '.json', 'w+') as outfile:
            json.dump(self._prep_metadata(), outfile, indent=4)
1241297
private void fillMetaData() {
        metaDataBuffer.putInt(MONITOR_VERSION_OFFSET, MONITOR_VERSION);
        metaDataBuffer.putInt(GW_DATA_REFERENCE_OFFSET, GW_DATA_OFFSET);
        metaDataBuffer.putInt(SERVICE_DATA_REFERENCE_OFFSET, serviceDataOffset);
        metaDataBuffer.putStringUtf8(GW_ID_OFFSET, gatewayId, ByteOrder.nativeOrder());
        metaDataBuffer.putInt(gwCountersLblBuffersReferenceOffset, 0);
        metaDataBuffer.putInt(gwCountersLblBuffersLengthOffset, GATEWAY_COUNTER_LABELS_BUFFER_LENGTH);
        metaDataBuffer.putInt(gwCountersValueBuffersReferenceOffset, 0);
        metaDataBuffer.putInt(gwCountersValueBuffersLengthOffset, GATEWAY_COUNTER_VALUES_BUFFER_LENGTH);
        metaDataBuffer.putInt(noOfServicesOffset, 0);
    }
418547
def _load_metadata(self):
        """"""
        if self._schema is None:
            self._schema = self._get_schema()
            self.datashape = self._schema.datashape
            self.dtype = self._schema.dtype
            self.shape = self._schema.shape
            self.npartitions = self._schema.npartitions
            self.metadata.update(self._schema.extra_metadata)
523285
function storeMetaData(metaData, file) {
	var json
		, stream;

	try {
		json = JSON.stringify(metaData);
		stream = fs.createWriteStream(file);

		stream.write(json);
		stream.end();
	} catch(e) {
		console.error('Could not save meta data for ' + file);
	}
}
847180
def save(self, ts):
        
        with open(self, 'w') as f:
            Timestamp.wrap(ts).dump(f)
1005588
def import_dashboards(path, recursive):
    """"""
    p = Path(path)
    files = []
    if p.is_file():
        files.append(p)
    elif p.exists() and not recursive:
        files.extend(p.glob('*.json'))
    elif p.exists() and recursive:
        files.extend(p.rglob('*.json'))
    for f in files:
        logging.info('Importing dashboard from file %s', f)
        try:
            with f.open() as data_stream:
                dashboard_import_export.import_dashboards(
                    db.session, data_stream)
        except Exception as e:
            logging.error('Error when importing dashboard from file %s', f)
            logging.error(e)
1333337
def export_metadata(self, path):
        
        writer = pd.ExcelWriter(path)
        write_sheet(writer, 'meta', self.meta, index=True)
        writer.save()
104121
protected function saveMetas()
    {
        $metas = '<?php return '.var_export($this->metas->getAll(), true).';';
        file_put_contents($this->getMetaFile(), $metas);
    }
1084813
def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None):
        """"""
        assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None

        data = {}

        if self.copymetadata:
            #Copy parent metadata
            for key, value in parentfile.metadata.items():
                data[key] = value

        for metafield in self.metafields:
            if isinstance(metafield, ParameterCondition):
                metafield = metafield.evaluate(parameters)
                if not metafield:
                    continue
            assert isinstance(metafield, AbstractMetaField)
            metafield.resolve(data, parameters, parentfile, relevantinputfiles)

        if provenancedata:
            data['provenance'] = provenancedata

        return self.formatclass(None, **data)