load manifest from file
352655
def _load_manifest_from_file(manifest, path):
    
    path = os.path.abspath(os.path.expanduser(path))
    if not os.path.exists(path):
        raise ManifestException("Manifest does not exist at {0}!".format(path))
    manifest.read(path)
    if not manifest.has_option('config', 'source'):
        manifest.set('config', 'source', str(path))
1324303
def load(filename):
        """""""
        if os.path.isfile(filename):
            with open(filename) as handle:
                return yaml_load(handle, Loader=Loader)  # nosec
        raise RuntimeError("File %s doesn't exist!" % filename)
384881
def parse_manifest(code, filename)
      Puppet::Pops::Parser::EvaluatingParser.new.parse_string(code, filename)
    rescue Puppet::Error => e
      raise Bolt::PAL::PALError, "Failed to parse manifest: #{e}"
    end
506884
def create_manifest(filename, manifest, console):
    
    if not manifest:
        manifest = ManifestFromXMLFile(filename)
        # /path/NAME.exe.manifest - split extension twice to get NAME.
        name = os.path.basename(filename)
        manifest.name = os.path.splitext(os.path.splitext(name)[0])[0]
    elif isinstance(manifest, basestring) and "<" in manifest:
        # Assume XML string
        manifest = ManifestFromXML(manifest)
    elif not isinstance(manifest, Manifest):
        # Assume filename
        manifest = ManifestFromXMLFile(manifest)
    dep_names = set([dep.name for dep in manifest.dependentAssemblies])
    if manifest.filename != filename:
        # Update dependent assemblies
        depmanifest = ManifestFromXMLFile(filename)
        for assembly in depmanifest.dependentAssemblies:
            if not assembly.name in dep_names:
                manifest.dependentAssemblies.append(assembly)
                dep_names.add(assembly.name)
    if (not console and
        not "Microsoft.Windows.Common-Controls" in dep_names):
        # Add Microsoft.Windows.Common-Controls to dependent assemblies
        manifest.dependentAssemblies.append(
            Manifest(type_="win32",
                 name="Microsoft.Windows.Common-Controls",
                 language="*",
                 processorArchitecture=processor_architecture(),
                 version=(6, 0, 0, 0),
                 publicKeyToken="6595b64144ccf1df")
            )
    manifest.writeprettyxml(filename)
    return manifest
770089
def load_manifests(self):
        
        for path in self.plugin_paths:
            for item in os.listdir(path):
                item_path = os.path.join(path, item)
                if os.path.isdir(item_path):
                    self.load_manifest(item_path)
827402
def from_file(cls, filename):
        """"""
        try:
            with open(filename, "r") as fh:
                return cls.from_dict(yaml.safe_load(fh))
        except Exception as exc:
            print("Error while reading TaskManager parameters from %s\n" % filename)
            raise
854829
def load_from_file(swag_path, swag_type='yml', root_path=None):
    
    if swag_type not in ('yaml', 'yml'):
        raise AttributeError("Currently only yaml or yml supported")
        # TODO: support JSON

    try:
        enc = detect_by_bom(swag_path)
        with codecs.open(swag_path, encoding=enc) as yaml_file:
            return yaml_file.read()
    except IOError:
        # not in the same dir, add dirname
        swag_path = os.path.join(
            root_path or os.path.dirname(__file__), swag_path
        )
        try:
            enc = detect_by_bom(swag_path)
            with codecs.open(swag_path, encoding=enc) as yaml_file:
                return yaml_file.read()
        except IOError:  # pragma: no cover
            # if package dir
            # see https://github.com/rochacbruno/flasgger/pull/104
            # Still not able to reproduce this case
            # test are in examples/package_example
            # need more detail on how to reproduce IOError here
            swag_path = swag_path.replace("/", os.sep).replace("\\", os.sep)
            path = swag_path.replace(
                (root_path or os.path.dirname(__file__)), ''
            ).split(os.sep)[1:]
            site_package = imp.find_module(path[0])[1]
            swag_path = os.path.join(site_package, os.sep.join(path[1:]))
            with open(swag_path) as yaml_file:
                return yaml_file.read()
360510
def load(filename: str, format: str = None):
    """"""

    path = Path(filename).resolve()

    with path.open() as file:
        data = file.read()

    if format is None:
        loader, error_class = _load_autodetect, InvalidMofileFormat
    else:
        try:
            loader, error_class = formats[format]
        except KeyError:
            raise InvalidMofileFormat(f'Unknown file format: {format}')

    try:
        config = loader(data)
    except error_class as e:
        raise InvalidMofileFormat(f'Unable to load task file: {e}')

    return Project(config, path.parent)
