Move decorator import in debug.py closer to actual usage points so the
decorator library is not imported unless needed - it doesn't appear to be part of Python 2.7 so needs to be installed separately - Legacy-Id: 6765
This commit is contained in:
parent
9457669310
commit
f9d400ae5c
5
debug.py
5
debug.py
|
@ -24,8 +24,6 @@ try:
|
|||
except ImportError:
|
||||
debug = True
|
||||
|
||||
from decorator import decorator
|
||||
|
||||
# A debug decorator, written by Paul Butler, taken from
|
||||
# http://paulbutler.org/archives/python-debugging-with-decorators/
|
||||
# Additional functions and decorator functionality added by
|
||||
|
@ -78,6 +76,7 @@ def trace(fn): # renamed from 'report' by henrik 16 Jun 2011
|
|||
return ret
|
||||
wrap.callcount = 0
|
||||
if debug:
|
||||
from decorator import decorator
|
||||
return decorator(wrap, fn)
|
||||
else:
|
||||
return fn
|
||||
|
@ -109,6 +108,7 @@ def time(fn):
|
|||
return ret
|
||||
wrap.callcount = 0
|
||||
if debug:
|
||||
from decorator import decorator
|
||||
return decorator(wrap, fn)
|
||||
else:
|
||||
return fn
|
||||
|
@ -169,6 +169,7 @@ def profile(fn):
|
|||
prof.dump_stats(datafn)
|
||||
return retval
|
||||
if debug:
|
||||
from decorator import decorator
|
||||
return decorator(wrapper, fn)
|
||||
else:
|
||||
return fn
|
||||
|
|
Loading…
Reference in a new issue