Common: Change IEventQueue and PyPubSubEventQueue's subscribe_tags() -> subscribe_tag()

This commit is contained in:
Shreya Malviya 2022-08-09 11:50:31 +05:30
parent e92d67bfe8
commit ae666d3dd3
2 changed files with 5 additions and 6 deletions

View File

@ -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
"""

View File

@ -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):