Seed the store with a multi-file call chain.
(self)
| 680 | shutil.rmtree(self.tmp_dir, ignore_errors=True) |
| 681 | |
| 682 | def _seed_data(self): |
| 683 | """Seed the store with a multi-file call chain.""" |
| 684 | # File nodes |
| 685 | self.store.upsert_node(NodeInfo( |
| 686 | kind="File", name="app.py", |
| 687 | file_path=str(self.root / "app.py"), |
| 688 | line_start=1, line_end=50, language="python", |
| 689 | )) |
| 690 | self.store.upsert_node(NodeInfo( |
| 691 | kind="File", name="auth.py", |
| 692 | file_path=str(self.root / "auth.py"), |
| 693 | line_start=1, line_end=40, language="python", |
| 694 | )) |
| 695 | self.store.upsert_node(NodeInfo( |
| 696 | kind="File", name="db.py", |
| 697 | file_path=str(self.root / "db.py"), |
| 698 | line_start=1, line_end=30, language="python", |
| 699 | )) |
| 700 | |
| 701 | # Functions forming a call chain: handle_request -> check_auth -> query_db |
| 702 | self.store.upsert_node(NodeInfo( |
| 703 | kind="Function", name="handle_request", |
| 704 | file_path=str(self.root / "app.py"), |
| 705 | line_start=10, line_end=25, language="python", |
| 706 | )) |
| 707 | self.store.upsert_node(NodeInfo( |
| 708 | kind="Function", name="check_auth", |
| 709 | file_path=str(self.root / "auth.py"), |
| 710 | line_start=5, line_end=20, language="python", |
| 711 | )) |
| 712 | self.store.upsert_node(NodeInfo( |
| 713 | kind="Function", name="query_db", |
| 714 | file_path=str(self.root / "db.py"), |
| 715 | line_start=3, line_end=15, language="python", |
| 716 | )) |
| 717 | |
| 718 | # CALLS edges: handle_request -> check_auth -> query_db |
| 719 | app_py = str(self.root / "app.py") |
| 720 | auth_py = str(self.root / "auth.py") |
| 721 | self.store.upsert_edge(EdgeInfo( |
| 722 | kind="CALLS", |
| 723 | source=f"{app_py}::handle_request", |
| 724 | target=f"{auth_py}::check_auth", |
| 725 | file_path=app_py, line=15, |
| 726 | )) |
| 727 | self.store.upsert_edge(EdgeInfo( |
| 728 | kind="CALLS", |
| 729 | source=f"{auth_py}::check_auth", |
| 730 | target=f"{str(self.root / 'db.py')}::query_db", |
| 731 | file_path=auth_py, line=10, |
| 732 | )) |
| 733 | self.store.commit() |
| 734 | |
| 735 | def _build_flows(self): |
| 736 | """Trace and store flows.""" |
no test coverage detected