Add entry for one file containing YANG module text.

    Args:
        yfile (file): File containing a YANG module or submodule.
960217
def module_entry(yfile):
    
    ytxt = yfile.read()
    mp = ModuleParser(ytxt)
    mst = mp.statement()
    submod = mst.keyword == "submodule"
    import_only = True
    rev = ""
    features = []
    includes = []
    rec = {}
    for sst in mst.substatements:
        if not rev and sst.keyword == "revision":
            rev = sst.argument
        elif import_only and sst.keyword in data_kws:
            import_only = False
        elif sst.keyword == "feature":
            features.append(sst.argument)
        elif submod:
            continue
        elif sst.keyword == "namespace":
            rec["namespace"] = sst.argument
        elif sst.keyword == "include":
            rd = sst.find1("revision-date")
            includes.append((sst.argument, rd.argument if rd else None))
    rec["import-only"] = import_only
    rec["features"] = features
    if submod:
        rec["revision"] = rev
        submodmap[mst.argument] = rec
    else:
        rec["includes"] = includes
        modmap[(mst.argument, rev)] = rec
70295
def add_source(self, filename, env_filename):
    
    self._ensure_unfrozen('Adding source')
    self._copy_or_link(filename, env_filename, "source")
1358795
def append(self, filename, content, binary=False):
        """"""

        self._raise_if_none()
        fn = path_join(self.path, filename)

        if binary:
            flags = 'ab'
        else:
            flags = 'a'

        with open(fn, 'a') as f:
            f.write(content)
            return True
189238
def _load_module(self, name: YangIdentifier,
                     rev: RevisionDate) -> Statement:
        """"""
        for d in self.module_search_path:
            run = 0
            while run < 2:
                fn = f"{d}/{name}"
                if rev and run == 0:
                    fn += "@" + rev
                fn += ".yang"
                try:
                    with open(fn, encoding='utf-8') as infile:
                        res = ModuleParser(infile.read(), name, rev).parse()
                except (FileNotFoundError, PermissionError, ModuleContentMismatch):
                    run += 1
                    continue
                return res
        raise ModuleNotFound(name, rev)
844193
def loadYaml(self, ydata, filepath=''):
        
        # build options
        opts = {'platform': sys.platform}

        mkpath = lambda x: _mkpath(filepath, x, **opts)

        # lookup environment variables
        env = {}
        for key, text in ydata.get('environment', {}).items():
            if text:
                env[key] = os.path.expandvars(text)
            else:
                env[key] = ''

        self.setEnvironment(env)

        # lookup general settings
        for key, val in ydata.get('settings', {}).items():
            attr = '_' + key
            if hasattr(self, attr):
                setattr(self, attr, val)

        # lookup options
        yoptions = ydata.get('options')
        if yoptions is not None:
            options = 0
            for key, value in yoptions.items():
                if value:
                    try:
                        options |= Builder.Options[key]
                    except KeyError:
                        continue

            self._options = options

        # lookup path options
        for key, path in ydata.get('paths', {}).items():
            if key.endswith('Paths'):
                path = map(mkpath, path.split(';'))
            else:
                path = mkpath(path)

            setattr(self, '_' + key, path)

        # lookup executable options
        yexe = ydata.get('executable')
        if yexe is not None:
            exe_tags = {'runtime': '_runtime',
                        'exe': '_executableName',
                        'cli': '_executableCliName',
                        'product': '_productName'}

            for tag, prop in exe_tags.items():
                if tag in yexe:
                    value = yexe.pop(tag)
                    if value.startswith('.'):
                        value = mkpath(value)

                    setattr(self, prop, value)

            # load exclude options
            self.setExecutableExcludes(yexe.get('excludes', []))

            # load build data
            yexedata = yexe.get('data', {})
            if yexedata:
                data = []
                for key, value in yexedata.items():
                    if key == 'tree':
                        path = value.get('path', '')
                        if path:
                            path = mkpath(path)
                        else:
                            path = self.sourcePath()

                        prefix = value.get('prefix', os.path.basename(path))
                        excludes = value.get('excludes', '').split(';')

                        if excludes:
                            data.append(('tree', (path, prefix, excludes)))

                    else:
                        for item in value:
                            data.append((key, item))

                self.setExecutableData(data)

            # load hidden imports
            self.setHiddenImports(yexe.get('hiddenimports', []))

            # load options
            for key, value in yexe.get('options', {}).items():
                value = nstr(value)
                if value.startswith('.'):
                    value = mkpath(value)
                self._executableOptions[key] = value

        # lookup installer options
        yinstall = ydata.get('installer')
        if yinstall is not None:
            install_tags = {'name': '_installName'}

            for tag, prop in install_tags.items():
                if tag in yinstall:
                    value = yinstall.pop(tag, None)
                    if value.startswith('.'):
                        value = mkpath(value)
                    setattr(self, prop, value)

            for key, value in yinstall.get('options', {}).items():
                if type(value) in (unicode, str) and value.startswith('.'):
                    value = mkpath(value)

                self._installerOptions[key] = value

            for path in yinstall.get('additional_directories', []):
                self._installDirectories[path.get('path', '')] = path.get('source', '')
