def __new__(meta, name, bases, dct):
        actions = dct.pop('ACTIONS', [])
        for on_action, actioned, disconnect in actions:
            def on_f(self, f, args=None, kw=None):
                args = args if args is not None else tuple()
                kw = kw if kw is not None else dict()
                cid = self.cid
                self._callbacks[on_action][cid] = (f, args, kw)
                self.cid += 1
                return cid
            on_f.__doc__ = on_f_docstring.format(actioned=actioned)
            on_f.__name__ = on_action
            dct[on_action] = on_f

            def fed(self):
                for f, args, kw in self._callbacks[on_action].values():
                    f(*args, **kw)
            fed.__doc__ = fed_docstring.format(on_action=on_action)
            fed.__name__ = actioned
            dct[actioned] = fed

            def disf(self, cid):
                try:
                    del self._callbacks[on_action][cid]
                except __HOLE__:
                    pass
            disf.__doc__ = disf_docstring.format(on_action=on_action)
            disf.__name__ = disconnect
            dct[disconnect] = disf

        return super(ActionableMeta, meta).__new__(meta, name, bases, dct)
dataset/ETHPy150Open mrterry/yoink/yoink/has_actions.py/ActionableMeta.__new__