@@ -11,11 +11,11 @@ class QueueName:
1111 QUERY = "query"
1212
1313
14- class CompressionJobStatus (IntEnum ):
15- PENDING = 0
16- RUNNING = auto ()
17- SUCCEEDED = auto ()
18- FAILED = auto ()
14+ class StatusIntEnum (IntEnum ):
15+ """
16+ Delegates __str__ to int.__str__, matching the behavior of IntEnum in Python 3.11+.
17+ TODO: Remove this when our minimum supported Python version is 3.11+.
18+ """
1919
2020 def __str__ (self ) -> str :
2121 return str (self .value )
@@ -24,33 +24,28 @@ def to_str(self) -> str:
2424 return str (self .name )
2525
2626
27- class CompressionJobCompletionStatus (IntEnum ):
28- SUCCEEDED = 0
27+ class CompressionJobStatus (StatusIntEnum ):
28+ PENDING = 0
29+ RUNNING = auto ()
30+ SUCCEEDED = auto ()
2931 FAILED = auto ()
3032
31- def __str__ (self ) -> str :
32- return str (self .value )
3333
34- def to_str (self ) -> str :
35- return str (self .name )
34+ class CompressionJobCompletionStatus (StatusIntEnum ):
35+ SUCCEEDED = 0
36+ FAILED = auto ()
3637
3738
38- class CompressionTaskStatus (IntEnum ):
39+ class CompressionTaskStatus (StatusIntEnum ):
3940 PENDING = 0
4041 RUNNING = auto ()
4142 SUCCEEDED = auto ()
4243 FAILED = auto ()
4344
44- def __str__ (self ) -> str :
45- return str (self .value )
46-
47- def to_str (self ) -> str :
48- return str (self .name )
49-
5045
5146# When adding new states always add them to the end of this enum
5247# and make necessary changes in the UI, Query Scheduler, and Reducer
53- class QueryJobStatus (IntEnum ):
48+ class QueryJobStatus (StatusIntEnum ):
5449 PENDING = 0
5550 RUNNING = auto ()
5651 SUCCEEDED = auto ()
@@ -62,14 +57,8 @@ class QueryJobStatus(IntEnum):
6257 def from_str (label : str ) -> QueryJobStatus :
6358 return QueryJobStatus [label .upper ()]
6459
65- def __str__ (self ) -> str :
66- return str (self .value )
67-
68- def to_str (self ) -> str :
69- return str (self .name )
70-
7160
72- class QueryTaskStatus (IntEnum ):
61+ class QueryTaskStatus (StatusIntEnum ):
7362 PENDING = 0
7463 RUNNING = auto ()
7564 SUCCEEDED = auto ()
@@ -80,20 +69,8 @@ class QueryTaskStatus(IntEnum):
8069 def from_str (label : str ) -> QueryTaskStatus :
8170 return QueryTaskStatus [label .upper ()]
8271
83- def __str__ (self ) -> str :
84- return str (self .value )
8572
86- def to_str (self ) -> str :
87- return str (self .name )
88-
89-
90- class QueryJobType (IntEnum ):
73+ class QueryJobType (StatusIntEnum ):
9174 SEARCH_OR_AGGREGATION = 0
9275 EXTRACT_IR = auto ()
9376 EXTRACT_JSON = auto ()
94-
95- def __str__ (self ) -> str :
96- return str (self .value )
97-
98- def to_str (self ) -> str :
99- return str (self .name )
0 commit comments