Loads configuration from a YAML file.

 @param [String] path
   The path to the configuration file.

 @return [Hash]
   The loaded configuration.

 @raise [InvalidConfig]
   The configuration file did not contain a YAML Hash.

 @since 0.4.1
10830
def load_configuration(path)
      config = YAML.load_file(path)

      unless config.kind_of?(Hash)
        raise(InvalidConfig,"DeploYML file #{path.dump} does not contain a Hash",caller)
      end

      return config
    end
233788
function loadYAMLConfig(configPath) {
  try {
    return safeLoad(readFileSync(configPath, 'utf8'))
  } catch (e) {
    if (e.constructor.name === 'YAMLException') {
      throw e
    }
    log.error({
      message: chalk.red(`Unable to find YML config at "${configPath}".`),
      ref: 'unable-to-find-config',
    })
    return undefined
  }
}
466305
def load_from_path(path: str) -> Config:
    
    data = _ensure_load(path)
    if not data:
        data = {}
    values, should_write = _ensure_values(data)
    values.update({'path': path})
    config = Config(**values)
    if config.signature_required:
        if not os.path.exists(config.update_cert_path):
            LOG.warning(
                f"No signing cert is present in {config.update_cert_path}, "
                "code signature checking disabled")
            config = config._replace(signature_required=False)
            config = config._replace(update_cert_path=DEFAULT_CERT_PATH)
    if should_write:
        save_to_path(path, config)
    return config
980739
def load_path(path)
      path = path.to_s
      check_error_string do
        @path = Pathname.new(path)
        load_path_impl(path)
      end
      self
    end
991185
def _load_config(self, path):
        
        p = os.path.abspath(os.path.expanduser(path))
        logger.debug('Loading configuration from: %s', p)
        return read_json_file(p)
968277
def load_yaml(path):
    # type: (str) -> OrderedDict
    
    with open(path, 'rt') as f:
        yamldict = yaml.load(f.read(), Loader=yamlloader.ordereddict.CSafeLoader)
    if not yamldict:
        raise (LoadError('YAML file: %s is empty!' % path))
    return yamldict
100237
def pools_config_content_from_file(config_path)
      ini_file = IniFile.load(config_path)

      ret_val = []
      ini_file.each_section do |section|
        ret_val << [section, ini_file[section]]
      end
      ret_val
    end
462995
def parse_yaml(file)
      file_content = File.exist?(file) ? ERB.new(File.read(file)).result : '---'

      config = YAML.load(file_content) || {}
      env    = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['APP_CONFIG_ENV']

      config_from config['default'], config[env]
    end
1299951
def from_file(cls, path=None):
        
        # None => use default
        if path is None:
            for path in cls.default_pathes():
                try:
                    return cls.from_file(path)
                except IOError as e:
                    logging.getLogger(__name__).debug(
                        _("Failed to read config file: {0}", exc_message(e)))
                except ImportError as e:
                    logging.getLogger(__name__).warn(
                        _("Failed to read {0!r}: {1}", path, exc_message(e)))
            return cls({})
        # False/'' => no config
        if not path:
            return cls({})
        if os.path.splitext(path)[1].lower() == '.json':
            from json import load
        else:
            from yaml import safe_load as load
        with open(path) as f:
            return cls(load(f))
1373658
def load
      @config = YAML.load_file(config_path)
      @status.set(errors: Status::INFO_FILE_LOADED)
      if @config == false
        @status.set(errors: Status::ERR_NOT_LOADING_EMPTY_FILE)
      end
    rescue
      @status.set(errors: Status::ERR_CANT_LOAD)
    end
939370
def load_config(path, opts = {})
    opts.reverse_merge! :reconnect => true
    new_config = self.class.parse_config_file(path)
    update_config(new_config[:config]) if new_config and new_config[:config]
    reconnect(@config[:base_url], @config[:username], @config[:password]) if opts[:reconnect] and connection_info_loaded?
    @config
  end
838268
def _load_config(config_filepath: str) -> Dict[str, Any]:
        
        try:
            config: Dict[str, Any] = yaml.load(stream=open(config_filepath, "r"))
        except Exception as e:
            raise Exception(f"Invalid DAG Factory config file; err: {e}")
        return config
705909
def load_config_at_path(path):
    
    if path.exists() and path.is_file():
        with path.open('r') as f:
            return yaml.load(f, Loader=yaml.SafeLoader)
    else:
        raise ConfigurationError("Couldn't find ballet.yml config file.")
163136
def load(klass):
        
        config = klass()
        for path in klass.CONF_PATHS:
            if os.path.exists(path):
                with open(path, 'r') as conf:
                    config.configure(yaml.safe_load(conf))
        return config
726288
def load_file(path):
    
    res = {}

    if not path:
        IOError("No path specified to save")

    if not os.path.isfile(path):
        raise IOError("File not found {}".format(path))

    try:
        with io.open(path, "r", encoding="utf-8") as f:
            if path.endswith(".json"):
                res = load_json_file(f)
            elif path.endswith(".yaml") or path.endswith(".yml"):
                res = load_yaml_file(f)
    except IOError:
        raise
    except Exception as e:
        raise IOError(e)
    return res
1223023
def read_conf_file
      conf = {}
      if File.exists?(CONF_PATH) && File.size?(CONF_PATH)
        # Store valid conf keys
        YAML.load_file(CONF_PATH).each do |key, value|
          if VALID_KEYS.include? key
            conf[key] = value
          else
            say "Invalid configuration key: #{key}"
          end
        end
      end
      conf
    end
1285008
public function loadFile($path) {
        $content = trim(file_read($path));
        $config = [];

        if ( ! empty($content)) {
            $config = Yaml::parse($content);
        }

        return $config;
    }