Seed the store with two clusters of related nodes.
(self)
| 887 | shutil.rmtree(self.tmp_dir, ignore_errors=True) |
| 888 | |
| 889 | def _seed_data(self): |
| 890 | """Seed the store with two clusters of related nodes.""" |
| 891 | # Cluster 1: auth module |
| 892 | auth_py = str(self.root / "auth.py") |
| 893 | self.store.upsert_node(NodeInfo( |
| 894 | kind="File", name="auth.py", |
| 895 | file_path=auth_py, |
| 896 | line_start=1, line_end=60, language="python", |
| 897 | )) |
| 898 | self.store.upsert_node(NodeInfo( |
| 899 | kind="Class", name="AuthService", |
| 900 | file_path=auth_py, |
| 901 | line_start=5, line_end=50, language="python", |
| 902 | )) |
| 903 | self.store.upsert_node(NodeInfo( |
| 904 | kind="Function", name="login", |
| 905 | file_path=auth_py, |
| 906 | line_start=10, line_end=25, language="python", |
| 907 | parent_name="AuthService", |
| 908 | )) |
| 909 | self.store.upsert_node(NodeInfo( |
| 910 | kind="Function", name="logout", |
| 911 | file_path=auth_py, |
| 912 | line_start=30, line_end=45, language="python", |
| 913 | parent_name="AuthService", |
| 914 | )) |
| 915 | |
| 916 | # Cluster 2: db module |
| 917 | db_py = str(self.root / "db.py") |
| 918 | self.store.upsert_node(NodeInfo( |
| 919 | kind="File", name="db.py", |
| 920 | file_path=db_py, |
| 921 | line_start=1, line_end=50, language="python", |
| 922 | )) |
| 923 | self.store.upsert_node(NodeInfo( |
| 924 | kind="Function", name="query", |
| 925 | file_path=db_py, |
| 926 | line_start=5, line_end=20, language="python", |
| 927 | )) |
| 928 | self.store.upsert_node(NodeInfo( |
| 929 | kind="Function", name="connect", |
| 930 | file_path=db_py, |
| 931 | line_start=25, line_end=40, language="python", |
| 932 | )) |
| 933 | |
| 934 | # Intra-cluster edges |
| 935 | self.store.upsert_edge(EdgeInfo( |
| 936 | kind="CONTAINS", source=auth_py, |
| 937 | target=f"{auth_py}::AuthService", file_path=auth_py, |
| 938 | )) |
| 939 | self.store.upsert_edge(EdgeInfo( |
| 940 | kind="CONTAINS", source=f"{auth_py}::AuthService", |
| 941 | target=f"{auth_py}::AuthService.login", file_path=auth_py, |
| 942 | )) |
| 943 | self.store.upsert_edge(EdgeInfo( |
| 944 | kind="CONTAINS", source=f"{auth_py}::AuthService", |
| 945 | target=f"{auth_py}::AuthService.logout", file_path=auth_py, |
| 946 | )) |
no test coverage detected