cli.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:MonkeyType 作者: Instagram 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号