from typing import Any from app.algorithms.valve_isolation.topology_search import ( AccidentElementType, valve_isolation_analysis, ) from app.native.wndb.gis.network_views import get_valve_isolation_topology def analyze_valve_isolation( network: str, accident_element: str | list[str], disabled_valves: list[str] | None = None, accident_element_type: AccidentElementType = "auto", ) -> dict[str, Any]: link_entries, source_nodes, closed_links = get_valve_isolation_topology(network) return valve_isolation_analysis( link_entries, accident_element, disabled_valves, accident_element_type=accident_element_type, water_source_nodes=source_nodes, closed_links=closed_links, )