Skip to content

Commit b96c90f

Browse files
committed
Clean up some PluginManager method names and references
1 parent 73a070c commit b96c90f

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

streamdeck/manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
self._event_listener_manager = EventListenerManager()
7474
self._event_adapter = EventAdapter()
7575

76-
def _ensure_action_has_valid_events(self, action: SupportsEventHandlers) -> None:
76+
def _ensure_catalog_has_valid_events(self, action: SupportsEventHandlers) -> None:
7777
"""Ensure that the event handler catalog's registered events are valid.
7878
7979
Args:
@@ -85,14 +85,14 @@ def _ensure_action_has_valid_events(self, action: SupportsEventHandlers) -> None
8585
logger.error(msg)
8686
raise KeyError(msg)
8787

88-
def register_handler(self, action: ActionBase) -> None:
88+
def register_action(self, action: ActionBase) -> None:
8989
"""Register an action with the PluginManager, and configure its logger.
9090
9191
Args:
9292
action (Action): The action to register.
9393
"""
9494
# First, validate that the action's registered events are valid.
95-
self._ensure_action_has_valid_events(action)
95+
self._ensure_catalog_has_valid_events(action)
9696

9797
# Next, configure a logger for the action, giving it the last part of its uuid as name (if it has one).
9898
action_component_name = action.uuid.split(".")[-1] if isinstance(action, Action) else "global"

tests/plugin_manager/test_command_sender_binding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_run_manager_events_handled_with_correct_params(
108108
mock_event_handler_without_cmd_sender: Mock = create_autospec(create_event_handler(include_command_sender_param=False), spec_set=True)
109109
action.on("keyDown")(mock_event_handler_without_cmd_sender)
110110

111-
plugin_manager.register_handler(action)
111+
plugin_manager.register_action(action)
112112

113113
# Run the PluginManager and let it process the fake event messages generated by the mocked EventListenerManager.
114114
# Since the EventListenerManager.event_stream() method is mocked to return a finite list of fake event messages, it will stop after yielding all of them rather than running indefinitely.

tests/plugin_manager/test_plugin_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_plugin_manager_register_action(plugin_manager: PluginManager) -> None:
4646
assert len(plugin_manager._handlers_registry._plugin_actions) == 0
4747

4848
action = Action("my-fake-action-uuid")
49-
plugin_manager.register_handler(action)
49+
plugin_manager.register_action(action)
5050

5151
assert len(plugin_manager._handlers_registry._plugin_actions) == 1
5252
assert plugin_manager._handlers_registry._plugin_actions[0] == action

0 commit comments

Comments
 (0)