Move str2bool to config_utils

This commit is contained in:
D-X-Y
2021-03-30 09:17:05 +00:00
parent 9fc2c991f5
commit c2270fd153
16 changed files with 519 additions and 305 deletions

View File

@@ -0,0 +1,12 @@
import argparse
def arg_str2bool(v):
if isinstance(v, bool):
return v
elif 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.")