Will process the flags and set attributes in the object accordingly. The object "obj" will gain attributes named after the flags provided in "flags" and valued True/False, matching the results of applying each flag value from "flags" to flag_field.
(obj, flag_field, flags)
| 699 | |
| 700 | |
| 701 | def set_flags(obj, flag_field, flags): |
| 702 | """Will process the flags and set attributes in the object accordingly. |
| 703 | |
| 704 | The object "obj" will gain attributes named after the flags provided in |
| 705 | "flags" and valued True/False, matching the results of applying each |
| 706 | flag value from "flags" to flag_field. |
| 707 | """ |
| 708 | |
| 709 | for flag, value in flags: |
| 710 | if value & flag_field: |
| 711 | obj.__dict__[flag] = True |
| 712 | else: |
| 713 | obj.__dict__[flag] = False |
| 714 | |
| 715 | |
| 716 | def power_of_two(val): |
no outgoing calls
no test coverage detected