File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,8 +152,10 @@ def prologue(self) -> None:
152152 from typing_extensions import Self
153153""" )
154154
155- for parent in self .parents_map .values ():
156- self .out .write (f"import { parent } \n " )
155+ if self .parents_map :
156+ self .out .write ("\n " )
157+ for parent in self .parents_map .values ():
158+ self .out .write (f"import { parent } \n " )
157159
158160 python_codegen_support : Final = (
159161 files ("schema_salad" ).joinpath ("python_codegen_support.py" ).read_text ("UTF-8" )
@@ -625,9 +627,9 @@ def declare_field(
625627 """
626628{spc} vocab = _vocab | loadingOptions.vocab
627629{spc} if {safename} not in (cls.__name__, vocab.get(cls.__name__)):
628- {spc} raise ValidationException(f"tried `{{cls.__name__}}` but")
630+ {spc} raise ValidationException(f"tried `{{cls.__name__}}` but")
629631{spc} except ValidationException as e:
630- {spc} raise e
632+ {spc} raise e
631633""" .format (
632634 safename = self .safe_name (name ),
633635 spc = spc ,
Original file line number Diff line number Diff line change 11"""
22Shared code for parsers generated by the Python codegen.
33
4- See :option:`--codegen=python` & :py:mod:`python_codegen`."""
4+ See :option:`--codegen=python` & :py:mod:`python_codegen`.
5+ """
56
67from __future__ import annotations
78
3536
3637
3738class LoadingOptions :
39+ """Class that holds the state of loading a SALAD document."""
40+
3841 idx : Final [IdxType ]
3942 fileuri : Final [str | None ]
4043 baseuri : Final [str ]
@@ -280,6 +283,7 @@ def save(
280283 base_url : str = "" ,
281284 relative_uris : bool = True ,
282285) -> save_type :
286+ """Convert an object to a JSON/YAML friendly dictionary."""
283287 if isinstance (val , Saveable ):
284288 return val .save (top = top , base_url = base_url , relative_uris = relative_uris )
285289 if isinstance (val , MutableSequence ):
You can’t perform that action at this time.
0 commit comments