I have next code
def timer_dec(f):
def wrapper(*args, **kwargs):
t = time.time()
args[0].debug('<{}> start'.format(f.__name__))
res = f(*args, **kwargs)
args[0].debug('<{}> finish'.format(f.__name__))
args[0].debug("Working time for function <%s>: %f" % (f.__name__, time.time() - t))
return res
return wrapper
This is works fine:
@timer_dec
class A(object):
pass
But this is not working:
@timer_dec
class A(object):
pass
class B(A):
pass
TypeError: Error when calling the metaclass bases function() argument 1 must be code, not str
Python version is 2.7