diff --git a/golden-files/help b/golden-files/help index c62ac1d..b25de6c 100644 --- a/golden-files/help +++ b/golden-files/help @@ -10,7 +10,8 @@ │by selecting this status indicator with the cursor. The types of status are │ │listed below. │ │ │ -│The reports are cached in the codebase's root directory in a ".vigil" directory. │ +│The reports are cached in the codebase's root directory in a ".vigil" │ +│directory. │ │ │ │Keys: │ │ h - Show the help screen. (toggle) │ @@ -56,5 +57,4 @@ │ │ │ │ │ │ -│ │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ \ No newline at end of file diff --git a/tools.py b/tools.py index d01da23..81c9d66 100644 --- a/tools.py +++ b/tools.py @@ -17,7 +17,6 @@ import os.path import pickle import pwd import stat -import string import subprocess import tempfile import time diff --git a/vigil b/vigil index a9dd589..6aafe4d 100755 --- a/vigil +++ b/vigil @@ -15,10 +15,41 @@ A status indicator summarises the state of each report, and a report is viewed by selecting this status indicator with the cursor. The types of status are listed below. -The reports are cached in the codebase's root directory in a ".vigil" directory. +The reports are cached in the codebase's root directory in a ".vigil" +directory. """ +import asyncio +import collections +import contextlib +import functools +import gzip +import multiprocessing +import os +import pickle +import shutil +import signal +import subprocess +import sys +import tempfile +import threading +import time +import traceback + +import docopt +import pyinotify +import urwid +import urwid.raw_display + +import fill3 +import sandbox_fs +import terminal +import termstr +import tools +import worker + + USAGE = """ Usage: vigil [options] @@ -55,36 +86,6 @@ KEYS_DOC = """Keys: """ -import asyncio -import collections -import contextlib -import functools -import gzip -import multiprocessing -import os -import pickle -import shutil -import signal -import subprocess -import sys -import tempfile -import threading -import time -import traceback - -import docopt -import pyinotify -import urwid -import urwid.raw_display - -import fill3 -import sandbox_fs -import terminal -import termstr -import tools -import worker - - _LOG_PATH = os.path.join(os.getcwd(), "vigil.log") @@ -686,11 +687,11 @@ class Screen: self._log.log_command("Paused workers." if self._is_paused else "Running workers...") if self._is_paused: - for worker in self.workers: - worker.pause() + for worker_ in self.workers: + worker_.pause() else: - for worker in self.workers: - worker.continue_() + for worker_ in self.workers: + worker_.continue_() def quit_(self): os.kill(os.getpid(), signal.SIGINT) @@ -936,11 +937,11 @@ def main(root_path, loop, worker_count=None, is_sandboxed=True, def exit_loop(): log.log_command("Exiting...") time.sleep(0.05) - for worker in workers: - worker.pause() - worker.future.cancel() - if worker.result is not None: - worker.result.reset() + for worker_ in workers: + worker_.pause() + worker_.future.cancel() + if worker_.result is not None: + worker_.result.reset() loop.stop() loop.add_signal_handler(signal.SIGWINCH, on_window_resize) loop.add_signal_handler(signal.SIGINT, exit_loop) diff --git a/worker.py b/worker.py index 5ba2089..0299eca 100755 --- a/worker.py +++ b/worker.py @@ -6,7 +6,6 @@ import asyncio import os import signal -import subprocess import psutil @@ -47,7 +46,7 @@ class Worker: return tools.Status(int(data)) async def job_runner(self, summary, log, jobs_added_event, - appearance_changed_event): + appearance_changed_event): await self.create_process() _make_process_nicest(self.child_pid) while True: @@ -64,7 +63,7 @@ class Worker: os.kill(os.getpid(), signal.SIGINT) break await self.result.run(log, appearance_changed_event, - self) + self) summary.completed_total += 1 jobs_added_event.clear() diff --git a/worker_test.py b/worker_test.py index a7557ab..3bedb46 100755 --- a/worker_test.py +++ b/worker_test.py @@ -10,7 +10,6 @@ import shutil import tempfile import unittest -import sandbox_fs import tools import vigil import worker