From c7d7231959ab815ae08d52329cdcb90d770ad1ea Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 30 Oct 2019 11:08:26 +0100 Subject: [PATCH] add ABC --- boswatch/inputSource/inputBase.py | 6 +++--- module/moduleBase.py | 3 ++- plugin/pluginBase.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/boswatch/inputSource/inputBase.py b/boswatch/inputSource/inputBase.py index f8d5588..0a62410 100644 --- a/boswatch/inputSource/inputBase.py +++ b/boswatch/inputSource/inputBase.py @@ -17,11 +17,12 @@ import time import logging import threading +from abc import ABC, abstractmethod logging.debug("- %s loaded", __name__) -class InputBase: +class InputBase(ABC): """!Base class for handling inout sources""" def __init__(self, inputQueue, inputConfig, decoderConfig): @@ -45,10 +46,9 @@ class InputBase: self._inputThread.daemon = True self._inputThread.start() + @abstractmethod def _runThread(self, dataQueue, sdrConfig, decoderConfig): """!Thread routine of the input source has to be inherit""" - logging.fatal("input thread routine not implemented") - exit(1) def shutdown(self): """!Stop the input source thread""" diff --git a/module/moduleBase.py b/module/moduleBase.py index 7682db6..1d9eafc 100644 --- a/module/moduleBase.py +++ b/module/moduleBase.py @@ -16,13 +16,14 @@ """ import logging import time +from abc import ABC, abstractmethod from boswatch import wildcard logging.debug("- %s loaded", __name__) -class ModuleBase: +class ModuleBase(ABC): """!Main module class""" _modulesActive = [] diff --git a/plugin/pluginBase.py b/plugin/pluginBase.py index 12ad6ea..15042b7 100644 --- a/plugin/pluginBase.py +++ b/plugin/pluginBase.py @@ -16,13 +16,14 @@ """ import logging import time +from abc import ABC, abstractmethod from boswatch import wildcard logging.debug("- %s loaded", __name__) -class PluginBase: +class PluginBase(ABC): """!Main plugin class""" _pluginsActive = []