Skip to content

Commit 2575284

Browse files
committed
Fix styles
1 parent f237792 commit 2575284

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

schema_salad/dlang_codegen.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ def parse_record_field_type(
207207
else:
208208
type_str = stype
209209
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+
]
211213
if has_default:
212214
t_str = [t for t in t_str if t != "None"]
213215
if len(t_str) == 1:
@@ -218,14 +220,18 @@ def parse_record_field_type(
218220
union_types = ", ".join(t_str)
219221
type_str = f"Union!({union_types})"
220222
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]
222226
type_str = f"{item_type}[]"
223227
elif shortname(type_["type"]) == "record":
224228
return annotate_str, shortname(type_.get("name", "record"))
225229
elif shortname(type_["type"]) == "enum":
226230
return annotate_str, "'not yet implemented'"
227231
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]
229235
type_str = f"{value_type}[string]"
230236
return annotate_str, type_str
231237

@@ -243,14 +249,16 @@ def parse_record_field(self, field: Dict[str, Any], parent_name: Optional[str] =
243249
else:
244250
value = cast(str, parent_name)
245251
return f'{doc_comment}static immutable {fname} = "{value}";' # noqa: B907
246-
252+
247253
if field.get("default", None) is not None:
248254
default_value = json.dumps(field["default"])
249255
default_str = f'@defaultValue(q"<{default_value}>") '
250256
else:
251257
default_str = ""
252258

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+
)
254262
return f"{doc_comment}{default_str}{annotate_str}{type_str} {fname};"
255263

256264
def parse_record_schema(self, stype: Dict[str, Any]) -> str:

0 commit comments

Comments
 (0)