summaryrefslogtreecommitdiff
path: root/client/diagnose.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-06 16:52:53 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-06 16:52:53 +0200
commit2b1e8411ab5eaa7e1349b78d03270ab02ae2950d (patch)
treeed914cbf8964bbe26ba28e80589f4c289b3fac3a /client/diagnose.py
parent890a5798fcf7f9b9dc06529aa4bc7fe903d7ca1a (diff)
downloadjasper-client-2b1e8411ab5eaa7e1349b78d03270ab02ae2950d.tar.gz
jasper-client-2b1e8411ab5eaa7e1349b78d03270ab02ae2950d.zip
Fix flake8 style nits
Diffstat (limited to 'client/diagnose.py')
-rwxr-xr-xclient/diagnose.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/client/diagnose.py b/client/diagnose.py
index 9e2c68f..fb19294 100755
--- a/client/diagnose.py
+++ b/client/diagnose.py
@@ -8,11 +8,11 @@ import subprocess
import logging
import sys
from distutils.spawn import find_executable
-from pip.req import parse_requirements
import pip.util
logger = logging.getLogger(__name__)
+
class Diagnostics:
"""
@@ -39,7 +39,8 @@ class Diagnostics:
@classmethod
def check_phonetisaurus_dictionary_file(cls):
- return os.path.isfile(os.path.join(jasperpath.APP_PATH, "..", "phonetisaurus/g014b2b.fst"))
+ return os.path.isfile(os.path.join(jasperpath.APP_PATH, "..",
+ "phonetisaurus/g014b2b.fst"))
@classmethod
def check_phonetisaurus_program(cls):
@@ -60,10 +61,13 @@ class Diagnostics:
@classmethod
def check_all_pip_requirements_installed(cls):
distributions = pip.util.get_installed_distributions()
- requirements_lines = [line.strip() for line in open('requirements.txt').readlines()]
- requirements = [ name.split('==')[0] for name in list(filter(None, requirements_lines))]
- installed_packages = [ pkg.project_name for pkg in list(distributions)]
- missing_packages = [ pkg for pkg in requirements if pkg not in installed_packages ]
+ requirements_lines = [line.strip() for line in
+ open('requirements.txt').readlines()]
+ requirements = [name.split('==')[0] for name in
+ list(filter(None, requirements_lines))]
+ installed_packages = [pkg.project_name for pkg in list(distributions)]
+ missing_packages = [pkg for pkg in requirements
+ if pkg not in installed_packages]
if missing_packages:
logger.info("Missing packages: "+', '.join(missing_packages))
return False
@@ -102,9 +106,11 @@ class DiagnosticRunner:
def select_methods(self, prefix):
def is_match(method_name):
- return callable(getattr(self.diagnostics, method_name)) and re.match(r"\A" + prefix + "_", method_name)
+ return (callable(getattr(self.diagnostics, method_name)) and
+ re.match(r"\A" + prefix + "_", method_name))
- return [method_name for method_name in dir(self.diagnostics) if is_match(method_name)]
+ return [method_name for method_name in dir(self.diagnostics)
+ if is_match(method_name)]
def initialize_log(self):
logger.info("Starting jasper diagnostic at %s" % time.strftime("%c"))
@@ -131,5 +137,3 @@ if __name__ == '__main__':
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
DiagnosticRunner(Diagnostics).run()
-
-