Get the name of the state or mask from the value. Args: state (int): a `TaskState` value Returns: str: the name of the state
(cls, state)
| 82 | |
| 83 | @classmethod |
| 84 | def get_name(cls, state): |
| 85 | """Get the name of the state or mask from the value. |
| 86 | |
| 87 | Args: |
| 88 | state (int): a `TaskState` value |
| 89 | |
| 90 | Returns: |
| 91 | str: the name of the state |
| 92 | """ |
| 93 | names = dict(zip(cls._values, cls._names)) |
| 94 | names.update({ |
| 95 | TaskState.FINISHED_MASK: 'FINISHED_MASK', |
| 96 | TaskState.DEFINITE_MASK: 'DEFINITE_MASK', |
| 97 | TaskState.PREDICTED_MASK: 'PREDICTED_MASK', |
| 98 | TaskState.NOT_FINISHED_MASK: 'NOT_FINISHED_MASK', |
| 99 | TaskState.ANY_MASK: 'ANY_MASK', |
| 100 | }) |
| 101 | return names.get(state) or '|'.join([ names.get(v) for v in cls._values if v & state ]) |
| 102 | |
| 103 | @classmethod |
| 104 | def get_value(cls, name): |