| Total Complexity | 1 |
| Total Lines | 13 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from yaml.constructor import SafeConstructor |
||
| 2 | |||
| 3 | # Create custom safe constructor class that inherits from SafeConstructor |
||
| 4 | class MySafeConstructor(SafeConstructor): |
||
| 5 | |||
| 6 | # Create new method handle boolean logic |
||
| 7 | def add_bool(self, node): |
||
| 8 | return self.construct_scalar(node) |
||
| 9 | |||
| 10 | # Inject the above boolean logic into the custom constuctor |
||
| 11 | MySafeConstructor.add_constructor('tag:yaml.org,2002:bool', |
||
| 12 | MySafeConstructor.add_bool) |
||
| 13 |