From: Ben Steffen Date: Tue, 26 Nov 2019 19:47:46 +0000 (-0500) Subject: Use full names for os.* things X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/commitdiff_plain/c5229dc84cb94d2feddee25dc6096837f6ed0995?ds=sidebyside Use full names for os.* things --- diff --git a/python/invirt/config.py b/python/invirt/config.py index 9633c2d..58b95aa 100644 --- a/python/invirt/config.py +++ b/python/invirt/config.py @@ -1,8 +1,6 @@ import json from invirt.common import * import os -from os import rename -from os.path import getmtime from contextlib import closing import yaml import re @@ -66,8 +64,8 @@ def load_master(): return config def get_src_mtime(): - return max(max(getmtime(filename) for filename in list_files()), - getmtime(src_dirpath)) + return max(max(os.path.getmtime(filename) for filename in list_files()), + os.path.getmtime(src_dirpath)) def load(force_refresh = False): """ @@ -85,7 +83,7 @@ def load(force_refresh = False): do_refresh = True else: src_mtime = get_src_mtime() - try: cache_mtime = getmtime(cache_path) + try: cache_mtime = os.path.getmtime(cache_path) except OSError: do_refresh = True else: do_refresh = src_mtime + 1 >= cache_mtime @@ -132,7 +130,7 @@ def load(force_refresh = False): with closing(open(cache_path + '.tmp', 'w')) as f: f.write(json.write(ns.cfg)) except: pass # silent failure - else: rename(cache_path + '.tmp', cache_path) + else: os.rename(cache_path + '.tmp', cache_path) except IOError: ns.cfg = load_master() return ns.cfg