Skip to content

Commit 0eadbb0

Browse files
committed
Allow default filename in to_yaml_file
1 parent 4fd3f89 commit 0eadbb0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/modelspec/base_types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ def to_yaml(self, include_metadata: bool = True) -> str:
205205
yaml_converter.unstructure(self.to_dict()), sort_keys=False, indent=4
206206
)
207207

208-
def to_yaml_file(self, filename: str, include_metadata: bool = True) -> str:
208+
def to_yaml_file(
209+
self, filename: Optional[str] = None, include_metadata: Optional[bool] = True
210+
) -> str:
209211
"""Convert modelspec format to yaml format
210212
211213
Args:
212-
filename: File in modelspec format (Filename extension: .yaml )
214+
filename: File in modelspec format (Filename extension: .yaml). If None, use :code:`f"{self.id}.yaml"`
213215
include_metadata: Contains contact information, citations, acknowledgements, pointers to sample data,
214216
benchmark results, and environments in which the specified model was originally implemented
215217
Returns:

0 commit comments

Comments
 (0)