From d516fd92dd93ae02a6007a8680780d2401a46cb8 Mon Sep 17 00:00:00 2001 From: Johannes Velde <17915008+veldhaenchen@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:35:51 +0100 Subject: [PATCH] feat(notifiers): :truck: move notifiers to own package and import it easier --- flathunter/heartbeat.py | 5 +---- flathunter/notifiers/__init__.py | 5 +++++ flathunter/{ => notifiers}/sender_apprise.py | 0 flathunter/{ => notifiers}/sender_mattermost.py | 0 flathunter/{ => notifiers}/sender_slack.py | 0 flathunter/{ => notifiers}/sender_telegram.py | 0 flathunter/processor.py | 5 +---- test/sender/test_apprise.py | 2 +- test/sender/test_mattermost.py | 2 +- test/sender/test_slack.py | 2 +- test/sender/test_telegram.py | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 flathunter/notifiers/__init__.py rename flathunter/{ => notifiers}/sender_apprise.py (100%) rename flathunter/{ => notifiers}/sender_mattermost.py (100%) rename flathunter/{ => notifiers}/sender_slack.py (100%) rename flathunter/{ => notifiers}/sender_telegram.py (100%) diff --git a/flathunter/heartbeat.py b/flathunter/heartbeat.py index dc5a768d..8a5955e6 100644 --- a/flathunter/heartbeat.py +++ b/flathunter/heartbeat.py @@ -4,10 +4,7 @@ from flathunter.abstract_notifier import Notifier from flathunter.config import YamlConfig from flathunter.logging import logger -from flathunter.sender_apprise import SenderApprise -from flathunter.sender_mattermost import SenderMattermost -from flathunter.sender_slack import SenderSlack -from flathunter.sender_telegram import SenderTelegram +from flathunter.notifiers import SenderApprise, SenderMattermost, SenderTelegram, SenderSlack from flathunter.exceptions import HeartbeatException diff --git a/flathunter/notifiers/__init__.py b/flathunter/notifiers/__init__.py new file mode 100644 index 00000000..81dd2825 --- /dev/null +++ b/flathunter/notifiers/__init__.py @@ -0,0 +1,5 @@ +"""Package for notifiers.""" +from .sender_apprise import SenderApprise +from .sender_mattermost import SenderMattermost +from .sender_slack import SenderSlack +from .sender_telegram import SenderTelegram diff --git a/flathunter/sender_apprise.py b/flathunter/notifiers/sender_apprise.py similarity index 100% rename from flathunter/sender_apprise.py rename to flathunter/notifiers/sender_apprise.py diff --git a/flathunter/sender_mattermost.py b/flathunter/notifiers/sender_mattermost.py similarity index 100% rename from flathunter/sender_mattermost.py rename to flathunter/notifiers/sender_mattermost.py diff --git a/flathunter/sender_slack.py b/flathunter/notifiers/sender_slack.py similarity index 100% rename from flathunter/sender_slack.py rename to flathunter/notifiers/sender_slack.py diff --git a/flathunter/sender_telegram.py b/flathunter/notifiers/sender_telegram.py similarity index 100% rename from flathunter/sender_telegram.py rename to flathunter/notifiers/sender_telegram.py diff --git a/flathunter/processor.py b/flathunter/processor.py index 7cdc68cd..6c24cdd6 100644 --- a/flathunter/processor.py +++ b/flathunter/processor.py @@ -6,10 +6,7 @@ from flathunter.default_processors import Filter from flathunter.default_processors import LambdaProcessor from flathunter.default_processors import CrawlExposeDetails -from flathunter.sender_mattermost import SenderMattermost -from flathunter.sender_apprise import SenderApprise -from flathunter.sender_telegram import SenderTelegram -from flathunter.sender_slack import SenderSlack +from flathunter.notifiers import SenderMattermost, SenderTelegram, SenderApprise, SenderSlack from flathunter.gmaps_duration_processor import GMapsDurationProcessor from flathunter.idmaintainer import SaveAllExposesProcessor from flathunter.abstract_processor import Processor diff --git a/test/sender/test_apprise.py b/test/sender/test_apprise.py index cd25f33a..8180ac23 100644 --- a/test/sender/test_apprise.py +++ b/test/sender/test_apprise.py @@ -2,7 +2,7 @@ import requests_mock -from flathunter.sender_apprise import SenderApprise +from flathunter.notifiers import SenderApprise class SenderAppriseTest(unittest.TestCase): diff --git a/test/sender/test_mattermost.py b/test/sender/test_mattermost.py index 3ae16c92..275fa052 100644 --- a/test/sender/test_mattermost.py +++ b/test/sender/test_mattermost.py @@ -2,7 +2,7 @@ import requests_mock -from flathunter.sender_mattermost import SenderMattermost +from flathunter.notifiers import SenderMattermost from flathunter.config import YamlConfig diff --git a/test/sender/test_slack.py b/test/sender/test_slack.py index d46491de..b3c71d0f 100644 --- a/test/sender/test_slack.py +++ b/test/sender/test_slack.py @@ -2,7 +2,7 @@ import requests_mock -from flathunter.sender_slack import SenderSlack +from flathunter.notifiers import SenderSlack from flathunter.config import YamlConfig diff --git a/test/sender/test_telegram.py b/test/sender/test_telegram.py index b2bc100f..88a50474 100644 --- a/test/sender/test_telegram.py +++ b/test/sender/test_telegram.py @@ -6,7 +6,7 @@ from test.utils.request_matcher import RequestCounter from test.utils.config import StringConfig -from flathunter.sender_telegram import SenderTelegram +from flathunter.notifiers import SenderTelegram class SenderTelegramTest(unittest.TestCase):