def CountMethodCall(fn):
    """ Decorator for counting memoizer hits/misses while retrieving
        a simple value in a class method. It wraps the given method
        fn and uses a CountValue object to keep track of the
        caching statistics.
        Wrapping gets enabled by calling EnableMemoization().
    """
    if use_memoizer:
        def wrapper(self, *args, **kwargs):
            global CounterList
            key = self.__class__.__name__+'.'+fn.__name__
            if key not in CounterList:
                CounterList[key] = CountValue(self.__class__.__name__, fn.__name__)
            CounterList[key].count(self, *args, **kwargs)
            return fn(self, *args, **kwargs)
        wrapper.__name__= fn.__name__
        return wrapper
    else:
        return fn
def CountMethodCall ( fn ) : if use_memoizer : def wrapper ( self , * args , ** kwargs ) : global CounterList key = self . __class__ . __name__ + '.' + fn . __name__ if key not in CounterList : CounterList [ key ] = CountValue ( self . __class__ . __name__ , fn . __name__ ) CounterList [ key ] . count ( self , * args , ** kwargs ) return fn ( self , * args , ** kwargs ) wrapper . __name__ = fn . __name__ return wrapper else : return fn
Decorator for counting memoizer hits/misses while retrieving
        a simple value in a class method. It wraps the given method
        fn and uses a CountValue object to keep track of the
        caching statistics.
        Wrapping gets enabled by calling EnableMemoization().