from abc import ABC, abstractmethod from behavioral.state.context import Context class State(ABC): """ The base State class declares methods that all Concrete State should implement and also provides a backreference to the Context object, associated with the State. This backreference can be used by States to transition the Context to another State. """ @property def context(self) -> Context: return self._context @context.setter def context(self, context: Context) -> None: self._context = context @abstractmethod def handle1(self) -> None: pass @abstractmethod def handle2(self) -> None: pass