Parse boolean arguments from the command line.
(s)
| 179 | |
| 180 | |
| 181 | def bool_flag(s): |
| 182 | """ |
| 183 | Parse boolean arguments from the command line. |
| 184 | """ |
| 185 | FALSY_STRINGS = {"off", "false", "0"} |
| 186 | TRUTHY_STRINGS = {"on", "true", "1"} |
| 187 | if s.lower() in FALSY_STRINGS: |
| 188 | return False |
| 189 | elif s.lower() in TRUTHY_STRINGS: |
| 190 | return True |
| 191 | else: |
| 192 | raise argparse.ArgumentTypeError("invalid value for a boolean flag") |
| 193 | |
| 194 | |
| 195 | def fix_random_seeds(seed=31): |
nothing calls this directly
no outgoing calls
no test coverage detected