Load a YAML configuration file.

        :param configuration: Configuration filename or YAML string
330335
def load(self, configuration):
        
        try:
            self.config = yaml.load(open(configuration, "rb"))
        except IOError:
            try:
                self.config = yaml.load(configuration)
            except ParserError, e:
                raise ParserError('Error parsing config: %s' % e)

        # put customer data into self.customer
        if isinstance(self.config, dict):
            self.customer = self.config.get('customer', {})
            self.instances_dict = self.config.get('instances', {})
            self.web2py_dir = self.config.get('web2py', None)
            self.api_type = self.config.get('api_type', 'jsonrpc')
            self.valid = True
        else:
            self.customer = {}
            self.instances_dict = {}
            self.web2py_dir = None
            self.valid = False
15498
def load_config(path):
   
   with path.open('rb') as fi:
       file_bytes = fi.read()
       config = yaml.load(file_bytes.decode('utf-8'))

   return config
1251952
def load(*files):
    
    if len(files) == 0:
        raise errors.ConfigError("No config files provided.")
    doc = merge(*(yaml.safe_load(f) for f in files))
    return propagate_defaults(doc)
216471
def load_yaml(file):
    """"""
    if hasattr(yaml, "full_load"):
        return yaml.full_load(file)
    else:
        return yaml.load(file)
758336
def load_config(config_file):
    
    with open(config_file) as in_handle:
        config = yaml.safe_load(in_handle)
    config = _expand_paths(config)
    if 'resources' not in config:
        config['resources'] = {}
    # lowercase resource names, the preferred way to specify, for back-compatibility
    newr = {}
    for k, v in config["resources"].items():
        if k.lower() != k:
            newr[k.lower()] = v
    config["resources"].update(newr)
    return config
1150549
def load(cls, filename=None):
        """"""
        if filename is None:
            LOGGER.debug("Loading default configuration.")
            with open_text(templates, "test_config.yml",
                           encoding="utf-8") as file_handle:
                content = yaml.load(file_handle)
        else:
            LOGGER.debug("Loading custom configuration '%s'.", filename)
            try:
                with open(filename, encoding="utf-8") as file_handle:
                    content = yaml.load(file_handle)
            except IOError as err:
                LOGGER.error(
                    "Failed to load the custom configuration '%s'. Skipping.",
                    filename)
                LOGGER.debug(str(err))
                content = dict()
        return cls(content)
1034159
def load_config(file)
      unless File.exists? file
        File.open(file, 'w') do |f| 
          YAML.dump({ default_website: 'default' }, f) 
        end
      end
      YAML.load_file(file)
    end
24149
def load_config_file(config_file_path, config_file):
    

    if config_file_path.lower().endswith(".yaml"):
        return yaml.load(config_file)

    if any(config_file_path.lower().endswith(extension) for extension in INI_FILE_EXTENSIONS):
        return load_config_from_ini_file(config_file)

    # At this point we have to guess the format of the configuration file.
    try:
        return yaml.load(config_file)
    except yaml.YAMLError:
        pass

    try:
        return load_config_from_ini_file(config_file)
    except:
        pass

    raise Exception("Could not load configuration file!")
1405
def load_config
      (symbolise = lambda do |h|
        h.is_a?(Hash) ? Hash[h.map { |k, v| [k.intern, symbolise[v]] }] : h
      end)[YAML.load_file CONFIG] if File.readable? CONFIG
    rescue => e
      warn "Failed to load #{ CONFIG }: #{ e }"
    end
1304574
def set_file(self, filename):
        
        filename = os.path.abspath(filename)
        self.set(ConfigSource(load_yaml(filename), filename))
111978
def _loadConfig(self):
        
        configPath = path.join(self._getConfigPath(), self._name + ".yml")
        if os.path.exists(configPath):
            self.logger.warning("Loading config from " + configPath)
            with open(configPath, 'r') as yml:
                return yaml.load(yml, Loader=yaml.FullLoader)
        defaultConfig = self.loadDefaultConfig()
        self._storeConfig(defaultConfig, configPath)
        return defaultConfig
1011613
def _load_yaml_config(path=None):
    """"""
    countour_yaml_path = path or find_contour_yaml()

    if countour_yaml_path is None:
        logging.debug("countour.yaml not found.")
        return None

    with open(countour_yaml_path) as yaml_file:
        return yaml_file.read()
460235
def load(self, file=CONFIG_FILE):
        
        if not os.path.exists(file):
            print("Config file was not found under %s. Default file has been created" % CONFIG_FILE)
            self._settings = yaml.load(DEFAULT_CONFIG, yaml.RoundTripLoader)
            self.save(file)
            sys.exit()
        with open(file, 'r') as f:
            self._settings = yaml.load(f, yaml.RoundTripLoader)
1136615
def load_configuration(app_name):
    '''
    
    '''
    if sys.prefix == '/usr':
        conf_dir = '/etc'
        share_dir = '/usr/share'
    else:
        conf_dir = os.path.join(sys.prefix, 'etc')
        share_dir = os.path.join(sys.prefix, 'share')
    # Step 1: try to locate pynlp.yml
    yml_config = {}
    for fname in [
            '%s.yml'%(app_name,),
            os.path.expanduser('~/.%s.yml'%(app_name,)),
            os.path.join(conf_dir, '%s.yml'%(app_name,))]:
        if os.path.exists(fname):
            yml_config = yaml.load(open(fname))
            break
    try:
        data_dir = yml_config['paths']['data_dir']
    except KeyError:
        try:
            data_dir = os.environ[app_name.upper()]
        except KeyError:
            data_dir = os.path.join(share_dir, app_name)
    return AppContext(yml_config, data_dir)
869490
def _load_config_file(self):
        """"""
        with open(self._config_file) as f:
            config = yaml.safe_load(f)
            patch_config(config, self.__environment_configuration)
            return config
1164528
def load_builtin_config(name, module_name=__name__, specs_path=specs.__path__):
    
    config_path = Path(next(iter(specs_path)))
    config_path = config_path / PurePath(resource_filename(module_name, name + '.yaml'))
    return load_config(config_path)
1176075
def _load_config(self):
        
        if not os.path.exists(self._path):
            sys.exit("Config path %s does not exist" % self._path)
        # create empty config object
        self._config_dict = {}
        # read file and marshal yaml
        with open(self._path, 'r') as f:
            self._raw = f.read()
            self._config_dict = yaml.load(self._raw)