MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / _arg_bool

Function _arg_bool

NLP/Text2SQL-BASELINE/text2sql/global_config.py:36–56  ·  view source on GitHub ↗

trans arg to bool type Args: arg (TYPE): NULL Returns: bool

(arg)

Source from the content-addressed store, hash-verified

34def define_args_parser():
35 """define command-line args parser"""
36 def _arg_bool(arg):
37 """trans arg to bool type
38
39 Args:
40 arg (TYPE): NULL
41
42 Returns: bool
43 """
44 if arg is None:
45 return arg
46
47 if type(arg) is not str:
48 return bool(arg)
49
50 if arg.isdigit():
51 return bool(int(arg))
52
53 if arg.lower() == 'true':
54 return True
55 else:
56 return False
57
58 parser = argparse.ArgumentParser(description="text2sql command-line interface")
59 parser.add_argument('-c', '--config', default='conf/text2sql.jsonnet',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected