From a03a47977f05e80a3bca4683770b7625ef959e7b Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Fri, 19 Feb 2016 18:27:20 +0000 Subject: [PATCH] Coding style. --- tools.py | 12 +++++------- vigil | 10 ++++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools.py b/tools.py index 1d4cea1..fc867bf 100644 --- a/tools.py +++ b/tools.py @@ -20,15 +20,15 @@ import stat import subprocess import tempfile import time +import traceback -import lscolors import pygments import pygments.lexers import pygments.styles -import traceback import fill3 import gut +import lscolors import termstr @@ -55,8 +55,6 @@ _STATUS_COLORS = {Status.ok: termstr.Color.green, Status.running: termstr.Color.light_blue, Status.paused: termstr.Color.yellow, Status.timed_out: termstr.Color.purple} - - STATUS_MEANINGS = [ (Status.normal, "Normal"), (Status.ok, "Ok"), (Status.problem, "Problem"), (Status.not_applicable, "Not applicable"), @@ -300,9 +298,9 @@ _python_console_lexer = pygments.lexers.PythonConsoleLexer() def python_unittests(path): if str(path).endswith("_test.py"): - python_version = _python_version(path) - cmd = [path] if _has_shebang_line(path) else [python_version, path] - stdout, stderr, returncode = _do_command(cmd, timeout=TIMEOUT) + command = ([path] if _has_shebang_line(path) + else [_python_version(path), path]) + stdout, stderr, returncode = _do_command(command, timeout=TIMEOUT) status = Status.ok if returncode == 0 else Status.problem native_style = pygments.styles.get_style_by_name("native") return status, _syntax_highlight(stderr, _python_console_lexer, diff --git a/vigil b/vigil index e147541..5371b2d 100755 --- a/vigil +++ b/vigil @@ -919,8 +919,10 @@ def _update_screen(main_widget, appearance_changed_event): fill3.patch_screen(main_widget) -def main(root_path, worker_count=multiprocessing.cpu_count()*2, - is_sandboxed=True, editor_command=None, is_being_tested=False): +def main(root_path, worker_count=None, is_sandboxed=True, editor_command=None, + is_being_tested=False): + if worker_count is None: + worker_count = multiprocessing.cpu_count()*2 global _UPDATE_THREAD_STOPPED loop = asyncio.get_event_loop() jobs_added_event = threading.Event() @@ -1051,8 +1053,8 @@ def _check_arguments(): print(_get_help_text()) sys.exit(0) try: - worker_count = (int(arguments["--workers"]) if arguments["--workers"] - is not None else multiprocessing.cpu_count() * 2) + if arguments["--workers"] is not None: + worker_count = int(arguments["--workers"]) except ValueError: print("--workers requires a number.") sys.exit(1)