From f9d400ae5cffc97f1c1e7dafdb7e3172fb7df443 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Wed, 27 Nov 2013 13:15:52 +0000 Subject: [PATCH] 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 --- debug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debug.py b/debug.py index a172bb521..fbcbc61f7 100644 --- a/debug.py +++ b/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