From 2bf42162eff08183f1f5093c382ffdb3b903bf69 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 2 Mar 2024 16:59:23 +0300 Subject: [PATCH] refactor plugins.py --- pddnsc/plugins.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pddnsc/plugins.py b/pddnsc/plugins.py index 15db193..86466d0 100644 --- a/pddnsc/plugins.py +++ b/pddnsc/plugins.py @@ -3,23 +3,28 @@ from httpx import AsyncHTTPTransport from .base import BaseSourceProvider, BaseFilterProvider, BaseOutputProvider from . import sources -from . import outputs from . import filters +from . import outputs + + +def unused(): + """Чтобы убрать предупреждение о неиспользуемых импортах""" + return sources, filters, outputs def use_plugins(config: dict, ipv4t: AsyncHTTPTransport, ipv6t: AsyncHTTPTransport): """Регистрация всех плагинов указаных в конфигурации""" - for source_name in config["sources"]: + for source_name in config.get("sources", []): BaseSourceProvider.register_provider( source_name, config["sources"][source_name], ipv4t, ipv6t ) - for filter_name in config["filters"]: + for filter_name in config.get("filters", []): BaseFilterProvider.register_provider( filter_name, config["filters"][filter_name], ipv4t, ipv6t ) - for output_name in config["outputs"]: + for output_name in config.get("outputs", []): BaseOutputProvider.register_provider( output_name, config["outputs"][output_name], ipv4t, ipv6t )