Package dimer
[hide private]
[frames] | no frames]

Source Code for Package dimer

 1  """root package""" 
 2   
 3  import logging, time 
 4  import warnings 
 5   
 6  log = logging.getLogger(__name__) 
 7   
8 -def measure_time(funct):
9 """decorator that measures the time spent in a function""" 10 11 def newf(*args, **kwargs): 12 "with time" 13 14 start_time = time.time() 15 res = funct(*args, **kwargs) 16 log.info("operation took %.2f seconds\n", time.time()-start_time) 17 return res
18 19 return newf 20 21
22 -def deprecated(func):
23 """This is a decorator which can be used to mark functions 24 as deprecated. It will result in a warning being emmitted 25 when the function is used.""" 26 27 def newfunc(*args, **kwargs): 28 warnings.warn("Call to deprecated function %s." % func.__name__, 29 category=DeprecationWarning) 30 return func(*args, **kwargs)
31 32 newfunc.__name__ = func.__name__ 33 newfunc.__doc__ = func.__doc__ 34 newfunc.__dict__.update(func.__dict__) 35 return newfunc 36