From 3c2da3816c48e8a936b5920af1a3019402ce8c0e Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Tue, 29 Jul 2008 23:39:06 -0400 Subject: [PATCH] lazily import yaml for faster module load times svn path=/trunk/packages/sipb-xen-base/; revision=784 --- .../python-support/sipb-xen-base/invirt/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/usr/share/python-support/sipb-xen-base/invirt/config.py b/files/usr/share/python-support/sipb-xen-base/invirt/config.py index 02409a4..cd0a9d4 100644 --- a/files/usr/share/python-support/sipb-xen-base/invirt/config.py +++ b/files/usr/share/python-support/sipb-xen-base/invirt/config.py @@ -1,4 +1,4 @@ -import json, yaml +import json from invirt.common import * from os.path import getmtime @@ -36,6 +36,7 @@ def load(src_path = default_src_path, # written. @with_lock_file('/var/lib/invirt/cache.lock') def cfg(): + import yaml cfg = with_closing(file(src_path))(lambda f: yaml.load(f, default_loader)) try: with_closing(file(cache_path, 'w'))(lambda f: f.write(json.write(cfg))) except: pass # silent failure -- 1.7.9.5