Beispiel #1
0
def addn(n):
    def entangle(func):
        def call(func, *args, **kw):
            return func(*args, **kw) + n
        return call
    return decorator.decorator(entangle)
Beispiel #2
0
def sig_changer():
    def call(func, a, b):
        return func(b)
    return decorator.decorator(call, (["a", "b"], None, None, None))
Beispiel #3
0
#  Copyright (C) 2007 Joseph Lisee <*****@*****.**>
#
# Author: Originally from Turbogears
#         Changes - Joseph Lisee <*****@*****.**>
# File:  packages/python/ram/test/decorator.py


import unittest

import ram.decorator as decorator

def d1(func):
    def call(func, *args, **kw):
        return func(*args, **kw)
    return call
d1 = decorator.decorator(d1)

def d2(func):
    def call(func, *args, **kw):
        return func(*args, **kw)
    return call
d2 = decorator.decorator(d2)

def d3(func):
    func.baz2 = 2
    def call(func, *args, **kw):
        return func(*args, **kw)
    return call
d3 = decorator.decorator(d3)

def foo(a, b):