Common: Rename subscribe_all() -> subscribe_all_events()

This commit is contained in:
Mike Salvatore 2022-08-10 09:01:54 -04:00
parent 8553cd834c
commit 87cbdd9fb8
4 changed files with 6 additions and 5 deletions

View File

@ -10,7 +10,7 @@ class IEventQueue(ABC):
""" """
@abstractmethod @abstractmethod
def subscribe_all(self, subscriber: Callable[[AbstractEvent], None]): def subscribe_all_events(self, subscriber: Callable[[AbstractEvent], None]):
""" """
Subscribes a subscriber to all events Subscribes a subscriber to all events

View File

@ -1,8 +1,9 @@
from typing import Callable from typing import Callable
from common.events import AbstractEvent
from pubsub.core import Publisher from pubsub.core import Publisher
from common.events import AbstractEvent
from .i_event_queue import IEventQueue from .i_event_queue import IEventQueue
INTERNAL_ALL_EVENT_TYPES_TOPIC = "internal_all_event_types" INTERNAL_ALL_EVENT_TYPES_TOPIC = "internal_all_event_types"
@ -12,7 +13,7 @@ class PyPubSubEventQueue(IEventQueue):
def __init__(self, pypubsub_publisher: Publisher): def __init__(self, pypubsub_publisher: Publisher):
self._pypubsub_publisher = pypubsub_publisher self._pypubsub_publisher = pypubsub_publisher
def subscribe_all(self, subscriber: Callable[[AbstractEvent], None]): def subscribe_all_events(self, subscriber: Callable[[AbstractEvent], None]):
self._pypubsub_publisher.subscribe( self._pypubsub_publisher.subscribe(
listener=subscriber, topicName=INTERNAL_ALL_EVENT_TYPES_TOPIC listener=subscriber, topicName=INTERNAL_ALL_EVENT_TYPES_TOPIC
) )

View File

@ -67,7 +67,7 @@ def test_subscribe_all():
def subscriber(event, topic=pub.AUTO_TOPIC): def subscriber(event, topic=pub.AUTO_TOPIC):
subscriber_calls.append(topic.getName()) subscriber_calls.append(topic.getName())
pypubsub_event_queue.subscribe_all(subscriber) pypubsub_event_queue.subscribe_all_events(subscriber)
pypubsub_event_queue.publish(EventType) pypubsub_event_queue.publish(EventType)
assert len(subscriber_calls) == 1 assert len(subscriber_calls) == 1

View File

@ -270,4 +270,4 @@ subscribe_type # common\event_queue\pypubsub_event_queue.py
subscribe_tag # common\event_queue\pypubsub_event_queue.py subscribe_tag # common\event_queue\pypubsub_event_queue.py
publish # common\event_queue\pypubsub_event_queue.py publish # common\event_queue\pypubsub_event_queue.py
PyPubSubEventQueue # common\event_queue\pypubsub_event_queue.py PyPubSubEventQueue # common\event_queue\pypubsub_event_queue.py
subscribe_all_event_types # common\event_queue\pypubsub_event_queue.py subscribe_all_events # common\event_queue\pypubsub_event_queue.py