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

Function str2bool

fullysupervised.py:227–235  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

225
226
227def str2bool(v):
228 if isinstance(v, bool):
229 return v
230 if v.lower() in ('yes', 'true', 't', 'y', '1'):
231 return True
232 elif v.lower() in ('no', 'false', 'f', 'n', '0'):
233 return False
234 else:
235 raise argparse.ArgumentTypeError('Boolean value expected.')
236
237
238if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected