MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / str2bool

Function str2bool

util/util.py:13–21  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

11
12
13def str2bool(v):
14 if isinstance(v, bool):
15 return v
16 if v.lower() in ('yes', 'true', 't', 'y', '1'):
17 return True
18 elif v.lower() in ('no', 'false', 'f', 'n', '0'):
19 return False
20 else:
21 raise argparse.ArgumentTypeError('Boolean value expected.')
22
23
24def copyconf(default_opt, **kwargs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected