Construct `Config` object and return a list.

    :parse filename: A string containing the path to YAML file.
    :return: list
1271
def config(filename):
    
    Config = collections.namedtuple('Config', [
        'git',
        'lock_file',
        'version',
        'name',
        'src',
        'dst',
        'files',
        'post_commands',
    ])

    return [Config(**d) for d in _get_config_generator(filename)]
6400
def defconfig_filename(self):
        
        if self.defconfig_list:
            for filename, cond in self.defconfig_list.defaults:
                if expr_value(cond):
                    try:
                        with self._open_config(filename.str_value) as f:
                            return f.name
                    except IOError:
                        continue

        return None
170594
def _import_yaml(config_file_path):
    
    try:
        logger.info('Importing config %s...', config_file_path)
        with open(config_file_path) as config_file:
            return yaml.safe_load(config_file.read())
    except IOError as ex:
        raise RepexError('{0}: {1} ({2})'.format(
            ERRORS['config_file_not_found'], config_file_path, ex))
    except (yaml.parser.ParserError, yaml.scanner.ScannerError) as ex:
        raise RepexError('{0} ({1})'.format(ERRORS['invalid_yaml'], ex))
757928
def _load_config_file(self):
        
        LOGGER.info('Loading configuration from %s', self._file_path)
        if self._file_path.endswith('json'):
            config = self._load_json_config()
        else:
            config = self._load_yaml_config()
        for key, value in [(k, v) for k, v in config.items()]:
            if key.title() != key:
                config[key.title()] = value
                del config[key]
        return flatdict.FlatDict(config)
1007578
def get_config_file():
    

    # config will be created here if we can't find one
    new_config_path = os.path.expanduser('~/.dagobahd.yml')

    config_dirs = ['/etc',
                   os.path.expanduser('~')]
    config_filenames = ['dagobahd.yml',
                        'dagobahd.yaml',
                        '.dagobahd.yml',
                        '.dagobahd.yaml']

    for directory in config_dirs:
        for filename in config_filenames:
            try:
                if os.path.isfile(os.path.join(directory, filename)):
                    to_load = open(os.path.join(directory, filename))
                    config = yaml.load(to_load.read())
                    to_load.close()
                    replace_nones(config)
                    return config
            except:
                pass

    # if we made it to here, need to create a config file
    # double up on notifications here to make sure first-time user sees it
    print 'Creating new config file in home directory'
    logging.info('Creating new config file in home directory')
    new_config = open(new_config_path, 'w')
    new_config.write(return_standard_conf())
    new_config.close()

    new_config = open(new_config_path, 'r')
    config = yaml.load(new_config.read())
    new_config.close()
    replace_nones(config)
    return config
896854
def read_yaml(self, filename):
        '''
        
        '''
        with open(filename, 'r') as f:
            d = re.sub(r'\{\{ *([^ ]+) *\}\}', r'\1', f.read())
            y = yaml.safe_load(d)
            return y if y else {}
809633
def get_config(config_file):
    """"""
    def load(fp):
        try:
            return yaml.safe_load(fp)
        except yaml.YAMLError as e:
            sys.stderr.write(text_type(e))
            sys.exit(1)  # TODO document exit codes

    if config_file == '-':
        return load(sys.stdin)
    if not os.path.exists(config_file):
        sys.stderr.write('ERROR: Must either run next to config.yaml or'
            ' specify a config file.\n' + __doc__)
        sys.exit(2)
    with open(config_file) as fp:
        return load(fp)
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
268473
def load(filename):
    '''
    

    '''
    filepath = findConfigFile(filename)
    prop= None
    if (filepath):
        print ('loading Config file %s' %(filepath))

        with open(filepath, 'r') as stream:
            cfg=yaml.load(stream)
            prop = Properties(cfg) 
    else:
        msg = "Ice.Config file '%s' could not being found" % (filename)
        raise ValueError(msg)

    return prop
386329
def load(filename):
    
    yaml_filename = os.path.join(os.path.dirname(filename), 'step.yaml')
    with open(yaml_filename) as f:
        return yaml.load(f)
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)
798581
def load(self):
        """"""
        try:
            merged_configfile = self.get_merged_config()
            self.yamldocs = yaml.load(merged_configfile, Loader=Loader)

            # Strip out the top level 'None's we get from concatenation.
            # Functionally not required, but makes dumps cleaner.
            self.yamldocs = [x for x in self.yamldocs if x]
            self.logdebug('parsed_rules:\n%s\n' % pretty(self.yamldocs))

        except (yaml.scanner.ScannerError, yaml.parser.ParserError):
            self.raise_and_log_error(ConfigError, 'error parsing config.')
924180
def check_yaml_configs(configs, key):
    
    diagnostic = {}
    for i in configs:
        for fname in i:
            with open(fname) as stream:
                try:
                    res = yaml.load(stream, Loader=UnsafeLoader)
                    msg = 'ok'
                except yaml.YAMLError as err:
                    stream.seek(0)
                    res = yaml.load(stream, Loader=BaseLoader)
                    if err.context == 'while constructing a Python object':
                        msg = err.problem
                    else:
                        msg = 'error'
                finally:
                    try:
                        diagnostic[res[key]['name']] = msg
                    except (KeyError, TypeError):
                        # this object doesn't have a 'name'
                        pass
    return diagnostic
890864
def _read_configuration(config_filename):
        
        config = ConfigParser()
        config.read(config_filename)

        if 'supplement' in config['database']:
            path = os.path.dirname(config_filename) + '/' + config.get('database', 'supplement')
            config_supplement = ConfigParser()
            config_supplement.read(path)
        else:
            config_supplement = None

        return config, config_supplement
759499
def read_config(path=None, final=False):
    """"""
    try:
        with open(config_path(path, final=final), 'r') as configfile:
            return yaml.safe_load(configfile) or {}
    except FileNotFoundError:
        return {}
1128325
def parse_config(config_file):
    """"""
    try:
        with open(config_file, 'r') as f:
            return yaml.load(f)
    except IOError:
        print "Configuration file {} not found or not readable.".format(config_file)
        raise
371564
def merge_config_files(fnames):
    
    def _load_yaml(fname):
        with open(fname) as in_handle:
            config = yaml.safe_load(in_handle)
        return config
    out = _load_yaml(fnames[0])
    for fname in fnames[1:]:
        cur = _load_yaml(fname)
        for k, v in cur.items():
            if k in out and isinstance(out[k], dict):
                out[k].update(v)
            else:
                out[k] = v
    return out