Update IModule to AbstractModule with ABC class
This commit is contained in:
parent
1fbca4a652
commit
c47b255924
16
AbstractModule.py
Normal file
16
AbstractModule.py
Normal 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
|
@ -1,8 +0,0 @@
|
|||||||
class IModule(object):
|
|
||||||
"""docstring for Module."""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(IModule, self).__init__()
|
|
||||||
|
|
||||||
def get_command(self):
|
|
||||||
raise NotImplementedError
|
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user