def _group_by_transition(transition_services: ServicesTable) -> ServicesByTransition: services_by_transition: ServicesByTransition = {} for transition, service, found_on_nodes in transition_services.values(): services_by_transition.setdefault( transition, [], ).append(autochecks.ServiceWithNodes(service, found_on_nodes)) return services_by_transition
def _group_by_transition( transition_services: Iterable[Tuple[str, Service, List[HostName]]]) -> ServicesByTransition: services_by_transition: ServicesByTransition = {} for transition, service, found_on_nodes in transition_services: services_by_transition.setdefault( transition, [], ).append(autochecks.ServiceWithNodes(service, found_on_nodes)) return services_by_transition
def grouped_services() -> discovery.ServicesByTransition: return { "new": [ autochecks.ServiceWithNodes( discovery.Service( CheckPluginName("check_plugin_name"), "New Item 1", "Test Description New Item 1", {}, ), [], ), autochecks.ServiceWithNodes( discovery.Service( CheckPluginName("check_plugin_name"), "New Item 2", "Test Description New Item 2", {}, ), [], ), ], "vanished": [ autochecks.ServiceWithNodes( discovery.Service( CheckPluginName("check_plugin_name"), "Vanished Item 1", "Test Description Vanished Item 1", {}, ), [], ), autochecks.ServiceWithNodes( discovery.Service( CheckPluginName("check_plugin_name"), "Vanished Item 2", "Test Description Vanished Item 2", {}, ), [], ), ], }