22503
function loadYamlFile (file) {
  try {
    return yaml.load(fs.readFileSync(file, 'utf8'))
  } catch (e) {
    if (!/ENOENT:\s+no such file or directory/.test(e)) {
      console.log('Error Loading ' + file + ':', e)
      throw e
    }
  }
}
1191378
def generate_yaml_file(filename, contents):
    """"""
    with open(filename, 'w') as file:
        file.write(yaml.dump(contents, default_flow_style=False))
888782
def process_module(self, yam):
        """"""
        for ann in yam.search(("ietf-yang-metadata", "annotation")):
            self.process_annotation(ann)
        for ch in yam.i_children[:]:
            if ch.keyword == "rpc":
                self.process_rpc(ch)
            elif ch.keyword == "notification":
                self.process_notification(ch)
            else:
                continue
            yam.i_children.remove(ch)
        self.process_children(yam, "//nc:*", 1)
316057
def write_yaml_to_file(file)
      file = if file.is_a?(String)
               File.new(file, 'w')
             else
               file
             end

      content = {
        source_file_path: source_file_path,
        code_string: code_string,
      }.to_yaml

      file.write(content)
      file.flush
    end
231644
def add_input_file(self, filename):
    
    if filename not in self.__input_files:
      self.__input_files.append(filename)
6187
function addEntryComponentToModule(source, modulePath, classifiedName, importPath) {
    return addSymbolToNgModuleMetadata(source, modulePath, 'entryComponents', classifiedName, importPath);
}
82750
def add(self, filetype, **kwargs):
        

        location = self.location(filetype, **kwargs)
        source = self.url(filetype, sasdir='sas' if not self.public else '', **kwargs)
        if 'full' not in kwargs:
            destination = self.full(filetype, **kwargs)
        else:
            destination = kwargs.get('full')

        if location and source and destination:
            self.initial_stream.append_task(location=location, source=source, destination=destination)
        else:
            print("There is no file with filetype=%r to access in the tree module loaded" % filetype)
276662
def add_file(self, name, required=False, error=None, extensions=None):
        
        if name is None:
            return
        self.file_arguments.append(dict(
            name=name,
            required=required,
            error=error,
            extensions=extensions))
166622
private ITemplateSourceEntry addFileEntry(Map<String, ITemplateSourceEntry> entries, final File file) throws IOException {
		String name = file.getCanonicalPath().substring(mainEntryPathLength).replace(FILE_SEPARATOR, '/');

		ITemplateSourceEntry entry = new FileTemplateSourceEntry(name, file);
		entries.put(name, entry);
		return entry;
	}
181561
def load_config(configfile):
    
    try:
        with open(configfile, 'r') as ymlfile:
            try:
                config = yaml.load(ymlfile)
                return config
            except yaml.parser.ParserError:
                raise PyYAMLConfigError(
                    'Could not parse config file: {}'.format(configfile),
                )
    except IOError:
        raise PyYAMLConfigError(
            'Could not open config file: {}'.format(configfile),
        )
1272422
def add_file(self, file, filename):
        
        self.files['_{}'.format(filename)] = (filename, file)
951784
public void addEntry(File srcFile, File destFile) {
        entries.add(new Entry(srcFile,destFile));
    }