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

Function str2bool

freematch_entropy.py:260–268  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected