from abc import ABC from tfw.components import FSMAware from tfw.networking import Scope from .event_handler import EventHandler class FSMAwareEventHandler(EventHandler, FSMAware, ABC): # pylint: disable=abstract-method """ Abstract base class for EventHandlers which automatically keep track of the state of the TFW FSM. """ def __init__(self, key, scope=Scope.ZMQ): EventHandler.__init__(self, key, scope=scope) FSMAware.__init__(self) self.subscribe('fsm_update') def dispatch_handling(self, message): if not self.refresh_on_fsm_update(message): super().dispatch_handling(message)