WriteScript
Base classes
| Name |
Children |
Inherits |
Writer datacook.engine.formats
|
|
|
⋔ Inheritance diagram
graph TD
1234598823["formats.WriteScript"]
1471215792["formats.Writer"]
2751680898["builtins.object"]
1471215792 --> 1234598823
2751680898 --> 1471215792
🛈 DocStrings
Bases: Writer
The generated Python script for the node (or the whole tree).
Source code in src/datacook/engine/formats.py
| class WriteScript(Writer):
"""The generated Python script for the node (or the whole tree)."""
id = "script"
title = _("Python script")
extensions = (".py",)
class Params(BaseParams):
whole_tree: bool = Field(False, title=N_("Whole tree"))
@classmethod
def write(cls, session: Session, node_id: str, path: str | pathlib.Path, params: Any) -> None:
code = session.code(None if params.whole_tree else [node_id])
pathlib.Path(path).write_text(code, encoding="utf-8")
|
:fa-brands-github: Show source on GitHub