Update IModule to AbstractModule with ABC class

This commit is contained in:
Marcel Schwarz 2019-12-16 22:51:06 +01:00
parent 1fbca4a652
commit c47b255924
3 changed files with 21 additions and 10 deletions

16
AbstractModule.py Normal file
View File

@ -0,0 +1,16 @@
from abc import ABC, abstractmethod
class AbstractModule(ABC):
"""docstring for Module."""
def __init__(self):
super(AbstractModule, self).__init__()
@abstractmethod
def get_command(self):
pass
@abstractmethod
def run(self):
pass

View File

@ -1,8 +0,0 @@
class IModule(object):
"""docstring for Module."""
def __init__(self):
super(IModule, self).__init__()
def get_command(self):
raise NotImplementedError

View File

@ -1,12 +1,15 @@
from IModule import IModule from AbstractModule import AbstractModule
class SampleModule(IModule): class SampleModule(AbstractModule):
"""docstring for SampleModule.""" """docstring for SampleModule."""
def __init__(self): def __init__(self):
super(SampleModule, self).__init__() super(SampleModule, self).__init__()
def run(self):
pass
def get_command(self): def get_command(self):
return [ return [
"command 1", "command 1",