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

Function str2bool

remixmatch.py:256–264  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected