Skip to content

Commit db43e0f

Browse files
author
Val Brodsky
committed
Add safe handling to LabelingServiceStatus
1 parent a0109d2 commit db43e0f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

libs/labelbox/src/labelbox/schema/labeling_service_status.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,23 @@ class LabelingServiceStatus(Enum):
88
Production = 'PRODUCTION'
99
Requested = 'REQUESTED'
1010
SetUp = 'SET_UP'
11+
Missing = None
12+
13+
@classmethod
14+
def is_supported(cls, value):
15+
return isinstance(value, cls)
16+
17+
@classmethod
18+
def _missing_(cls, value) -> 'LabelingServiceStatus':
19+
"""Handle missing null new task types
20+
Handle upper case names for compatibility with
21+
the GraphQL"""
22+
23+
if value is None:
24+
return cls.Missing
25+
26+
for name, member in cls.__members__.items():
27+
if value == name.upper():
28+
return member
29+
30+
return cls.Missing

0 commit comments

Comments
 (0)