(path: Path, rows: list[dict[str, Any]], fieldnames: list[str] | None = None)
| 661 | |
| 662 | |
| 663 | def write_tsv(path: Path, rows: list[dict[str, Any]], fieldnames: list[str] | None = None) -> None: |
| 664 | path.parent.mkdir(parents=True, exist_ok=True) |
| 665 | if fieldnames is None: |
| 666 | keys: list[str] = [] |
| 667 | for row in rows: |
| 668 | for key in row: |
| 669 | if key not in keys: |
| 670 | keys.append(key) |
| 671 | fieldnames = keys |
| 672 | with path.open("w", newline="", encoding="utf-8") as handle: |
| 673 | writer = csv.DictWriter(handle, fieldnames=fieldnames, delimiter="\t") |
| 674 | writer.writeheader() |
| 675 | writer.writerows(rows) |
| 676 | |
| 677 | |
| 678 | def path_has_synthetic_marker(path: Path | None) -> bool: |
no outgoing calls
no test coverage detected