MCPcopy Index your code
hub / github.com/FedML-AI/FedML / str2bool

Function str2bool

python/examples/simulation/sp_custom/main.py:22–32  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

20
21
22def str2bool(v):
23 if isinstance(v, bool):
24 return v
25 # if v.lower() in ('yes', 'true', 't', 'y', '1'):
26 if isinstance(v, str) and v.lower() in ('true', 'True'):
27 return True
28 elif isinstance(v, str) and v.lower() in ('false', 'False'):
29 return False
30 else:
31 return v
32 # raise argparse.ArgumentTypeError('Boolean value expected.')
33
34
35

Callers 1

add_argsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected