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

Function str2bool

fixmatch.py:262–270  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected