def _load_mods(opts, mods, search_dir, prefix):
'''
opts: The seralized config file
reaction_dir: A directory to search for reaction modules
'''
loaded = dict()
for mod_to_load in mods:
mod = imp.load_source(mod_to_load, os.path.join(search_dir, mod_to_load))
for func_def in inspect.getmembers(mod, inspect.isfunction):
func_mod_delimited = '{0}.{1}.{2}'.format(prefix, mod_to_load.rstrip('.py'), func_def[0])
loaded[func_mod_delimited] = func_def[1]
return loaded
评论列表
文章目录