- @with_lock_file(lock_file)
- def refresh_cache():
- ns.cfg = with_closing(file(src_path)) (
- lambda f: yaml.load(f, loader))
- try: with_closing(file(cache_path + '.tmp', 'w')) (
- lambda f: f.write(json.write(ns.cfg)))
+ with lock_file(lock_path):
+ with closing(file(src_path)) as f:
+ ns.cfg = yaml.load(f, loader)
+ try:
+ with closing(file(cache_path + '.tmp', 'w')) as f:
+ f.write(json.write(ns.cfg))