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

Function str2bool

softmatch.py:255–263  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected