File size: 350 Bytes
fe39cc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from enum import IntEnum

class Condition(IntEnum):
    ABSENT = 0
    PRESENT = 1

    @staticmethod
    def convert(s):
        value = str(s).upper()
        if value == 'ABSENT':
            return Condition.ABSENT
        if value == 'PRESENT':
            return Condition.PRESENT
        raise ValueError(f"Unsupported condition label: {s}")