@@ -41,13 +41,11 @@ def label(self):
41
41
42
42
@classmethod
43
43
def from_dict (cls , dictionary : Dict [str , Any ]):
44
- return cls (value = dictionary ["value" ],
45
- schema_id = dictionary .get ("schemaNodeId" , None ),
46
- feature_schema_id = dictionary .get ("featureSchemaId" , None ),
47
- options = [
48
- cls .from_dict (o )
49
- for o in dictionary .get ("options" , [])
50
- ])
44
+ return cls (
45
+ value = dictionary ["value" ],
46
+ schema_id = dictionary .get ("schemaNodeId" , None ),
47
+ feature_schema_id = dictionary .get ("featureSchemaId" , None ),
48
+ options = [cls .from_dict (o ) for o in dictionary .get ("options" , [])])
51
49
52
50
def asdict (self ) -> Dict [str , Any ]:
53
51
return {
@@ -120,13 +118,12 @@ def name(self):
120
118
121
119
@classmethod
122
120
def from_dict (cls , dictionary : Dict [str , Any ]):
123
- return cls (
124
- class_type = cls .Type (dictionary ["type" ]),
125
- instructions = dictionary ["instructions" ],
126
- required = dictionary .get ("required" , False ),
127
- options = [Option .from_dict (o ) for o in dictionary ["options" ]],
128
- schema_id = dictionary .get ("schemaNodeId" , None ),
129
- feature_schema_id = dictionary .get ("featureSchemaId" , None ))
121
+ return cls (class_type = cls .Type (dictionary ["type" ]),
122
+ instructions = dictionary ["instructions" ],
123
+ required = dictionary .get ("required" , False ),
124
+ options = [Option .from_dict (o ) for o in dictionary ["options" ]],
125
+ schema_id = dictionary .get ("schemaNodeId" , None ),
126
+ feature_schema_id = dictionary .get ("featureSchemaId" , None ))
130
127
131
128
def asdict (self ) -> Dict [str , Any ]:
132
129
if self .class_type in self ._REQUIRES_OPTIONS \
@@ -201,15 +198,15 @@ class Type(Enum):
201
198
@classmethod
202
199
def from_dict (cls , dictionary : Dict [str , Any ]):
203
200
return cls (name = dictionary ['name' ],
204
- schema_id = dictionary .get ("schemaNodeId" , None ),
205
- feature_schema_id = dictionary .get ("featureSchemaId" , None ),
206
- required = dictionary .get ("required" , False ),
207
- tool = cls .Type (dictionary ["tool" ]),
208
- classifications = [
209
- Classification .from_dict (c )
210
- for c in dictionary ["classifications" ]
211
- ],
212
- color = dictionary ["color" ])
201
+ schema_id = dictionary .get ("schemaNodeId" , None ),
202
+ feature_schema_id = dictionary .get ("featureSchemaId" , None ),
203
+ required = dictionary .get ("required" , False ),
204
+ tool = cls .Type (dictionary ["tool" ]),
205
+ classifications = [
206
+ Classification .from_dict (c )
207
+ for c in dictionary ["classifications" ]
208
+ ],
209
+ color = dictionary ["color" ])
213
210
214
211
def asdict (self ) -> Dict [str , Any ]:
215
212
return {
@@ -310,12 +307,11 @@ class OntologyBuilder:
310
307
311
308
@classmethod
312
309
def from_dict (cls , dictionary : Dict [str , Any ]):
313
- return cls (
314
- tools = [Tool .from_dict (t ) for t in dictionary ["tools" ]],
315
- classifications = [
316
- Classification .from_dict (c )
317
- for c in dictionary ["classifications" ]
318
- ])
310
+ return cls (tools = [Tool .from_dict (t ) for t in dictionary ["tools" ]],
311
+ classifications = [
312
+ Classification .from_dict (c )
313
+ for c in dictionary ["classifications" ]
314
+ ])
319
315
320
316
def asdict (self ):
321
317
self ._update_colors ()
0 commit comments