Coding style.

This commit is contained in:
Andrew Hamilton 2016-02-19 18:27:20 +00:00
parent 785d3b0bca
commit a03a47977f
2 changed files with 11 additions and 11 deletions

View file

@ -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,

10
vigil
View file

@ -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)