Returns True for '1' and 'True', and False for '0' and 'False'. Throws ValueError for other values.
(value)
| 50 | |
| 51 | |
| 52 | def parse_bool_option(value): |
| 53 | """Returns True for '1' and 'True', and False for '0' and 'False'. |
| 54 | Throws ValueError for other values. |
| 55 | """ |
| 56 | if value.lower() in ["true", "1"]: |
| 57 | return True |
| 58 | elif value.lower() in ["false", "0"]: |
| 59 | return False |
| 60 | else: |
| 61 | raise InvalidOptionValueError("Unexpected value in configuration file. '" + value |
| 62 | + "' is not a valid value for a boolean option.") |
| 63 | |
| 64 | |
| 65 | def parse_shell_options(options, defaults, option_list): |
no test coverage detected