Read from yml file
@api    private
@param  {String}   file
@param  {Function} fn
970615
function readYml(file, fn) {
  fs.readFile(path.resolve(process.cwd(), file), function(err, data) {

    if (err) {
      fn(err);
    }
    const resource = yaml.load(data.toString());
    let api = {};

    api.resourcePath = resource.resourcePath;
    api.description = resource.description;
    descriptor.apis.push(api);
    resources[resource.resourcePath] = resource;

    fn();
  });
}
421817
function readFileSync (args) {
    var file = args.file;
    var next = args.next;

    if (isUnsupportedPath(file.url)) {
      // It's not a filesystem path, so let some other plugin handle it
      return next();
    }

    var filepath = getFileSystemPath(file.url);

    inferFileMetadata(file);
    return fs.readFileSync(filepath);
  }
1119457
def yml_load(stream, container, **options):
    
    ret = yml_fnc("load", stream, **options)
    if ret is None:
        return container()

    return ret
1165244
function readXmlAsJson(file) {
    let xmlData;
    let xmlParser;
    let parsedData;

    try {
      xmlData = fs.readFileSync(file);
      xmlParser = new xml2js.Parser();
      xmlParser.parseString(xmlData, (err, data) => {
        if (!err && data) {
          parsedData = data;
        }
      });
    } catch (err) {
      throw new Error(`BRANCH SDK: Cannot write file ${file}`);
    }

    return parsedData;
  }
40288
function(file, type) {
    var promise = new Parse.Promise();

    if (typeof(FileReader) === "undefined") {
      return Parse.Promise.error(new Parse.Error(
          Parse.Error.FILE_READ_ERROR,
          "Attempted to use a FileReader on an unsupported browser."));
    }

    var reader = new FileReader();
    reader.onloadend = function() {
      if (reader.readyState !== 2) {
        promise.reject(new Parse.Error(
            Parse.Error.FILE_READ_ERROR,
            "Error reading file."));
        return;
      }

      var dataURL = reader.result;
      var matches = /^data:([^;]*);base64,(.*)$/.exec(dataURL);
      if (!matches) {
        promise.reject(new Parse.Error(
            Parse.ERROR.FILE_READ_ERROR,
            "Unable to interpret data URL: " + dataURL));
        return;
      }

      promise.resolve(matches[2], type || matches[1]);
    };
    reader.readAsDataURL(file);
    return promise;
  }
896589
def yaml_from_file(self, fpath):
        

        lookup = self._load_param_file(fpath)
        if not lookup:
            return

        content = "\n".join(self.content)
        parsed = yaml.safe_load(content)
        # self.app.info("Params loaded is %s" % parsed)
        # self.app.info("Lookup table looks like %s" % lookup)
        new_content = list()
        for paramlist in parsed:
            if not isinstance(paramlist, dict):
                self.app.warn(
                    ("Invalid parameter definition ``%s``. Expected "
                     "format: ``name: reference``. "
                     " Skipping." % paramlist),
                    (self.state_machine.node.source,
                     self.state_machine.node.line))
                continue
            for name, ref in paramlist.items():
                if ref in lookup:
                    new_content.append((name, lookup[ref]))
                else:
                    self.app.warn(
                        ("No field definition for ``%s`` found in ``%s``. "
                         " Skipping." % (ref, fpath)),
                        (self.state_machine.node.source,
                         self.state_machine.node.line))

        # self.app.info("New content %s" % new_content)
        self.yaml = new_content
712085
function readFile(filename, enc) {
    return new Promise(function (fulfill, reject) {
        fs.readFile(filename, enc || 'utf8', function (err, res) {
            return err ? reject(err) : fulfill(res);
        });
    });
}
698934
public void file(java.io.InputStream fp, IoFileRead read) {
        resetCursor();
        io_type = IOType.File;
        if(read == null) {
            read = new IoFileRead.Default();
        }

        io = new JechtIO.File(fp, read);
    }
