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

Function str2bool

flexmatch.py:264–272  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

262
263
264def str2bool(v):
265 if isinstance(v, bool):
266 return v
267 if v.lower() in ('yes', 'true', 't', 'y', '1'):
268 return True
269 elif v.lower() in ('no', 'false', 'f', 'n', '0'):
270 return False
271 else:
272 raise argparse.ArgumentTypeError('Boolean value expected.')
273
274
275if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected