Coding style (linting).

This commit is contained in:
Andrew Hamilton 2016-10-16 12:32:01 +02:00
parent 71dc9df58c
commit 9d143a4dd9
5 changed files with 45 additions and 47 deletions

View file

@ -10,7 +10,8 @@
│by selecting this status indicator with the cursor. The types of status are │ │by selecting this status indicator with the cursor. The types of status are │
│listed below. │ │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: │ │Keys: │
h - Show the help screen. (toggle) │ h - Show the help screen. (toggle) │
@ -56,5 +57,4 @@
│ │ │ │
│ │ │ │
│ │ │ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘ └──────────────────────────────────────────────────────────────────────────────────────────────────┘

View file

@ -17,7 +17,6 @@ import os.path
import pickle import pickle
import pwd import pwd
import stat import stat
import string
import subprocess import subprocess
import tempfile import tempfile
import time import time

81
vigil
View file

@ -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 by selecting this status indicator with the cursor. The types of status are
listed below. 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 = """
Usage: Usage:
vigil [options] <directory> vigil [options] <directory>
@ -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") _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 self._log.log_command("Paused workers." if self._is_paused else
"Running workers...") "Running workers...")
if self._is_paused: if self._is_paused:
for worker in self.workers: for worker_ in self.workers:
worker.pause() worker_.pause()
else: else:
for worker in self.workers: for worker_ in self.workers:
worker.continue_() worker_.continue_()
def quit_(self): def quit_(self):
os.kill(os.getpid(), signal.SIGINT) os.kill(os.getpid(), signal.SIGINT)
@ -936,11 +937,11 @@ def main(root_path, loop, worker_count=None, is_sandboxed=True,
def exit_loop(): def exit_loop():
log.log_command("Exiting...") log.log_command("Exiting...")
time.sleep(0.05) time.sleep(0.05)
for worker in workers: for worker_ in workers:
worker.pause() worker_.pause()
worker.future.cancel() worker_.future.cancel()
if worker.result is not None: if worker_.result is not None:
worker.result.reset() worker_.result.reset()
loop.stop() loop.stop()
loop.add_signal_handler(signal.SIGWINCH, on_window_resize) loop.add_signal_handler(signal.SIGWINCH, on_window_resize)
loop.add_signal_handler(signal.SIGINT, exit_loop) loop.add_signal_handler(signal.SIGINT, exit_loop)

View file

@ -6,7 +6,6 @@
import asyncio import asyncio
import os import os
import signal import signal
import subprocess
import psutil import psutil
@ -47,7 +46,7 @@ class Worker:
return tools.Status(int(data)) return tools.Status(int(data))
async def job_runner(self, summary, log, jobs_added_event, async def job_runner(self, summary, log, jobs_added_event,
appearance_changed_event): appearance_changed_event):
await self.create_process() await self.create_process()
_make_process_nicest(self.child_pid) _make_process_nicest(self.child_pid)
while True: while True:
@ -64,7 +63,7 @@ class Worker:
os.kill(os.getpid(), signal.SIGINT) os.kill(os.getpid(), signal.SIGINT)
break break
await self.result.run(log, appearance_changed_event, await self.result.run(log, appearance_changed_event,
self) self)
summary.completed_total += 1 summary.completed_total += 1
jobs_added_event.clear() jobs_added_event.clear()

View file

@ -10,7 +10,6 @@ import shutil
import tempfile import tempfile
import unittest import unittest
import sandbox_fs
import tools import tools
import vigil import vigil
import worker import worker