354623
function(file, options) {
	var data = fs.readFileSync(file, 'utf-8');

	// Remove UTF-8 BOM codes:
	data = data.trim();

	if (options.javascript) {
		return util.js.parse(data);
	}
	else {
		return JSON.parse(data);
	}
	return JSON.parse(data);
}
487485
async function readJSONFile(filename){
    // load file
    let raw = await _fs.readFile(filename, 'utf8');

    // strip single line js comments
    raw = raw.replace(/^\s*\/\/.*$/gm, '');

    // parse text
    return JSON.parse(raw);
}
274272
def read(self, file, *, fs):
        
        for line in file:
            yield line.rstrip(self.eol)
1292530
def _load_yml_config(self, config_file):
        
        if not isinstance(config_file, six.string_types):
            raise TypeError('config_file must be a str.')

        try:
            def construct_yaml_int(self, node):
                obj  = SafeConstructor.construct_yaml_int(self, node)
                data = ConfigInt(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_float(self, node):
                obj, = SafeConstructor.construct_yaml_float(self, node)
                data = ConfigFloat(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_str(self, node):
                # Override the default string handling function
                # to always return unicode objects
                obj = SafeConstructor.construct_scalar(self, node)

                assert isinstance(obj, six.string_types)
                data = ConfigUnicode(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_mapping(self, node):
                obj, = SafeConstructor.construct_yaml_map(self, node)
                data = ConfigDict(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_seq(self, node):
                obj, = SafeConstructor.construct_yaml_seq(self, node)
                data = ConfigSeq(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            # SafeConstructor.add_constructor(u'tag:yaml.org,2002:bool',  construct_yaml_bool)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:float', construct_yaml_float)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:int', construct_yaml_int)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:map', construct_yaml_mapping)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:seq', construct_yaml_seq)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:str', construct_yaml_str)

            data = SafeLoader(config_file).get_data()
            if data is None:
                raise AttributeError('The configuration file needs to have data in it.')

            self._data = normalize_keys(data, snake_case=False)
        except YAMLError as e:
            if hasattr(e, 'problem_mark'):
                mark = e.problem_mark
                raise SyntaxError(
                    "There is a syntax error in your freight-forwarder config file line: {0} column: {1}".format(
                        mark.line + 1,
                        mark.column + 1
                    )
                )
            else:
                raise SyntaxError("There is a syntax error in your freight-forwarder config.")
947996
function loadFromFile(filename) {
  var cfg = {}
  Object.assign(
    cfg,
    loadDefault(),
    JSON.parse(fs.readFileSync(filename))
  )

  return cfg
}
1226266
def load_conf(yml_file, conf={}):
    
    with open(yml_file) as f:
        data = yaml.load(f)
        if conf:
            data.update(conf)
        return dictdot(data)
142993
function readFile(fileName) {
  try {
    return read(fileName);
  } catch (e) {
    print(fileName + ': ' + (e.message || e));
    throw e;
  }
}
835954
function parseFile(fs, file, type) {
    var filepath = file.getPath();
    var parser = file.getParser();

    if (!parser) {
        return Promise.reject(
            error.FileNotParsableError({
                filename: filepath
            })
        );
    }

    return fs.readAsString(filepath)
    .then(function(content) {
        if (type === 'readme') {
            return parser.parseReadme(content);
        } else if (type === 'glossary') {
            return parser.parseGlossary(content);
        } else if (type === 'summary') {
            return parser.parseSummary(content);
        } else if (type === 'langs') {
            return parser.parseLanguages(content);
        } else {
            throw new Error('Parsing invalid type "' + type + '"');
        }
    })
    .then(function(result) {
        return [
            file,
            result
        ];
    });
}
85601
function performChange(content) {
  const exampleFile = ExampleFile.fromPath(this.file.path);
  const match = content.match(/<!---([\s\S]*)?--->/);
  if (!match) {
    return content;
  }
  gutil.log('changing', exampleFile.title);
  const frontmatter = JSON.parse(match[1]);
  const yaml = require('js-yaml');
  const yamlFrontmatter = `<!---

${yaml.safeDump(frontmatter)}
--->
${content.substring(match[0].length)}`;
  /*
  if (!/<title>/.test(content)) {
    content = content.replace(/<meta charset="utf-8">/g,
        '<meta charset="utf-8">\n  <title>' + exampleFile.title() + '</title>');
  }
  */
  return yamlFrontmatter;
}