@@ -207,7 +207,9 @@ def parse_record_field_type(
207
207
else :
208
208
type_str = stype
209
209
elif isinstance (type_ , list ):
210
- t_str = [self .parse_record_field_type (t , None , parent_has_idmap = has_idmap )[1 ] for t in type_ ]
210
+ t_str = [
211
+ self .parse_record_field_type (t , None , parent_has_idmap = has_idmap )[1 ] for t in type_
212
+ ]
211
213
if has_default :
212
214
t_str = [t for t in t_str if t != "None" ]
213
215
if len (t_str ) == 1 :
@@ -218,14 +220,18 @@ def parse_record_field_type(
218
220
union_types = ", " .join (t_str )
219
221
type_str = f"Union!({ union_types } )"
220
222
elif shortname (type_ ["type" ]) == "array" :
221
- item_type = self .parse_record_field_type (type_ ["items" ], None , parent_has_idmap = has_idmap )[1 ]
223
+ item_type = self .parse_record_field_type (
224
+ type_ ["items" ], None , parent_has_idmap = has_idmap
225
+ )[1 ]
222
226
type_str = f"{ item_type } []"
223
227
elif shortname (type_ ["type" ]) == "record" :
224
228
return annotate_str , shortname (type_ .get ("name" , "record" ))
225
229
elif shortname (type_ ["type" ]) == "enum" :
226
230
return annotate_str , "'not yet implemented'"
227
231
elif shortname (type_ ["type" ]) == "map" :
228
- value_type = self .parse_record_field_type (type_ ["values" ], None , parent_has_idmap = has_idmap , has_default = True )[1 ]
232
+ value_type = self .parse_record_field_type (
233
+ type_ ["values" ], None , parent_has_idmap = has_idmap , has_default = True
234
+ )[1 ]
229
235
type_str = f"{ value_type } [string]"
230
236
return annotate_str , type_str
231
237
@@ -243,14 +249,16 @@ def parse_record_field(self, field: Dict[str, Any], parent_name: Optional[str] =
243
249
else :
244
250
value = cast (str , parent_name )
245
251
return f'{ doc_comment } static immutable { fname } = "{ value } ";' # noqa: B907
246
-
252
+
247
253
if field .get ("default" , None ) is not None :
248
254
default_value = json .dumps (field ["default" ])
249
255
default_str = f'@defaultValue(q"<{ default_value } >") '
250
256
else :
251
257
default_str = ""
252
258
253
- annotate_str , type_str = self .parse_record_field_type (type_ , jsonld_pred , has_default = "default" in field )
259
+ annotate_str , type_str = self .parse_record_field_type (
260
+ type_ , jsonld_pred , has_default = "default" in field
261
+ )
254
262
return f"{ doc_comment } { default_str } { annotate_str } { type_str } { fname } ;"
255
263
256
264
def parse_record_schema (self , stype : Dict [str , Any ]) -> str :
0 commit comments