From ae666d3dd36b057166b9aa2889f50b15ae52d10a Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 9 Aug 2022 11:50:31 +0530 Subject: [PATCH] Common: Change IEventQueue and PyPubSubEventQueue's subscribe_tags() -> subscribe_tag() --- monkey/common/event_queue/i_event_queue.py | 6 +++--- monkey/common/event_queue/pypubsub_event_queue.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/monkey/common/event_queue/i_event_queue.py b/monkey/common/event_queue/i_event_queue.py index 06a99b163..47788f263 100644 --- a/monkey/common/event_queue/i_event_queue.py +++ b/monkey/common/event_queue/i_event_queue.py @@ -33,11 +33,11 @@ class IEventQueue(ABC): pass @abstractstaticmethod - def subscribe_tags(tags: Sequence[str], subscriber: Callable[[AbstractEvent], None]): + def subscribe_tag(tag: str, subscriber: Callable[[AbstractEvent], None]): """ - Subscribes a subscriber to all specified event tags + Subscribes a subscriber to the specified event tag - :param tags: Event tags to which the subscriber should subscribe + :param tag: Event tag to which the subscriber should subscribe :param subscriber: Callable that should subscribe to events """ diff --git a/monkey/common/event_queue/pypubsub_event_queue.py b/monkey/common/event_queue/pypubsub_event_queue.py index e2e6e8765..711187577 100644 --- a/monkey/common/event_queue/pypubsub_event_queue.py +++ b/monkey/common/event_queue/pypubsub_event_queue.py @@ -22,9 +22,8 @@ class PyPubSubEventQueue(IEventQueue): pub.subscribe(listener=subscriber, topicName=event_type_name) @staticmethod - def subscribe_tags(tags: Sequence[str], subscriber: Callable[[AbstractEvent], None]): - for tag in tags: - pub.subscribe(listener=subscriber, topicName=tag) + def subscribe_tag(tag: str, subscriber: Callable[[AbstractEvent], None]): + pub.subscribe(listener=subscriber, topicName=tag) @staticmethod def publish(event: AbstractEvent, data: Any = None):