| Conditions | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
| 22 | def transform_to_bool(value): |
||
| 23 | """ |
||
| 24 | Transforms a certain set of values to True or False. |
||
| 25 | True can be represented by '1', 'True' and 'true.' |
||
| 26 | False can be represented by '1', 'False' and 'false.' |
||
| 27 | |||
| 28 | Any other representation will be rejected. |
||
| 29 | """ |
||
| 30 | if value in ['1', 'true', 'True']: |
||
| 31 | return True |
||
| 32 | elif value in ['0', 'false', 'False']: |
||
| 33 | return False |
||
| 34 | raise ValueError('Invalid bool representation "%s" provided.' % value) |
||
| 35 |