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

Function str2bool

freematch.py:259–267  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected