from typing import Optional | |
from abc import ABC, abstractmethod | |
class CommandHandler(ABC): | |
def __init__(self, successor: Optional["CommandHandler"] = None): | |
self.successor = successor | |
def handle_command(self, command): | |
if self.successor: | |
self.successor.handle_command(command) | |
def execute_command(self): | |
"""Method of processing command execution logic""" | |