- redefine activate method

- for task introduced open() conext method
This commit is contained in:
jens
2020-12-18 15:58:02 +01:00
parent a3510ffe8f
commit 4e508c86c5
9 changed files with 85 additions and 62 deletions
+11
View File
@@ -1,5 +1,6 @@
import abc
from utils.value import AttributeChange
from contextlib import contextmanager
class AHeater(AttributeChange):
@@ -14,6 +15,16 @@ class AHeater(AttributeChange):
def get_power_max(self):
pass
@contextmanager
def open(self):
try:
self.activate(True)
yield None
finally:
self.activate(False)
return None
@abc.abstractmethod
def activate(self, enable):
return None