From 1fbe9e5ad4ca1ec88ba155f7ea6f3e771ca84f12 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Mon, 8 Aug 2022 12:07:45 +0530 Subject: [PATCH] Common: Make methods static in PypubsubEventQueue --- monkey/common/event_queue/pypubsub_event_queue.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/monkey/common/event_queue/pypubsub_event_queue.py b/monkey/common/event_queue/pypubsub_event_queue.py index ca8c2f7a1..607c74764 100644 --- a/monkey/common/event_queue/pypubsub_event_queue.py +++ b/monkey/common/event_queue/pypubsub_event_queue.py @@ -17,15 +17,18 @@ class PypubsubEventQueue(IEventQueue): for event_type in types: PypubsubEventQueue._subscribe_type(event_type, subscriber) + @staticmethod def _subscribe_type(event_type: AbstractEvent, subscriber: Callable[..., Any]): # pypubsub.pub.subscribe needs a string as the topic/event name event_type_name = event_type.__name__ pub.subscribe(listener=subscriber, topicName=event_type_name) - def subscribe_tags(self, tags: Sequence[str], subscriber: Callable[..., Any]): + @staticmethod + def subscribe_tags(tags: Sequence[str], subscriber: Callable[..., Any]): for tag in tags: PypubsubEventQueue._subscribe_tag(tag, subscriber) + @staticmethod def _subscribe_tag(tag: str, subscriber: Callable[..., Any]): pub.subscribe(listener=subscriber, topicName=tag)