(cfg_files, module_name)
check if the configuration files actually specify something

    If config files are given, give warning if they don't contain
    information. This may indicate a wrong module name name, for
    example.
check if the configuration files actually specify something
check if the configuration files actually specify something
def check_cfg_files(cfg_files, module_name):
    """check if the configuration files actually specify something

    If config files are given, give warning if they don't contain
    information. This may indicate a wrong module name name, for
    example.
    """

    cfg = ConfigParser.SafeConfigParser()
    cfg.read(cfg_files)
    if cfg.has_section(module_name):
        section_items = cfg.items(module_name)
    else:
        section_items = []
    default_items = cfg.items('DEFAULT')

    n_items = len(section_items) + len(default_items)
    if n_items == 0:
        log.warn('configuration files were specified, but no options were '
                 'found in "%s" or "DEFAULT" sections.' % (module_name,))
def check_cfg_files ( cfg_files , module_name ) : cfg = ConfigParser . SafeConfigParser ( ) cfg . read ( cfg_files ) if cfg . has_section ( module_name ) : section_items = cfg . items ( module_name ) else : section_items = [ ] default_items = cfg . items ( 'DEFAULT' ) n_items = len ( section_items ) + len ( default_items ) if n_items == 0 : log . warn ( 'configuration files were specified, but no options were ' 'found in "%s" or "DEFAULT" sections.' % ( module_name , ) )