Пример #1
0
    def execute_plan_command(self, message: tuple):
        """Executes commands related to plans.

        This method is intended to execute all commands related to plans and
        avoiding having several new message types specific to plans.

        Args:
            message: A tuple specifying the command and args.
        """
        command_name, args = message
        try:
            return self._plan_command_router[command_name](*args)
        except KeyError:
            raise PlanCommandUnknownError(command_name)
Пример #2
0
    def execute_plan_command(self, msg: PlanCommandMessage):
        """Executes commands related to plans.

        This method is intended to execute all commands related to plans and
        avoiding having several new message types specific to plans.

        Args:
            msg: A PlanCommandMessage specifying the command and args.
        """
        command_name = msg.command_name
        args_ = msg.args

        try:
            command = self.plan_routing_table[command_name]
        except KeyError:
            raise PlanCommandUnknownError(command_name)

        return command(*args_)