def load_config(filepath: str) -> dict:
"""
load configuration file using configparser.
"""
config = configparser.ConfigParser()
result_dict = {}
try:
config.read(filepath)
except:
raise
# TODO: exception handler
for i in config.keys():
log.debug('i in config.keys(), i is: {}.'.format(i))
for j in config[i].keys():
log.debug('j in config.keys(), j is: {}.'.format(j))
_local_literal = str(config[i][j])
log.debug('we are going to save: {}.'.format(config[i][j]))
result_dict[j.upper()] = ast.literal_eval(_local_literal)
log.debug('we saved {}, its type is {}.'.format(result_dict[j.upper()], type(result_dict[j.upper()])))
global config_from_file
config_from_file = result_dict
return # XXX: to be storaged in config_from_file?