Export datasources to YAML
164662
def export_datasources(print_stdout, datasource_file,
                       back_references, include_defaults):
    """"""
    data = dict_import_export.export_to_dict(
        session=db.session,
        recursive=True,
        back_references=back_references,
        include_defaults=include_defaults)
    if print_stdout or not datasource_file:
        yaml.safe_dump(data, stdout, default_flow_style=False)
    if datasource_file:
        logging.info('Exporting datasources to %s', datasource_file)
        with open(datasource_file, 'w') as data_stream:
            yaml.safe_dump(data, data_stream, default_flow_style=False)
143044
def safe_dump(data, stream=None, **kwds):
    """"""
    return yaml.dump(data, stream=stream, Dumper=ODYD, **kwds)
733125
def safe_dump(data, stream=None, **kwargs):
    '''
    
    '''
    if 'allow_unicode' not in kwargs:
        kwargs['allow_unicode'] = True
    return yaml.dump(data, stream, Dumper=SafeOrderedDumper, **kwargs)
36366
function construct(data) {
  const basepath = process.cwd();

  const files = data.map((f) => {
    const fullpath = p.join(basepath, f);

    const src = fs.readFileSync(fullpath, 'utf8');
    const t = yaml.load(src, {
      schema: YAML_FILES_SCHEMA,
      filename: fullpath
    });
    return t;
  });

  const t = files.reduce((m, f) => merge(m, f));
  return t;
}
790734
def dump_all(data_list, stream=None, **kwargs):
    
    return yaml.dump_all(
        data_list,
        stream=stream,
        Dumper=YAMLDictDumper,
        **kwargs
    )
1118
def to_yaml(value) -> str:
    """"""
    stream = yaml.io.StringIO()
    dumper = ConfigDumper(stream, default_flow_style=True, width=sys.maxsize)
    val = None
    try:
        dumper.open()
        dumper.represent(value)
        val = stream.getvalue().strip()
        dumper.close()
    finally:
        dumper.dispose()

    return val
936859
def _load_from_yaml(self, filename: str, model_identifiers: Dict[str, List[str]]):
        
        class_name = filename[:filename.rfind('.')]
        rendered_yaml = self.env.get_template(filename).render(
            model_identifiers=model_identifiers)
        fixture_data, self.relationships[class_name] = self._post_process_yaml_data(
            yaml.load(rendered_yaml),
            self.factory.get_relationships(class_name))

        for identifier_key, data in fixture_data.items():
            self.model_fixtures[class_name][identifier_key] = data
881111
def parse_yaml(self, y):
        '''

        '''
        self.id = y['id']
        self._config_data = []
        if 'configurationData' in y:
            for d in y.get('configurationData'):
                self._config_data.append(ConfigurationData().parse_yaml(d))
        return self
1228024
def save(yaml_dict, filepath):
    '''
    
    '''
    yamldict.dump(yaml_dict, open(filepath, 'w'), default_flow_style=False)
740878
def to_yamlf(self, fpath: str, encoding: str='utf8', ignore_none: bool=True, ignore_empty: bool=False) -> str:
        
        return util.save_yamlf(traverse(self, ignore_none, force_value=True, ignore_empty=ignore_empty), fpath, encoding)
1191378
def generate_yaml_file(filename, contents):
    """"""
    with open(filename, 'w') as file:
        file.write(yaml.dump(contents, default_flow_style=False))
948953
def parse_as_yaml(strdict):
    """"""
    interm = ""
    for key, val in strdict.items():
        interm = "%s: %s, %s" % (key, val, interm)
    fin = '{%s}' % interm

    return yaml.load(fin)
207409
function yamlTransform (filename) {
  if (!/\.yml|\.yaml$/i.test(filename)) {
    return through()
  }

  return through(function (buf, enc, next) {
    this.push(
      'module.exports=' + JSON.stringify(YAML.parse(buf.toString('utf8')))
    )
    next()
  })
}
769987
function writeGeneratedFileList(htmlFiles) {
  const fileList = htmlFiles.map(filename => {
    return {
      title: filename,
      path: `${devsitePath}${filename}`
    };
  });
  const generatedTocYAML = yaml.safeDump({ toc: fileList });
  return fs
    .writeFile(`${docPath}/_toc_autogenerated.yaml`, generatedTocYAML)
    .then(() => htmlFiles);
}
642041
function (yamlJson) {
		if (typeof yamlJson !== 'object') {
			throw new Error("Yaml file was converted to a string");
		}
		
		if (!yamlJson.paths || Object.keys(yamlJson.paths).length === 0) {
			throw new Error("Yaml file is missing api schema");
		}
		
		//loop in path
		for (var onePath in yamlJson.paths) {
			//loop in methods
			for (var oneMethod in yamlJson.paths[onePath]) {
				if (!yamlJson.paths[onePath][oneMethod].summary || yamlJson.paths[onePath][oneMethod].summary === "") {
					throw new Error("Please enter a summary for API " + oneMethod + ": " + onePath + " you want to build.");
				}
			}
		}
	}
1053161
def export_from_db(output_key, calc_id, datadir, target):
    
    makedirs(target)
    export.from_db = True
    ds_key, fmt = output_key
    with datastore.read(calc_id, datadir=datadir) as dstore:
        dstore.export_dir = target
        try:
            exported = export(output_key, dstore)
        except Exception:
            etype, err, tb = sys.exc_info()
            tb_str = ''.join(traceback.format_tb(tb))
            version = check_version(dstore)
            raise DataStoreExportError(
                'Could not export %s in %s%s\n%s%s' %
                (output_key + (version, tb_str, err)))
        return exported
1071342
def serialize(self):
        
        import yaml
        output = {"metadata": self.metadata, "sources": {},
                  "name": self.name}
        for key, entry in self.items():
            output["sources"][key] = entry._captured_init_kwargs
        return yaml.dump(output)