66
77import logging
88from enum import Enum
9- from typing import Any
109
1110logger = logging .getLogger (__name__ )
1211
@@ -36,30 +35,7 @@ class WorkflowDefinitionId(Enum):
3635 Done = "done"
3736 CustomReworkTask = "custom_rework_task"
3837 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
6339
6440
6541class NodeType (Enum ):
@@ -91,19 +67,6 @@ class NodeOutput(str, Enum):
9167 Rejected = "else" # Alias for review node rejected output
9268 Default = "out"
9369
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-
10770
10871class NodeInput (str , Enum ):
10972 """Available input types for workflow nodes.
@@ -114,19 +77,6 @@ class NodeInput(str, Enum):
11477
11578 Default = "in"
11679
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-
13080
13181class MatchFilters (str , Enum ):
13282 """Available match filter options for LogicNode.
@@ -137,19 +87,6 @@ class MatchFilters(str, Enum):
13787 Any = "any" # Maps to filter_logic "or" - matches if any filter passes
13888 All = "all" # Maps to filter_logic "and" - matches if all filters pass
13989
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-
15390
15491class Scope (str , Enum ):
15592 """Available scope options for AutoQANode.
@@ -160,19 +97,6 @@ class Scope(str, Enum):
16097 Any = "any" # Passes if any annotation meets the criteria
16198 All = "all" # Passes only if all annotations meet the criteria
16299
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-
176100
177101class FilterField (str , Enum ):
178102 """Available filter fields for LogicNode filters.
@@ -209,19 +133,6 @@ class FilterField(str, Enum):
209133 # Search filters
210134 NlSearch = "NlSearch"
211135
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-
225136
226137class FilterOperator (str , Enum ):
227138 """Available filter operators for LogicNode filters.
@@ -250,16 +161,3 @@ class FilterOperator(str, Enum):
250161
251162 # Range operators
252163 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