def mkdeco(f, opt): #{{{ if 'overload' in opt: sigopt['weak'] = False signature = [] sigapp = signature.append for ext in decoext: if not isclass(ext) or not issubclass(ext, CustomDecoSignal): raise TypeError("The 'decoext' argument expected CustomDecoSignal classes, got %s instead" %ext.__name__) sigapp(ext) sigapp(DecoSignalExtension) for ext in sigext: if not isclass(ext) or not issubclass(ext, SignalExtension): raise TypeError("The 'sigext' argument expected SignalExtension classes, got %s instead" %ext.__name__) sigapp(ext) sigapp(BaseSignal) _NewDecoSignal = newclass('_NewDecoSignal', tuple(signature), dict(__slots__ = ())) return _NewDecoSignal(f, **sigopt)
def mkdeco(f, kwargs): #{{{ sigkw = kwargs.pop('sigkw_', {}) if 'overload' in kwargs: sigkw['weak'] = False signature = [] sigapp = signature.append for ext in kwargs.pop('decoext_', ()): if not isclass(ext) or not issubclass(ext, CustomDecoSignal): raise TypeError("The 'decoext' keyword expected CustomDecoSignal classes, got %s instead" %ext.__name__) sigapp(ext) sigapp(DecoSignalExtension) for ext in kwargs.pop('sigext_', ()): if not isclass(ext) or not issubclass(ext, SignalExtension): raise TypeError("The 'sigext' keyword expected SignalExtension classes, got %s instead" %ext.__name__) sigapp(ext) sigapp(BaseSignal) _NewDecoSignal = newclass('_NewDecoSignal', tuple(signature), dict(__slots__ = ())) return _NewDecoSignal(f, **sigkw)