# Path: il2fb/ds/airbridge/streaming/subscribers/base.py
# class StreamingSubscriber(metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     async def write(self, o: Any) -> Awaitable[None]:
#         pass


from pydoc import locate
from typing import Any, List, Dict, Tuple
from il2fb.ds.airbridge.streaming.subscribers.base import StreamingSubscriber
# coding: utf-8




CLASS_NAMES_SHORTCUTS = {
    'file': 'il2fb.ds.airbridge.streaming.subscribers.file.JSONFileStreamingSink',
    'nats': 'il2fb.ds.airbridge.streaming.subscribers.nats.NATSStreamingSink',
}


def load_single_subscriber(
    app,
    cls_name: str,
    args: Dict[str, Any],
) -> StreamingSubscriber:

    cls_name = str(CLASS_NAMES_SHORTCUTS.get(cls_name, cls_name))
    cls = locate(cls_name)

    if not issubclass(cls, StreamingSubscriber):
        raise ValueError(

# Path: il2fb/ds/airbridge/streaming/subscribers/base.py
# class StreamingSubscriber(metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     async def write(self, o: Any) -> Awaitable[None]:
#         pass


# Path: il2fb/ds/airbridge/streaming/subscribers/loaders.py
from pydoc import locate
from typing import Any, List, Dict, Tuple
from il2fb.ds.airbridge.streaming.subscribers.base import StreamingSubscriber

# coding: utf-8




CLASS_NAMES_SHORTCUTS = {
    'file': 'il2fb.ds.airbridge.streaming.subscribers.file.JSONFileStreamingSink',
    'nats': 'il2fb.ds.airbridge.streaming.subscribers.nats.NATSStreamingSink',
}


def load_single_subscriber(
    app,
    cls_name: str,
    args: Dict[str, Any],
) -> StreamingSubscriber:

    cls_name = str(CLASS_NAMES_SHORTCUTS.get(cls_name, cls_name))
    cls = locate(cls_name)

    if not issubclass(cls, StreamingSubscriber):
        raise ValueError(

            f"subscriber {cls} is not a subclass of {StreamingSubscriber}"