File size: 427 Bytes
dbe7b05
 
 
d5436e0
dbe7b05
 
 
 
 
 
 
 
 
 
d5436e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)

    @abstractmethod
    def execute_command(self):
        """Method of processing command execution logic"""