mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 18:11:56 +00:00
Use power of LazyInitialise to replace CallbackMixin.__init__()
This commit is contained in:
parent
cebacb15e6
commit
6f3db18146
@ -36,7 +36,6 @@ class HistoryMonitor(CallbackMixin, ObserverMixin, ABC):
|
||||
See examples below.
|
||||
"""
|
||||
def __init__(self, histfile):
|
||||
CallbackMixin.__init__(self)
|
||||
self.histfile = histfile
|
||||
self._history = []
|
||||
self._last_length = len(self._history)
|
||||
|
@ -19,7 +19,6 @@ class FSMBase(CallbackMixin):
|
||||
states, transitions = [], []
|
||||
|
||||
def __init__(self, initial: str = None, accepted_states: List[str] = None):
|
||||
CallbackMixin.__init__(self)
|
||||
self.accepted_states = accepted_states or [self.states[-1]]
|
||||
self.machine = Machine(model=self,
|
||||
states=self.states,
|
||||
|
@ -3,10 +3,13 @@
|
||||
|
||||
from functools import partial
|
||||
|
||||
from tfw.decorators import LazyInitialise
|
||||
|
||||
|
||||
class CallbackMixin:
|
||||
def __init__(self):
|
||||
self._callbacks = []
|
||||
@LazyInitialise
|
||||
def _callbacks(self):
|
||||
return []
|
||||
|
||||
def subscribe_callback(self, callback, *args, **kwargs):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user