Convert b to ``bool`` or raise.
(b)
| 177 | |
| 178 | |
| 179 | def validate_bool(b): |
| 180 | """Convert b to ``bool`` or raise.""" |
| 181 | if isinstance(b, str): |
| 182 | b = b.lower() |
| 183 | if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): |
| 184 | return True |
| 185 | elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): |
| 186 | return False |
| 187 | else: |
| 188 | raise ValueError(f'Cannot convert {b!r} to bool') |
| 189 | |
| 190 | |
| 191 | def validate_axisbelow(s): |
no outgoing calls
searching dependent graphs…