def _section(name: str, parsed_section_name: str, supersedes: Set[str]) -> SectionPlugin: section = trivial_section_factory(SectionName(name)) return section._replace( parsed_section_name=ParsedSectionName(parsed_section_name), supersedes={SectionName(n) for n in supersedes}, )
def _test_section( *, section_name: str, parsed_section_name: str, parse_function: Callable, supersedes: Iterable[str], ) -> section_plugins.AgentSectionPlugin: return section_plugins.trivial_section_factory(SectionName(section_name))._replace( parsed_section_name=ParsedSectionName(parsed_section_name), parse_function=parse_function, supersedes={SectionName(n) for n in supersedes}, )
def get_section_plugin(section_name: SectionName) -> SectionPlugin: return (registered_agent_sections.get(section_name) or registered_snmp_sections.get(section_name) or trivial_section_factory(section_name))
def _section(name: str, parse_function: Callable) -> AgentSectionPlugin: """create a simple section for testing""" section = trivial_section_factory(SectionName(name)) return section._replace(parse_function=parse_function)