From 372a5366458c88a3571b4b7a19db538bbf947c3d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 11 Dec 2019 13:30:53 +0100 Subject: format the __init__ files, facter and util using yapf --- src/facter.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/facter.py') diff --git a/src/facter.py b/src/facter.py index c3c95cd..fe0b316 100644 --- a/src/facter.py +++ b/src/facter.py @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with allocbench. If not, see . - """Collect facts about the benchmark environment""" import ctypes @@ -53,6 +52,7 @@ def collect_facts(): starttime = starttime[:starttime.rfind(':')] gv.facts["starttime"] = starttime + def store_facts(path=None): """Store facts to file""" if not path: @@ -66,6 +66,7 @@ def store_facts(path=None): with open(filename, "w") as f: json.dump(gv.facts, f) + def load_facts(path=None): """Load facts from file""" if not path: @@ -86,10 +87,12 @@ def load_facts(path=None): with open(filename, "rb") as f: gv.facts = pickle.load(f) else: - raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), filename) + raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), + filename) print_info(f"Loading facts from: {filename}") + # Copied from pip. # https://github.com/pypa/pip/blob/master/src/pip/_internal/utils/glibc.py # Licensed under MIT. @@ -148,10 +151,12 @@ def libc_ver(executable=None): return ("glibc", glibc_version) + def exe_version(executable, version_flag="--version"): """Return version of executable""" proc = subprocess.run([executable, version_flag], - universal_newlines=True, stdout=subprocess.PIPE) + universal_newlines=True, + stdout=subprocess.PIPE) if proc.returncode != 0: print_warning(f"failed to get version of {executable}") -- cgit v1.2.3