def monkeytype_config(path: str) -> Config:
"""Imports the config instance specified by path.
Path should be in the form module:qualname. Optionally, path may end with (),
in which case we will call/instantiate the given class/function.
"""
should_call = False
if path.endswith('()'):
should_call = True
path = path[:-2]
module, qualname = module_path_with_qualname(path)
try:
config = get_name_in_module(module, qualname)
except MonkeyTypeError as mte:
raise argparse.ArgumentTypeError(f'cannot import {path}: {mte}')
if should_call:
config = config()
return config
评论列表
文章目录