Spaces:
Sleeping
Sleeping
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
# Power by Zongsheng Yue 2021-11-24 15:07:43 | |
def update_args(args_json, args_parser): | |
for arg in vars(args_parser): | |
args_json[arg] = getattr(args_parser, arg) | |
def str2bool(v): | |
""" | |
https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse | |
""" | |
if isinstance(v, bool): | |
return v | |
if v.lower() in ("yes", "true", "t", "y", "1"): | |
return True | |
elif v.lower() in ("no", "false", "f", "n", "0"): | |
return False | |
else: | |
raise argparse.ArgumentTypeError("boolean value expected") | |