diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-06-18 17:40:19 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-06-19 17:12:14 +0200 |
| commit | 366c9e27b13e976ce26ec6a97c6796eb1cdca887 (patch) | |
| tree | 8c9c848b169e52f2801b41cc15d35b6d0a9d3d6d /src/util.py | |
| parent | 2757b2790cdc3127b742a127c77fa438710e7f70 (diff) | |
| download | allocbench-366c9e27b13e976ce26ec6a97c6796eb1cdca887.tar.gz allocbench-366c9e27b13e976ce26ec6a97c6796eb1cdca887.zip | |
apply some flake8 hints
Diffstat (limited to 'src/util.py')
| -rw-r--r-- | src/util.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util.py b/src/util.py index 812d980..29aa234 100644 --- a/src/util.py +++ b/src/util.py @@ -8,6 +8,7 @@ import src.globalvars def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + def find_cmd(cmd): fpath, fname = os.path.split(cmd) @@ -24,6 +25,7 @@ def find_cmd(cmd): return None + def prefix_cmd_with_abspath(cmd): """Prefix cmd with the abspath of the first word @@ -32,8 +34,6 @@ def prefix_cmd_with_abspath(cmd): binary_end = cmd.find(" ") binary_end = None if binary_end == -1 else binary_end - cmd_start = len(cmd) if binary_end == None else binary_end - binary_abspath = subprocess.run(["whereis", cmd[0:binary_end]], stdout=subprocess.PIPE, universal_newlines=True).stdout.split()[1] @@ -45,7 +45,6 @@ def allocbench_msg(color, *objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 0: return - color = {"YELLOW": "\x1b[33m", "GREEN": "\x1b[32m", "RED": "\x1b[31m"}[color] @@ -59,33 +58,40 @@ def allocbench_msg(color, *objects, sep=' ', end='\n', file=sys.stdout): if is_atty: print("\x1b[0m", end="", file=file, flush=True) + def print_debug(*objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 99: return print(*objects, sep=sep, end=end, file=file) + def print_info(*objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 1: return print(*objects, sep=sep, end=end, file=file) + def print_info0(*objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 0: return print(*objects, sep=sep, end=end, file=file) + def print_info2(*objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 2: return print(*objects, sep=sep, end=end, file=file) + def print_status(*objects, sep=' ', end='\n', file=sys.stdout): allocbench_msg("GREEN", *objects, sep=sep, end=end, file=file) + def print_warn(*objects, sep=' ', end='\n', file=sys.stdout): if src.globalvars.verbosity < 1: return allocbench_msg("YELLOW", *objects, sep=sep, end=end, file=file) + def print_error(*objects, sep=' ', end='\n', file=sys.stderr): allocbench_msg("RED", *objects, sep=sep, end=end, file=file) |
