Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Decorator for functions reacting to joins

:param f: The function which should be called on joins.

        def on_join(f):
    """Decorator for functions reacting to joins

    :param f: The function which should be called on joins."""
    if _check_args(f, 2):
        lala.pluginmanager.register_join_callback(f)
    else:
        raise TypeError("A callback function should takes exactly 2 arguments")
        


src/l/a/lala-0.3/lala/plugins/quotes.py   lala(Download)
from collections import defaultdict
from functools import partial
from lala.util import command, msg, on_join
from lala.config import get, get_int, set_default_options
from twisted.enterprise import adbapi

src/l/a/lala-0.3/lala/plugins/birthday.py   lala(Download)
from ConfigParser import NoOptionError
import logging
 
from datetime import datetime, date, timedelta
from lala.util import command, msg, on_join

src/l/a/lala-0.3/test/test_util.py   lala(Download)
    def test_on_join(self):
        util.on_join(f2)
        lala.pluginmanager.register_join_callback.assert_called_once_with(f2)
 
    def test_command(self):

src/l/a/lala-0.3/test/test_pluginmanager.py   lala(Download)
    def test_on_join(self):
        self.assertEqual(len(pluginmanager._join_callbacks), 0)
        util.on_join(f2)
        self.assertEqual(len(pluginmanager._join_callbacks), 1)
        self.assertTrue(f2 in pluginmanager._join_callbacks)