Coding style.

Using asyncio coroutines for workers instead of threads.
This commit is contained in:
Andrew Hamilton 2016-03-09 10:47:09 +00:00
parent b2e087a9db
commit 4fa5b524d4
8 changed files with 103 additions and 101 deletions

View file

@ -4,6 +4,7 @@
# Licensed under the Artistic License 2.0.
import ast
import asyncio
import contextlib
import dis
import enum
@ -654,7 +655,8 @@ class Result:
self.status = status
self.entry.appearance_cache = None
def run(self, log, appearance_changed_event, worker, runner):
@asyncio.coroutine
def run(self, log, appearance_changed_event, runner):
self.is_placeholder = False
tool_name = tool_name_colored(self.tool, self.path)
path = path_colored(self.path)
@ -665,7 +667,7 @@ class Result:
runner.pause()
appearance_changed_event.set()
start_time = time.time()
new_status = worker.run_tool(self.path, self.tool)
new_status = yield from runner.run_tool(self.path, self.tool)
Result.result.fget.evict(self)
end_time = time.time()
self.set_status(new_status)