diff --git a/monkey/common/event_queue/__init__.py b/monkey/common/event_queue/__init__.py index 18412d2a7..dabc9527e 100644 --- a/monkey/common/event_queue/__init__.py +++ b/monkey/common/event_queue/__init__.py @@ -1,4 +1,4 @@ from .types import AgentEventSubscriber from .i_agent_event_queue import IAgentEventQueue -from .i_island_event_queue import IIslandEventQueue, IslandEventTopics +from .i_island_event_queue import IIslandEventQueue, IslandEventTopic from .pypubsub_agent_event_queue import PyPubSubAgentEventQueue diff --git a/monkey/common/event_queue/i_island_event_queue.py b/monkey/common/event_queue/i_island_event_queue.py index 8066b1385..a5614c37f 100644 --- a/monkey/common/event_queue/i_island_event_queue.py +++ b/monkey/common/event_queue/i_island_event_queue.py @@ -3,7 +3,7 @@ from enum import Enum from typing import Any, Callable -class IslandEventTopics(Enum): +class IslandEventTopic(Enum): AGENT_CONNECTED = "agent_connected" CLEAR_SIMULATION_DATA = "clear_simulation_data" RESET_AGENT_CONFIGURATION = "reset_agent_configuration" @@ -15,7 +15,7 @@ class IIslandEventQueue(ABC): """ @abstractmethod - def subscribe(self, topic: IslandEventTopics, subscriber: Callable[..., None]): + def subscribe(self, topic: IslandEventTopic, subscriber: Callable[..., None]): """ Subscribes a subscriber to the specified event topic @@ -26,7 +26,7 @@ class IIslandEventQueue(ABC): pass @abstractmethod - def publish(self, topic: IslandEventTopics, event_data: Any = None): + def publish(self, topic: IslandEventTopic, event_data: Any = None): """ Publishes an event topic with the given data diff --git a/monkey/common/event_queue/pypubsub_island_event_queue.py b/monkey/common/event_queue/pypubsub_island_event_queue.py index ba6ef3af4..25be20633 100644 --- a/monkey/common/event_queue/pypubsub_island_event_queue.py +++ b/monkey/common/event_queue/pypubsub_island_event_queue.py @@ -3,7 +3,7 @@ from typing import Any, Callable from pubsub.core import Publisher -from . import IIslandEventQueue, IslandEventTopics +from . import IIslandEventQueue, IslandEventTopic logger = logging.getLogger(__name__) @@ -13,7 +13,7 @@ class PyPubSubIslandEventQueue(IIslandEventQueue): self._pypubsub_publisher = pypubsub_publisher self._refs = [] - def subscribe(self, topic: IslandEventTopics, subscriber: Callable[..., None]): + def subscribe(self, topic: IslandEventTopic, subscriber: Callable[..., None]): topic_value = topic.value # needs to be a string for pypubsub try: subscriber_name = subscriber.__name__ @@ -52,7 +52,7 @@ class PyPubSubIslandEventQueue(IIslandEventQueue): # scope. Adding subscribers to self._refs prevents them from ever going out of scope. self._refs.append(subscriber) - def publish(self, topic: IslandEventTopics, event_data: Any = None): + def publish(self, topic: IslandEventTopic, event_data: Any = None): topic_value = topic.value # needs to be a string for pypubsub logger.debug(f"Publishing {topic_value} event")