@@ -8,3 +8,29 @@ class FieldConfidence(str, Enum):
88 HIGH = "High"
99 MEDIUM = "Medium"
1010 LOW = "Low"
11+
12+ def __int__ (self ) -> int :
13+ return {"Certain" : 4 , "High" : 3 , "Medium" : 2 , "Low" : 1 }[self .value ]
14+
15+ def __str__ (self ) -> str :
16+ return self .value
17+
18+ def __lt__ (self , other ) -> bool :
19+ if isinstance (other , FieldConfidence ):
20+ return int (self ) < int (other )
21+ raise TypeError (f"Cannot compare FieldConfidence with { type (other )} " )
22+
23+ def __le__ (self , other ) -> bool :
24+ if isinstance (other , FieldConfidence ):
25+ return int (self ) <= int (other )
26+ raise TypeError (f"Cannot compare FieldConfidence with { type (other )} " )
27+
28+ def __gt__ (self , other ) -> bool :
29+ if isinstance (other , FieldConfidence ):
30+ return int (self ) > int (other )
31+ raise TypeError (f"Cannot compare FieldConfidence with { type (other )} " )
32+
33+ def __ge__ (self , other ) -> bool :
34+ if isinstance (other , FieldConfidence ):
35+ return int (self ) >= int (other )
36+ raise TypeError (f"Cannot compare FieldConfidence with { type (other )} " )
0 commit comments