From 32efa0f0f249a3115bdedc14da26aa4ec6fd3b6b Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 10 Aug 2022 13:27:55 +0530 Subject: [PATCH] Common: Don't pass 'data' argument when publishing in PyPubSubEventQueue --- monkey/common/event_queue/pypubsub_event_queue.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/monkey/common/event_queue/pypubsub_event_queue.py b/monkey/common/event_queue/pypubsub_event_queue.py index b28bea802..82bdc9567 100644 --- a/monkey/common/event_queue/pypubsub_event_queue.py +++ b/monkey/common/event_queue/pypubsub_event_queue.py @@ -1,4 +1,4 @@ -from typing import Any, Callable +from typing import Callable from common.events import AbstractEvent @@ -31,16 +31,14 @@ class PyPubSubEventQueue(IEventQueue): def subscribe_tag(self, tag: str, subscriber: Callable[[AbstractEvent], None]): self._pypubsub_publisher.subscribe(listener=subscriber, topicName=tag) - def publish(self, event: AbstractEvent, data: Any = None): - data = data if data else {} - + def publish(self, event: AbstractEvent): # publish to event type's topic event_type_name = event.__name__ - self._pypubsub_publisher.sendMessage(event_type_name, **data) + self._pypubsub_publisher.sendMessage(event_type_name, event) # publish to all events' topic - self._pypubsub_publisher.sendMessage(INTERNAL_ALL_EVENT_TYPES_TOPIC, **data) + self._pypubsub_publisher.sendMessage(INTERNAL_ALL_EVENT_TYPES_TOPIC, event) # publish to tags' topics for tag in event.tags: - self._pypubsub_publisher.sendMessage(tag, **data) + self._pypubsub_publisher.sendMessage(tag, event)