class Advice: def __init__(self, pointcut): self.pointcut = pointcut def __call__(self, advice): def proxy(instance, *args, **kwargs): advice(None, self.pointcut.targetmethod, instance, *args, **kwargs) self.pointcut.weaveProxy(proxy) return proxy class MethodJoinPoint: def __init__(self, targetmethod): self.targetmethod = targetmethod def weaveProxy(self, proxy): setattr(self.targetmethod.im_c