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

Function str2bool

vat.py:251–259  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected