Map section_id -> list of nodes belonging to its communities.
(sections: list, comm_idx: dict)
| 907 | |
| 908 | |
| 909 | def build_section_node_map(sections: list, comm_idx: dict) -> dict: |
| 910 | """Map section_id -> list of nodes belonging to its communities.""" |
| 911 | section_nodes = {} |
| 912 | for sec in sections: |
| 913 | sid = sec["id"] |
| 914 | if sid == "overview": |
| 915 | section_nodes[sid] = [] |
| 916 | continue |
| 917 | nodes = [] |
| 918 | for cid in sec.get("communities", []): |
| 919 | nodes.extend(comm_idx.get(str(cid), [])) |
| 920 | section_nodes[sid] = nodes |
| 921 | return section_nodes |
| 922 | |
| 923 | |
| 924 | def node_in_section(node_id: str, section_node_ids: set) -> bool: |
no test coverage detected