def load_configs_from_directory(config_dir, overrides):
MASTER_CONFIG_FILE_NAME = "<STR_LIT>"<EOL>DEFAULT_CONFIG_NAME = "<STR_LIT>"<EOL>EMPTY_MAP = {}<EOL>master_config = None<EOL>config_objs = []<EOL>config_subdirs = []<EOL>default_mapping = {}<EOL>for dir_item in os.listdir(config_dir):<EOL><INDENT>full_path = os.path.join(config_dir, dir_item)<EOL>if os.path.isdir(full_path):<EOL><INDENT>config_subdirs.append(full_path)  <EOL><DEDENT>elif os.path.isfile(full_path):<EOL><INDENT>config_name = os.path.splitext(os.path.basename(full_path))[<NUM_LIT:0>]<EOL>try:<EOL><INDENT>mapping = utils.parse_config_file(full_path)<EOL><DEDENT>except ValueError:<EOL><INDENT>logger.debug("<STR_LIT>" + full_path + "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>if MASTER_CONFIG_FILE_NAME in config_name:<EOL><INDENT>master_config = Config(MASTER_CONFIG_FILE_NAME, mapping)<EOL><DEDENT>else:<EOL><INDENT>default_mapping.update(mapping)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if master_config is None:<EOL><INDENT>master_config = Config(MASTER_CONFIG_FILE_NAME, EMPTY_MAP)<EOL><DEDENT>if len(config_subdirs) == <NUM_LIT:0>:<EOL><INDENT>default_mapping.update(overrides)<EOL>config_objs.append(Config(DEFAULT_CONFIG_NAME, default_mapping))<EOL><DEDENT>else:<EOL><INDENT>for config_subdir in config_subdirs:<EOL><INDENT>config_files = [os.path.join(config_subdir, config_file) for config_file in os.listdir(config_subdir)<EOL>if os.path.isfile(os.path.join(config_subdir, config_file))]<EOL>subdir_mapping = default_mapping.copy()  <EOL>config_name = os.path.basename(config_subdir)<EOL>for config_file in config_files:<EOL><INDENT>try:<EOL><INDENT>mapping = utils.parse_config_file(config_file)<EOL><DEDENT>except ValueError:<EOL><INDENT>logger.debug("<STR_LIT>" + config_file + "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>subdir_mapping.update(mapping)<EOL><DEDENT><DEDENT>subdir_mapping.update(overrides)<EOL>config_objs.append(Config(config_name, subdir_mapping))<EOL><DEDENT><DEDENT>return master_config, config_objs<EOL>
Returns a master configuration object and a list of configuration objects

:param config_dir: the directory where the configuration files are located
:param overrides: mapping of the command line overrides