- redefine activate method
- for task introduced open() conext method
This commit is contained in:
@@ -1,15 +1,30 @@
|
||||
import abc
|
||||
from utils.value import AttributeChange
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
class APlant(AttributeChange):
|
||||
def __init__(self):
|
||||
AttributeChange.__init__(self)
|
||||
|
||||
@contextmanager
|
||||
def open(self):
|
||||
try:
|
||||
self.activate(True)
|
||||
yield None
|
||||
finally:
|
||||
self.activate(False)
|
||||
|
||||
return None
|
||||
|
||||
@abc.abstractmethod
|
||||
def activate(self, enable):
|
||||
return None
|
||||
|
||||
@abc.abstractmethod
|
||||
def is_activated(self):
|
||||
return None
|
||||
|
||||
@abc.abstractmethod
|
||||
def process(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user