from .messaging import EventPublisher

_publishers = {}

''' decorator method '''
def handle(EventType, channel="default"):
    def inner(f):
        if channel not in _publishers.keys():
            _publishers[channel] = EventPublisher()
        _publishers[channel].subscribe(EventType, f)
        return f
    return inner

def publish(EventInstance, channel="default"):
    _publishers[channel].publish(EventInstance)

03f32824662e7b5ac1d814435c9da6ad4c446394
<mask token>


def publish(EventInstance, channel='default'):
    _publishers[channel].publish(EventInstance)

<mask token>


def handle(EventType, channel='default'):

    def inner(f):
        if channel not in _publishers.keys():
            _publishers[channel] = EventPublisher()
        _publishers[channel].subscribe(EventType, f)
        return f
    return inner


def publish(EventInstance, channel='default'):
    _publishers[channel].publish(EventInstance)

<mask token>
_publishers = {}
<mask token>


def handle(EventType, channel='default'):

    def inner(f):
        if channel not in _publishers.keys():
            _publishers[channel] = EventPublisher()
        _publishers[channel].subscribe(EventType, f)
        return f
    return inner


def publish(EventInstance, channel='default'):
    _publishers[channel].publish(EventInstance)

from .messaging import EventPublisher
_publishers = {}
<mask token>


def handle(EventType, channel='default'):

    def inner(f):
        if channel not in _publishers.keys():
            _publishers[channel] = EventPublisher()
        _publishers[channel].subscribe(EventType, f)
        return f
    return inner


def publish(EventInstance, channel='default'):
    _publishers[channel].publish(EventInstance)

from .messaging import EventPublisher

_publishers = {}

''' decorator method '''
def handle(EventType, channel="default"):
    def inner(f):
        if channel not in _publishers.keys():
            _publishers[channel] = EventPublisher()
        _publishers[channel].subscribe(EventType, f)
        return f
    return inner

def publish(EventInstance, channel="default"):
    _publishers[channel].publish(EventInstance)
