def default(rule, event_name=None):
    def decorate(func):
        name = event_name or func.__name__
        if name not in GUIEventDispatcher.event_types:
            raise EventException('Unknown event "%s"' % name)
        for r in rule.split(','):
            selector = Selector.from_string(r.strip())
            GUIEventDispatcher.set_default_handler(name, selector, func)
        return func
    return decorate
dataset/ETHPy150Open ardekantur/pyglet/contrib/wydget/wydget/event.py/default/original