(path: str | pathlib.Path, table_def: str, **kwargs)
| 779 | |
| 780 | |
| 781 | def write_csv(path: str | pathlib.Path, table_def: str, **kwargs): |
| 782 | df = _markdown_to_pandas(table_def) |
| 783 | with tempfile.NamedTemporaryFile(mode="w+", delete=False) as f: |
| 784 | tmp_path = f.name |
| 785 | df.to_csv(tmp_path, encoding="utf-8", **kwargs) |
| 786 | # Move is atomic in POSIX filesystems, that makes the whole write atomic as a result |
| 787 | os.replace(tmp_path, path) |
| 788 | |
| 789 | |
| 790 | def write_lines(path: str | pathlib.Path, data: str | list[str]): |