run_module.py 文件源码

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

项目:firecloud_developer_toolkit 作者: broadinstitute 项目源码 文件源码
def parse_argv_module_args(argv,module_arg_names):
    baseline_args = ['module_name','lsid','cache_path','execution_id','cwd','module_libdir','sg_prepare_template']
    arg_names = baseline_args + module_arg_names
    arg_names2 = [argname + '=' for argname in arg_names]
    (param_value_pairs,remnants)=getopt.getopt(argv,"",arg_names2)
    if len(remnants)>0:
        raise Exception ("unrecognized arguments %s"%str(remnants))
    arg_param_value_dict = {}
    missing_args = set(module_arg_names)
    for arg_pair in param_value_pairs:
        param_name = arg_pair[0][2:] #strip off '--' at start
        param_value = arg_pair[1]
        if param_name not in module_arg_names:
            continue
        missing_args.remove(param_name)
        if param_name in arg_param_value_dict:
            raise Exception('duplicated param name %s'%param_name)
        arg_param_value_dict[param_name]=param_value
    missing_args = list(missing_args)

    return (arg_param_value_dict,missing_args)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号