MCPcopy
hub / github.com/marimo-team/marimo / write

Method write

marimo/_session/notebook/storage.py:121–132  ·  view source on GitHub ↗

Write file to filesystem.

(self, path: Path, content: str)

Source from the content-addressed store, hash-verified

119 ) from err
120
121 def write(self, path: Path, content: str) -> None:
122 """Write file to filesystem."""
123 # Ensure path is a Path object
124 path = _ensure_path(path)
125 self.ensure_parent_dirs(path)
126 try:
127 path.write_text(content, encoding="utf-8")
128 except Exception as err:
129 raise HTTPException(
130 status_code=HTTPStatus.SERVER_ERROR,
131 detail=f"Failed to save file {path}",
132 ) from err
133
134 def exists(self, path: Path) -> bool:
135 """Check if path exists on filesystem."""

Callers 3

test_write_successMethod · 0.95

Calls 4

ensure_parent_dirsMethod · 0.95
HTTPExceptionClass · 0.90
_ensure_pathFunction · 0.85
write_textMethod · 0.45

Tested by 3

test_write_successMethod · 0.76