MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / str2bool

Function str2bool

mixmatch.py:250–258  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

248
249
250def str2bool(v):
251 if isinstance(v, bool):
252 return v
253 if v.lower() in ('yes', 'true', 't', 'y', '1'):
254 return True
255 elif v.lower() in ('no', 'false', 'f', 'n', '0'):
256 return False
257 else:
258 raise argparse.ArgumentTypeError('Boolean value expected.')
259
260
261if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected