def _extend_plugin_type_graph(graph: Graph, plugin_type: Type): dependencies = plugin_type.depends_on() # Ensure each plugin type appears in the graph, even if they're isolated. graph.setdefault(plugin_type, set()) for dependency in dependencies: seen_dependency = dependency in graph graph[dependency].add(plugin_type) if not seen_dependency: _extend_plugin_type_graph(graph, dependency)
def _extend_place_graph(graph: Graph, enclosing_place: Place) -> None: enclosed_places = enclosing_place.encloses # Ensure each place appears in the graph, even if they're anonymous. graph.setdefault(enclosing_place, set()) for enclosed_place in enclosed_places: seen_enclosed_place = enclosed_place in graph graph[enclosed_place].add(enclosing_place) if not seen_enclosed_place: _extend_place_graph(graph, enclosed_place)
def _extend_extension_type_graph(graph: Graph, extension_type: Type[Extension]) -> None: dependencies = extension_type.depends_on() # Ensure each extension type appears in the graph, even if they're isolated. graph.setdefault(extension_type, set()) for dependency in dependencies: seen_dependency = dependency in graph graph[dependency].add(extension_type) if not seen_dependency: _extend_extension_type_graph(graph, dependency)