Parse one file in a worker process. Returns ``(rel_path, nodes, edges, error_or_none, file_hash)``. Must be a module-level function so ``ProcessPoolExecutor`` can serialise it across processes.
(
args: tuple[str, str],
)
| 797 | |
| 798 | |
| 799 | def _parse_single_file( |
| 800 | args: tuple[str, str], |
| 801 | ) -> tuple[str, list, list, str | None, str]: |
| 802 | """Parse one file in a worker process. |
| 803 | |
| 804 | Returns ``(rel_path, nodes, edges, error_or_none, file_hash)``. |
| 805 | Must be a module-level function so ``ProcessPoolExecutor`` can |
| 806 | serialise it across processes. |
| 807 | """ |
| 808 | rel_path, repo_root_str = args |
| 809 | abs_path = Path(repo_root_str) / rel_path |
| 810 | try: |
| 811 | raw = abs_path.read_bytes() |
| 812 | fhash = hashlib.sha256(raw).hexdigest() |
| 813 | parser = CodeParser(Path(repo_root_str)) |
| 814 | nodes, edges = parser.parse_bytes(abs_path, raw) |
| 815 | return (rel_path, nodes, edges, None, fhash) |
| 816 | except Exception as e: |
| 817 | return (rel_path, [], [], str(e), "") |
| 818 | |
| 819 | |
| 820 | def full_build( |