trans arg to bool type Args: arg (TYPE): NULL Returns: bool
(arg)
| 34 | def 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', |
nothing calls this directly
no outgoing calls
no test coverage detected