Skip to content

Commit

Permalink
Change type returned for board command class factory, it's always
Browse files Browse the repository at this point in the history
hardware
  • Loading branch information
hkzlab committed Aug 12, 2024
1 parent ce89fd3 commit c30b258
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dupicolib/board_command_class_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from typing import final, Dict, Type
from collections import defaultdict

from dupicolib.board_commands_interface import BoardCommandsInterface
from dupicolib.hardware_board_commands import HardwareBoardCommands
from dupicolib.board_interfaces.m3_board_commands import M3BoardCommands
from dupicolib.board_fw_version import FWVersionDict, FWVersionKeys
@final
class BoardCommandClassFactory:
_COMMAND_CLASS_MAP: Dict[int, Dict[str, Type[BoardCommandsInterface]]] = {
_COMMAND_CLASS_MAP: Dict[int, Dict[str, Type[HardwareBoardCommands]]] = {
3: defaultdict(lambda: M3BoardCommands) # We have only one set of commands for M 3 boards, for now
}

@classmethod
def get_command_class(cls, model: int, version: FWVersionDict) -> Type[BoardCommandsInterface]:
def get_command_class(cls, model: int, version: FWVersionDict) -> Type[HardwareBoardCommands]:
"""Return the command class specific for this combination of model and firmware version
Args:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_board_command_class_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sys.path.insert(0, '.') # Make VSCode happy...

from dupicolib.board_commands_interface import BoardCommandsInterface
from dupicolib.board_fw_version import FWVersionDict, FwVersionTools, FWVersionKeys
from dupicolib.board_fw_version import FWVersionDict, FwVersionTools
from dupicolib.board_command_class_factory import BoardCommandClassFactory
from dupicolib.board_interfaces.m3_board_commands import M3BoardCommands
import pytest
Expand Down

0 comments on commit c30b258

Please sign in to comment.