632736
public function load()
    {
        // load the constants from the manifest
        if ($this->extension->getId() != "generis"){
            foreach ($this->extension->getConstants() as $key => $value) {
                if(!defined($key) && !is_array($value)){
                    define($key, $value);
                }
            }
        }
    }
1318166
protected function loadManifest()
    {
        $manifestPath = Paths::assets('manifest.json');

        if (file_exists($manifestPath))
        {
            return json_decode(file_get_contents($manifestPath), true);
        }

        return null;
    }
13172
def load(file)
      if File.exist? file
        symbolize_keys(YAML.load_file(File.expand_path('.', file)))
      else
        {}
      end
    end
172695
def load(self, **kwargs):
        """"""

        coordsys = kwargs.get('coordsys', 'CEL')
        extdir = kwargs.get('extdir', self.extdir)
        srcname = kwargs.get('srcname', None)

        self.clear()
        self.load_diffuse_srcs()

        for c in self.config['catalogs']:

            if isinstance(c, catalog.Catalog):
                self.load_existing_catalog(c)
                continue

            extname = os.path.splitext(c)[1]
            if extname != '.xml':
                self.load_fits_catalog(c, extdir=extdir, coordsys=coordsys,
                                       srcname=srcname)
            elif extname == '.xml':
                self.load_xml(c, extdir=extdir, coordsys=coordsys)
            else:
                raise Exception('Unrecognized catalog file extension: %s' % c)

        for c in self.config['sources']:

            if 'name' not in c:
                raise Exception(
                    'No name field in source dictionary:\n ' + str(c))

            self.create_source(c['name'], c, build_index=False)

        self._build_src_index()
1121773
def load_plugins(self, *args):
        
        for manifest in self._manifests:
            self.load_plugin(manifest, *args)
933656
def create_manifest(self):
        """"""
        config_path = os.path.join(self.expt.control_path,
                                   DEFAULT_CONFIG_FNAME)

        self.manifest = []

        if os.path.isfile(config_path):
            self.manifest.append(config_path)

        for model in self.expt.models:
            config_files = model.config_files + model.optional_config_files

            self.manifest.extend(os.path.join(model.control_path, f)
                                 for f in config_files)

        # Add file manifests to runlog manifest
        for mf in self.expt.manifest:
            self.manifest.append(mf.path)
168347
def load_manifest(self, path):
        
        manifest_path = os.path.join(path, "plugin.json")
        self._logger.debug("Attempting to load plugin manifest from {}.".format(manifest_path))
        try:
            with open(manifest_path) as f:
                manifest = json.load(f)
            manifest["path"] = path
            self._manifests.append(manifest)
            self._logger.debug("Loaded plugin manifest from {}.".format(manifest_path))
        except ValueError:
            self._logger.error("Failed to decode plugin manifest at {}.".format(manifest_path))
        except (OSError, IOError) as e:
            self._logger.error("Failed to load plugin manifest at {}.".format(manifest_path))
1257603
function parseManifest(manifest, docroot, callback)
{
  var inCache = false
    , lines = [];

    // get manifest file data
    fs.readFile(manifest, 'ascii', function(err, data)
    {
      var counter = 0;

      if (err)
      {
        // to prevent sudden continuation
        return callback(err);
      }

      cache[manifest] =
      {
        version: 0,
        files: [],
        manifest: data
      };

      lines = data.split('\n');

      lines.forEach(function(line)
      {
        var match;

        line = line.trim();

        // empty lines
        if (line.substr(0, 1) == '') return;

        // skip comments
        if (line.substr(0, 1) == '#') return;

        // process control keywords
        switch (line)
        {
          case 'CACHE MANIFEST':
          case 'CACHE:':
            inCache = true;
            return;
            break;

          // TODO: Add proper support for fallbacks
          case 'NETWORK:':
          case 'FALLBACK:':
            inCache = false;
            return;
            break;
        }

        // do nothing for network files
        if (!inCache) return;

        // check the file and setup monitoring
        if (!line.match(/^http(s)?:\/\//))
        {
          addWatcher(docroot+line, watcher(manifest), function(added, mtime)
          {
            // undo counter
            counter--;

            if (!added)
            {
              // check if everything is done
              if (counter == 0) callback();
              return;
            }

            if (mtime > cache[manifest].version) cache[manifest].version = mtime;

            cache[manifest].files.push(line);

            // check if everything is done
            if (counter == 0) callback();
          });

          // track inception
          counter++;
        }

      });
    });
}
564879
def load_from_file(cls, filename_prefix):
    """"""
    filename = cls._filename(filename_prefix)
    lines, _ = cls._read_lines_from_file(filename)
    # Strip wrapping single quotes
    vocab_list = [line[1:-1] for line in lines]
    return cls(vocab_list=vocab_list)