File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
libs/labelbox/src/labelbox/schema/tool_building Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,26 @@ def __post_init__(self):
48
48
if self .name .strip () == "" :
49
49
raise ValueError ("Name cannot be empty" )
50
50
51
+ if not self ._validate_classifications (self .classifications ):
52
+ raise ValueError ("Only one checklist classification is supported" )
53
+
54
+ def __setattr__ (self , name , value ):
55
+ if name == "classifications" and not self ._validate_classifications (
56
+ value
57
+ ):
58
+ raise ValueError ("Classifications are immutable" )
59
+ object .__setattr__ (self , name , value )
60
+
61
+ def _validate_classifications (
62
+ self , classifications : List [Classification ]
63
+ ) -> bool :
64
+ if (
65
+ len (classifications ) != 1
66
+ or classifications [0 ].class_type != Classification .Type .CHECKLIST
67
+ ):
68
+ return False
69
+ return True
70
+
51
71
def asdict (self ) -> Dict [str , Any ]:
52
72
return {
53
73
"tool" : self .type .value ,
You can’t perform that action at this time.
0 commit comments