| Conditions | 4 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import functools |
||
| 17 | def pack(self, arg): |
||
| 18 | """ |
||
| 19 | Take a list (or single value) and bitwise-or all the values together |
||
| 20 | """ |
||
| 21 | # Handle a variety of inputs: list or single, enum or raw |
||
| 22 | if isinstance(arg, list): |
||
| 23 | values = [self.enum(value) for value in arg] |
||
| 24 | else: |
||
| 25 | values = [self.enum(arg)] |
||
| 26 | |||
| 27 | # left side is an integer, right side is an enum value |
||
| 28 | return functools.reduce(lambda x, y: x | y.value, values, 0) |
||
| 29 | |||
| 50 |