MCPcopy Create free account
hub / github.com/TencentARC/InstantMesh / str2bool

Function str2bool

train.py:22–30  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

20
21def get_parser(**parser_kwargs):
22 def str2bool(v):
23 if isinstance(v, bool):
24 return v
25 if v.lower() in ("yes", "true", "t", "y", "1"):
26 return True
27 elif v.lower() in ("no", "false", "f", "n", "0"):
28 return False
29 else:
30 raise argparse.ArgumentTypeError("Boolean value expected.")
31
32 parser = argparse.ArgumentParser(**parser_kwargs)
33 parser.add_argument(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected