def sig_changer(): def entangle(func): def call(func, a, b): return func(b) return call return decorator(entangle, (["a", "b"], None, None, None))
def addn(n): def entangle(func): def call(func, *args, **kw): return func(*args, **kw) + n return call return decorator(entangle)
import unittest from turbogears.decorator import * def d1(func): def call(func, *args, **kw): return func(*args, **kw) return call d1 = decorator(d1) def d2(func): def call(func, *args, **kw): return func(*args, **kw) return call d2 = decorator(d2) def d3(func): func.baz2 = 2 def call(func, *args, **kw): return func(*args, **kw) return call d3 = decorator(d3) def foo(a, b): return a+b foo.baz1 = 1 bar = foo foo = d1(foo)
import unittest from turbogears.decorator import * from turbogears import testutil def d1(func): def call(func, *args, **kw): return func(*args, **kw) return call d1 = decorator(d1) def d2(func): def call(func, *args, **kw): return func(*args, **kw) return call d2 = decorator(d2) def d3(func): func.baz2 = 2 def call(func, *args, **kw): return func(*args, **kw)