Skip to content

Commit 69e3f6d

Browse files
committed
Clean up typing of PluginManager.register_action function call using ActionBase
1 parent 1409199 commit 69e3f6d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

streamdeck/manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from logging import getLogger
55
from typing import TYPE_CHECKING
66

7-
from streamdeck.actions import ActionRegistry
7+
from streamdeck.actions import Action, ActionBase, ActionRegistry
88
from streamdeck.command_sender import StreamDeckCommandSender
99
from streamdeck.models.events import ContextualEventMixin, event_adapter
1010
from streamdeck.types import (
@@ -21,7 +21,6 @@
2121
if TYPE_CHECKING:
2222
from typing import Any, Literal
2323

24-
from streamdeck.actions import Action
2524
from streamdeck.models.events import EventBase
2625

2726

@@ -62,14 +61,14 @@ def __init__(
6261

6362
self._registry = ActionRegistry()
6463

65-
def register_action(self, action: Action) -> None:
64+
def register_action(self, action: ActionBase) -> None:
6665
"""Register an action with the PluginManager, and configure its logger.
6766
6867
Args:
6968
action (Action): The action to register.
7069
"""
7170
# First, configure a logger for the action, giving it the last part of its uuid as name (if it has one).
72-
action_component_name = action.uuid.split(".")[-1] if hasattr(action, "uuid") else "global"
71+
action_component_name = action.uuid.split(".")[-1] if isinstance(action, Action) else "global"
7372
configure_streamdeck_logger(name=action_component_name, plugin_uuid=self.uuid)
7473

7574
self._registry.register(action)

0 commit comments

Comments
 (0)