6
6
7
7
import logging
8
8
from enum import Enum
9
- from typing import Any
10
9
11
10
logger = logging .getLogger (__name__ )
12
11
@@ -36,30 +35,7 @@ class WorkflowDefinitionId(Enum):
36
35
Done = "done"
37
36
CustomReworkTask = "custom_rework_task"
38
37
AutoQA = "auto_qa"
39
- Unknown = "unknown" # Fallback for potential future types
40
-
41
- @classmethod
42
- def _missing_ (cls , value : Any ) -> "WorkflowDefinitionId" :
43
- """Handle missing enum values with appropriate fallbacks.
44
-
45
- Args:
46
- value: The value that couldn't be found in the enum
47
-
48
- Returns:
49
- A valid WorkflowDefinitionId with appropriate fallback logic
50
- """
51
- # If value is None, return a valid default instead of Unknown
52
- if value is None :
53
- logger .warning (
54
- "Null WorkflowDefinitionId provided. Using default InitialLabelingTask."
55
- )
56
- return cls .InitialLabelingTask
57
-
58
- # For other unrecognized values, log warning but use a valid ID
59
- logger .warning (
60
- f"Unknown WorkflowDefinitionId '{ value } '. Using default InitialLabelingTask."
61
- )
62
- return cls .InitialLabelingTask
38
+ Unknown = "unknown" # For unrecognized node types from API
63
39
64
40
65
41
class NodeType (Enum ):
@@ -91,19 +67,6 @@ class NodeOutput(str, Enum):
91
67
Rejected = "else" # Alias for review node rejected output
92
68
Default = "out"
93
69
94
- @classmethod
95
- def _missing_ (cls , value : Any ) -> Any :
96
- """Handle missing enum values by using the value as-is.
97
-
98
- Args:
99
- value: The value that couldn't be found in the enum
100
-
101
- Returns:
102
- The original value for flexible usage
103
- """
104
- logger .warning (f"Unknown NodeOutput '{ value } '. Using as-is." )
105
- return value
106
-
107
70
108
71
class NodeInput (str , Enum ):
109
72
"""Available input types for workflow nodes.
@@ -114,19 +77,6 @@ class NodeInput(str, Enum):
114
77
115
78
Default = "in"
116
79
117
- @classmethod
118
- def _missing_ (cls , value : Any ) -> Any :
119
- """Handle missing enum values by using the value as-is.
120
-
121
- Args:
122
- value: The value that couldn't be found in the enum
123
-
124
- Returns:
125
- The original value for flexible usage
126
- """
127
- logger .warning (f"Unknown NodeInput '{ value } '. Using as-is." )
128
- return value
129
-
130
80
131
81
class MatchFilters (str , Enum ):
132
82
"""Available match filter options for LogicNode.
@@ -137,19 +87,6 @@ class MatchFilters(str, Enum):
137
87
Any = "any" # Maps to filter_logic "or" - matches if any filter passes
138
88
All = "all" # Maps to filter_logic "and" - matches if all filters pass
139
89
140
- @classmethod
141
- def _missing_ (cls , value ):
142
- """Handle missing enum values with All as default.
143
-
144
- Args:
145
- value: The value that couldn't be found in the enum
146
-
147
- Returns:
148
- MatchFilters.All as the safe default
149
- """
150
- logger .warning (f"Unknown MatchFilters '{ value } '. Using All as default." )
151
- return cls .All
152
-
153
90
154
91
class Scope (str , Enum ):
155
92
"""Available scope options for AutoQANode.
@@ -160,19 +97,6 @@ class Scope(str, Enum):
160
97
Any = "any" # Passes if any annotation meets the criteria
161
98
All = "all" # Passes only if all annotations meet the criteria
162
99
163
- @classmethod
164
- def _missing_ (cls , value ):
165
- """Handle missing enum values with All as default.
166
-
167
- Args:
168
- value: The value that couldn't be found in the enum
169
-
170
- Returns:
171
- Scope.All as the safe default
172
- """
173
- logger .warning (f"Unknown Scope '{ value } '. Using All as default." )
174
- return cls .All
175
-
176
100
177
101
class FilterField (str , Enum ):
178
102
"""Available filter fields for LogicNode filters.
@@ -209,19 +133,6 @@ class FilterField(str, Enum):
209
133
# Search filters
210
134
NlSearch = "NlSearch"
211
135
212
- @classmethod
213
- def _missing_ (cls , value : Any ) -> Any :
214
- """Handle missing enum values by using the value as-is.
215
-
216
- Args:
217
- value: The value that couldn't be found in the enum
218
-
219
- Returns:
220
- The original value for flexible usage
221
- """
222
- logger .warning (f"Unknown FilterField '{ value } '. Using as-is." )
223
- return value
224
-
225
136
226
137
class FilterOperator (str , Enum ):
227
138
"""Available filter operators for LogicNode filters.
@@ -250,16 +161,3 @@ class FilterOperator(str, Enum):
250
161
251
162
# Range operators
252
163
Between = "between"
253
-
254
- @classmethod
255
- def _missing_ (cls , value : Any ) -> Any :
256
- """Handle missing enum values by using the value as-is.
257
-
258
- Args:
259
- value: The value that couldn't be found in the enum
260
-
261
- Returns:
262
- The original value for flexible usage
263
- """
264
- logger .warning (f"Unknown FilterOperator '{ value } '. Using as-is." )
265
- return value
0 commit comments