@@ -41,13 +41,11 @@ def label(self):
4141
4242 @classmethod
4343 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" , [])])
5149
5250 def asdict (self ) -> Dict [str , Any ]:
5351 return {
@@ -120,13 +118,12 @@ def name(self):
120118
121119 @classmethod
122120 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 ))
130127
131128 def asdict (self ) -> Dict [str , Any ]:
132129 if self .class_type in self ._REQUIRES_OPTIONS \
@@ -201,15 +198,15 @@ class Type(Enum):
201198 @classmethod
202199 def from_dict (cls , dictionary : Dict [str , Any ]):
203200 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" ])
213210
214211 def asdict (self ) -> Dict [str , Any ]:
215212 return {
@@ -310,12 +307,11 @@ class OntologyBuilder:
310307
311308 @classmethod
312309 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+ ])
319315
320316 def asdict (self ):
321317 self ._update_colors ()
0 commit comments