diff --git a/doc/conf.py b/doc/conf.py
index d0d3f51af0..92db128b06 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -4,10 +4,9 @@
# Mycroft documentation build configuration file
#
-import os
import sys
-from os import listdir
+import os
sys.path.insert(0, os.path.abspath('../'))
diff --git a/mycroft/__init__.py b/mycroft/__init__.py
index ad5c6044fc..205723abc4 100644
--- a/mycroft/__init__.py
+++ b/mycroft/__init__.py
@@ -1,10 +1,10 @@
+from os.path import abspath, dirname, join
+
from mycroft.api import Api
+from mycroft.messagebus.message import Message
+from mycroft.skills.context import adds_context, removes_context
from mycroft.skills.core import MycroftSkill, FallbackSkill, \
intent_handler, intent_file_handler
-from mycroft.skills.context import adds_context, removes_context
-from mycroft.messagebus.message import Message
-
-from os.path import abspath, dirname, join
__author__ = 'seanfitz'
diff --git a/mycroft/audio-accuracy-test/audio_accuracy_test.py b/mycroft/audio-accuracy-test/audio_accuracy_test.py
index e1fe8661ba..e56de7de23 100644
--- a/mycroft/audio-accuracy-test/audio_accuracy_test.py
+++ b/mycroft/audio-accuracy-test/audio_accuracy_test.py
@@ -1,10 +1,10 @@
-import os
import time
import wave
from glob import glob
-from os.path import dirname, join
+import os
import pyee
+from os.path import dirname, join
from speech_recognition import AudioSource
from mycroft.client.speech.listener import RecognizerLoop
diff --git a/mycroft/audio/__init__.py b/mycroft/audio/__init__.py
index e4f8fa1afc..5d76f6712c 100644
--- a/mycroft/audio/__init__.py
+++ b/mycroft/audio/__init__.py
@@ -1,7 +1,9 @@
-from mycroft.util.signal import check_for_signal
+import time
+
import psutil
-import time
+from mycroft.util.signal import check_for_signal
+
__author__ = "forslund"
diff --git a/mycroft/audio/main.py b/mycroft/audio/main.py
index 599e6eb53a..dc3c61e8c1 100644
--- a/mycroft/audio/main.py
+++ b/mycroft/audio/main.py
@@ -16,19 +16,19 @@
# along with Mycroft Core. If not, see .
+import imp
import json
-from os.path import expanduser, exists, abspath, dirname, basename, isdir, join
-from os import listdir
import sys
import time
-import imp
-import subprocess
+from os import listdir
+from os.path import abspath, dirname, basename, isdir, join
+
+import mycroft.audio.speech as speech
from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.util.log import LOG
-import mycroft.audio.speech as speech
try:
import pulsectl
@@ -90,7 +90,7 @@ def get_services(services_folder):
services.append(create_service_descriptor(name))
except:
LOG.error('Failed to create service from ' + name,
- exc_info=True)
+ exc_info=True)
if (not isdir(location) or
not MainModule + ".py" in listdir(location)):
continue
@@ -98,7 +98,7 @@ def get_services(services_folder):
services.append(create_service_descriptor(location))
except:
LOG.error('Failed to create service from ' + name,
- exc_info=True)
+ exc_info=True)
return sorted(services, key=lambda p: p.get('name'))
@@ -125,7 +125,7 @@ def load_services(config, ws, path=None):
*descriptor["info"])
except:
LOG.error('Failed to import module ' + descriptor['name'],
- exc_info=True)
+ exc_info=True)
if (hasattr(service_module, 'autodetect') and
callable(service_module.autodetect)):
try:
@@ -133,14 +133,14 @@ def load_services(config, ws, path=None):
service += s
except:
LOG.error('Failed to autodetect...',
- exc_info=True)
+ exc_info=True)
if (hasattr(service_module, 'load_service')):
try:
s = service_module.load_service(config, ws)
service += s
except:
LOG.error('Failed to load service...',
- exc_info=True)
+ exc_info=True)
return service
diff --git a/mycroft/audio/services/chromecast/__init__.py b/mycroft/audio/services/chromecast/__init__.py
index bab625a571..a7bc5e3f34 100644
--- a/mycroft/audio/services/chromecast/__init__.py
+++ b/mycroft/audio/services/chromecast/__init__.py
@@ -1,13 +1,12 @@
-from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
-from mycroft.audio.services import AudioBackend
-from os.path import dirname, abspath, basename
-import sys
import time
from mimetypes import guess_type
import pychromecast
+from mycroft.audio.services import AudioBackend
+from mycroft.messagebus.message import Message
+from mycroft.util.log import LOG
+
__author__ = 'forslund'
diff --git a/mycroft/audio/services/mopidy/__init__.py b/mycroft/audio/services/mopidy/__init__.py
index 057be72c99..893484f901 100644
--- a/mycroft/audio/services/mopidy/__init__.py
+++ b/mycroft/audio/services/mopidy/__init__.py
@@ -1,10 +1,12 @@
-from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
-from mycroft.audio.services import AudioBackend
-from os.path import dirname, abspath, basename
import sys
import time
+from os.path import dirname, abspath
+
+from mycroft.audio.services import AudioBackend
+from mycroft.messagebus.message import Message
+from mycroft.util.log import LOG
+
__author__ = 'forslund'
sys.path.append(abspath(dirname(__file__)))
diff --git a/mycroft/audio/services/mopidy/mopidypost.py b/mycroft/audio/services/mopidy/mopidypost.py
index 36f2335110..6cce0f74b8 100644
--- a/mycroft/audio/services/mopidy/mopidypost.py
+++ b/mycroft/audio/services/mopidy/mopidypost.py
@@ -1,6 +1,7 @@
-import requests
-from copy import copy
import json
+from copy import copy
+
+import requests
MOPIDY_API = '/mopidy/rpc'
diff --git a/mycroft/audio/services/mpg123/__init__.py b/mycroft/audio/services/mpg123/__init__.py
index 7621a5cf8a..5418cb160b 100644
--- a/mycroft/audio/services/mpg123/__init__.py
+++ b/mycroft/audio/services/mpg123/__init__.py
@@ -2,20 +2,18 @@ import subprocess
from time import sleep
from mycroft.audio.services import AudioBackend
-from mycroft.util.log import LOG
from mycroft.messagebus.message import Message
-
-from os.path import abspath
+from mycroft.util.log import LOG
__author__ = 'forslund'
-
class Mpg123Service(AudioBackend):
"""
Audio backend for mpg123 player. This one is rather limited and
only implements basic usage.
"""
+
def __init__(self, config, emitter, name='mpg123'):
self.config = config
self.process = None
diff --git a/mycroft/audio/services/vlc/__init__.py b/mycroft/audio/services/vlc/__init__.py
index f72396cbad..c0ae715725 100644
--- a/mycroft/audio/services/vlc/__init__.py
+++ b/mycroft/audio/services/vlc/__init__.py
@@ -1,8 +1,7 @@
-from os.path import dirname, abspath, basename
-from mycroft.audio.services import AudioBackend
-from mycroft.util.log import LOG
import vlc
+from mycroft.audio.services import AudioBackend
+from mycroft.util.log import LOG
class VlcService(AudioBackend):
diff --git a/mycroft/audio/speech.py b/mycroft/audio/speech.py
index bfedf4b84f..79bc72b147 100644
--- a/mycroft/audio/speech.py
+++ b/mycroft/audio/speech.py
@@ -1,14 +1,12 @@
-from mycroft.tts import TTSFactory
-from mycroft.util import create_signal, stop_speaking, check_for_signal
-from mycroft.lock import Lock as PIDLock # Create/Support PID locking file
-from mycroft.configuration import ConfigurationManager
-from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
-
-from threading import Lock
import time
+from threading import Lock
+
import re
+from mycroft.configuration import ConfigurationManager
+from mycroft.tts import TTSFactory
+from mycroft.util import create_signal, stop_speaking, check_for_signal
+from mycroft.util.log import LOG
ws = None
config = None
diff --git a/mycroft/client/enclosure/__init__.py b/mycroft/client/enclosure/__init__.py
index 45b4fdc3ed..fafe2a2053 100644
--- a/mycroft/client/enclosure/__init__.py
+++ b/mycroft/client/enclosure/__init__.py
@@ -25,7 +25,10 @@ from threading import Thread, Timer
import serial
import mycroft.dialog
+from mycroft.api import has_been_paired
from mycroft.client.enclosure.arduino import EnclosureArduino
+from mycroft.client.enclosure.display_manager import \
+ initiate_display_manager_ws
from mycroft.client.enclosure.eyes import EnclosureEyes
from mycroft.client.enclosure.mouth import EnclosureMouth
from mycroft.client.enclosure.weather import EnclosureWeather
@@ -36,14 +39,10 @@ from mycroft.util import play_wav, create_signal, connected, \
wait_while_speaking
from mycroft.util.audio_test import record
from mycroft.util.log import LOG
-from mycroft.client.enclosure.display_manager import \
- initiate_display_manager_ws
-from mycroft.api import is_paired, has_been_paired
__author__ = 'aatchison', 'jdorleans', 'iward'
-
class EnclosureReader(Thread):
"""
Reads data from Serial port.
@@ -290,7 +289,7 @@ class Enclosure(object):
# One last check to see if connection was established
return
- if time.time()-Enclosure._last_internet_notification < 30:
+ if time.time() - Enclosure._last_internet_notification < 30:
# don't bother the user with multiple notifications with 30 secs
return
@@ -387,7 +386,7 @@ class Enclosure(object):
" Either plug in a network cable or hold the "
"button on top for two seconds, then select "
"wifi from the menu"
- }))
+ }))
else:
# Begin the unit startup process, this is the first time it
# is being run with factory defaults.
diff --git a/mycroft/client/enclosure/api.py b/mycroft/client/enclosure/api.py
index b942335dac..1f9f448359 100644
--- a/mycroft/client/enclosure/api.py
+++ b/mycroft/client/enclosure/api.py
@@ -15,15 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-import mycroft.client.enclosure.display_manager as DisplayManager
-from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
from PIL import Image
+import mycroft.client.enclosure.display_manager as DisplayManager
+from mycroft.messagebus.message import Message
+
__author__ = 'jdorleans'
-
-
'''
API for the functions that affect the Mark I device.
NOTE: current state management is poorly implemented,
diff --git a/mycroft/client/enclosure/arduino.py b/mycroft/client/enclosure/arduino.py
index 5224361613..9455b5f1ee 100644
--- a/mycroft/client/enclosure/arduino.py
+++ b/mycroft/client/enclosure/arduino.py
@@ -15,13 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-from mycroft.util.log import LOG
-
__author__ = 'jdorleans'
-
class EnclosureArduino:
"""
Listens to enclosure commands for Mycroft's Arduino.
diff --git a/mycroft/client/enclosure/display_manager.py b/mycroft/client/enclosure/display_manager.py
index dd27a92064..9a00d3b4be 100644
--- a/mycroft/client/enclosure/display_manager.py
+++ b/mycroft/client/enclosure/display_manager.py
@@ -15,11 +15,13 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
+import json
from threading import Thread, Timer
+
+import os
+
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.util import get_ipc_directory
-import json
-import os
from mycroft.util.log import LOG
__author__ = 'connorpenrod', 'michaelnguyen'
diff --git a/mycroft/client/enclosure/eyes.py b/mycroft/client/enclosure/eyes.py
index 56be184b39..89fa6af400 100644
--- a/mycroft/client/enclosure/eyes.py
+++ b/mycroft/client/enclosure/eyes.py
@@ -16,12 +16,9 @@
# along with Mycroft Core. If not, see .
-from mycroft.util.log import LOG
-
__author__ = 'jdorleans'
-
class EnclosureEyes:
"""
Listens to enclosure commands for Mycroft's Eyes.
diff --git a/mycroft/client/enclosure/main.py b/mycroft/client/enclosure/main.py
index 7da322d54c..48eb247cb3 100644
--- a/mycroft/client/enclosure/main.py
+++ b/mycroft/client/enclosure/main.py
@@ -17,6 +17,7 @@
import sys
+
from mycroft.client.enclosure import Enclosure
diff --git a/mycroft/client/enclosure/mouth.py b/mycroft/client/enclosure/mouth.py
index 9f828a7c2b..6c909aa37d 100644
--- a/mycroft/client/enclosure/mouth.py
+++ b/mycroft/client/enclosure/mouth.py
@@ -16,14 +16,11 @@
# along with Mycroft Core. If not, see .
-from mycroft.util.log import LOG
-from threading import Timer
import time
__author__ = 'jdorleans'
-
class EnclosureMouth:
"""
Listens to enclosure commands for Mycroft's Mouth.
diff --git a/mycroft/client/enclosure/weather.py b/mycroft/client/enclosure/weather.py
index 62393da505..64dbba4add 100644
--- a/mycroft/client/enclosure/weather.py
+++ b/mycroft/client/enclosure/weather.py
@@ -16,12 +16,9 @@
# along with Mycroft Core. If not, see .
-from mycroft.util.log import LOG
-
__author__ = 'iward'
-
class EnclosureWeather:
"""
Listens for Enclosure API commands to display indicators of the weather.
@@ -69,6 +66,6 @@ class EnclosureWeather:
temp = event.data.get("temp", None)
if icon is not None and temp is not None:
- icon = "x=2,"+icon
+ icon = "x=2," + icon
msg = "weather.display=" + str(temp) + "," + str(icon)
self.writer.write(msg)
diff --git a/mycroft/client/speech/hotword_factory.py b/mycroft/client/speech/hotword_factory.py
index 64b4d8168f..b505bcee4f 100644
--- a/mycroft/client/speech/hotword_factory.py
+++ b/mycroft/client/speech/hotword_factory.py
@@ -15,12 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
+import tempfile
+import time
+
+import os
+from os.path import dirname, exists, join, abspath
+
from mycroft.configuration import ConfigurationManager
from mycroft.util.log import LOG
-from os.path import dirname, exists, join, abspath
-import os
-import time
-import tempfile
__author__ = 'seanfitz, jdorleans, jarbas'
diff --git a/mycroft/client/speech/listener.py b/mycroft/client/speech/listener.py
index e8902e7d51..d6e052ded1 100644
--- a/mycroft/client/speech/listener.py
+++ b/mycroft/client/speech/listener.py
@@ -26,14 +26,13 @@ from requests import HTTPError
from requests.exceptions import ConnectionError
import mycroft.dialog
+from mycroft.client.speech.hotword_factory import HotWordFactory
from mycroft.client.speech.mic import MutableMicrophone, ResponsiveRecognizer
from mycroft.configuration import ConfigurationManager
from mycroft.metrics import MetricsAggregator
from mycroft.session import SessionManager
from mycroft.stt import STTFactory
from mycroft.util.log import LOG
-from mycroft.client.speech.hotword_factory import HotWordFactory
-
class AudioProducer(Thread):
diff --git a/mycroft/client/speech/main.py b/mycroft/client/speech/main.py
index 3f0b1367ba..222c11b616 100644
--- a/mycroft/client/speech/main.py
+++ b/mycroft/client/speech/main.py
@@ -16,7 +16,6 @@
# along with Mycroft Core. If not, see .
-import re
import sys
from threading import Thread, Lock
@@ -24,10 +23,10 @@ from mycroft.client.enclosure.api import EnclosureAPI
from mycroft.client.speech.listener import RecognizerLoop
from mycroft.configuration import ConfigurationManager
from mycroft.identity import IdentityManager
+from mycroft.lock import Lock as PIDLock # Create/Support PID locking file
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.util.log import LOG
-from mycroft.lock import Lock as PIDLock # Create/Support PID locking file
ws = None
lock = Lock()
diff --git a/mycroft/client/speech/mic.py b/mycroft/client/speech/mic.py
index 67f2f1811f..3c89b1b396 100644
--- a/mycroft/client/speech/mic.py
+++ b/mycroft/client/speech/mic.py
@@ -16,20 +16,19 @@
along with Mycroft Core. If not, see .
"""
+import audioop
import collections
import datetime
+import shutil
from tempfile import gettempdir
from threading import Thread, Lock
+from time import sleep, time as get_time
import os
-from time import sleep, time as get_time
-import audioop
-
import pyaudio
import speech_recognition
from os import mkdir
from os.path import isdir, join, expanduser, isfile
-import shutil
from speech_recognition import (
Microphone,
AudioSource,
diff --git a/mycroft/client/text/main.py b/mycroft/client/text/main.py
index 373994e407..4d30f20563 100644
--- a/mycroft/client/text/main.py
+++ b/mycroft/client/text/main.py
@@ -29,7 +29,6 @@ sys.stderr = StringIO() # capture any output
import os # nopep8
import os.path # nopep8
import time # nopep8
-import subprocess # nopep8
import curses # nopep8
import curses.ascii # nopep8
import textwrap # nopep8
@@ -39,7 +38,6 @@ from mycroft.messagebus.client.ws import WebsocketClient # nopep8
from mycroft.messagebus.message import Message # nopep8
from mycroft.util import get_ipc_directory # nopep8
from mycroft.util.log import LOG # nopep8
-from mycroft.configuration import ConfigurationManager # nopep8
ws = None
mutex = Lock()
@@ -468,7 +466,7 @@ def draw_screen():
if find_str:
scr.addstr(0, 0, "Search Results: ", CLR_HEADING)
scr.addstr(0, 16, find_str, CLR_FIND)
- scr.addstr(0, 16+len(find_str), " ctrl+X to end" +
+ scr.addstr(0, 16 + len(find_str), " ctrl+X to end" +
" " * (curses.COLS - 31 - 12 - len(find_str)) +
str(start) + "-" + str(end) + " of " + str(cLogs),
CLR_HEADING)
@@ -480,7 +478,7 @@ def draw_screen():
y = 2
len_line = 0
for i in range(start, end):
- if i >= cLogs-1:
+ if i >= cLogs - 1:
log = ' ^--- NEWEST ---^ '
else:
log = filteredLog[i]
@@ -521,18 +519,18 @@ def draw_screen():
y += 1
# Log legend in the lower-right
- y_log_legend = curses.LINES - (3+cy_chat_area)
+ y_log_legend = curses.LINES - (3 + cy_chat_area)
scr.addstr(y_log_legend, curses.COLS / 2 + 2,
make_titlebar("Log Output Legend", curses.COLS / 2 - 2),
CLR_HEADING)
- scr.addstr(y_log_legend+1, curses.COLS / 2 + 2,
+ scr.addstr(y_log_legend + 1, curses.COLS / 2 + 2,
"DEBUG output",
CLR_LOG_DEBUG)
- scr.addstr(y_log_legend+2, curses.COLS / 2 + 2,
+ scr.addstr(y_log_legend + 2, curses.COLS / 2 + 2,
os.path.basename(log_files[0]) + ", other",
CLR_LOG1)
if len(log_files) > 1:
- scr.addstr(y_log_legend+3, curses.COLS / 2 + 2,
+ scr.addstr(y_log_legend + 3, curses.COLS / 2 + 2,
os.path.basename(log_files[1]), CLR_LOG2)
# Meter
@@ -542,7 +540,7 @@ def draw_screen():
CLR_HEADING)
# History log in the middle
- y_chat_history = curses.LINES - (3+cy_chat_area)
+ y_chat_history = curses.LINES - (3 + cy_chat_area)
chat_width = curses.COLS / 2 - 2
chat_out = []
scr.addstr(y_chat_history, 0, make_titlebar("History", chat_width),
@@ -567,7 +565,7 @@ def draw_screen():
idx_chat -= 1
# Output the chat
- y = curses.LINES - (2+cy_chat_area)
+ y = curses.LINES - (2 + cy_chat_area)
for txt in chat_out:
if txt.startswith(">> ") or txt.startswith(" "):
clr = CLR_CHAT_RESP
@@ -590,7 +588,7 @@ def draw_screen():
CLR_HEADING)
scr.addstr(curses.LINES - 1, 0, ">", CLR_HEADING)
- draw_meter(cy_chat_area+2)
+ draw_meter(cy_chat_area + 2)
scr.addstr(curses.LINES - 1, 2, l, CLR_INPUT)
scr.refresh()
@@ -914,5 +912,6 @@ def main():
curses.endwin()
save_settings()
+
if __name__ == "__main__":
main()
diff --git a/mycroft/client/wifisetup/main.py b/mycroft/client/wifisetup/main.py
index 25bccdac77..d991051647 100644
--- a/mycroft/client/wifisetup/main.py
+++ b/mycroft/client/wifisetup/main.py
@@ -28,26 +28,26 @@ a Linux system to be selected by end users. This is achieved by:
* configuring this device based on that selection
"""
-import os
import sys
import threading
import time
import traceback
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
-from os.path import dirname, realpath
from shutil import copyfile
from subprocess import Popen, PIPE, call
from threading import Thread
from time import sleep
+import os
+from os.path import dirname, realpath
from pyric import pyw
from wifi import Cell
from mycroft.client.enclosure.api import EnclosureAPI
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
-from mycroft.util import connected, wait_while_speaking, is_speaking, \
+from mycroft.util import wait_while_speaking, is_speaking, \
stop_speaking
from mycroft.util.log import LOG
diff --git a/mycroft/configuration/__init__.py b/mycroft/configuration/__init__.py
index 5e3f332a48..121800ac93 100644
--- a/mycroft/configuration/__init__.py
+++ b/mycroft/configuration/__init__.py
@@ -16,13 +16,14 @@
# along with Mycroft Core. If not, see .
import json
+
import inflection
import re
from genericpath import exists, isfile
from os.path import join, dirname, expanduser
-from mycroft.util.log import LOG
from mycroft.util.json_helper import load_commented_json
+from mycroft.util.log import LOG
__author__ = 'seanfitz, jdorleans'
@@ -157,7 +158,8 @@ class RemoteConfiguration(object):
RemoteConfiguration.__load(config, setting)
RemoteConfiguration.__store_cache(setting)
except Exception as e:
- LOG.warning("Failed to fetch remote configuration: %s" % repr(e))
+ LOG.warning("Failed to fetch remote configuration: %s" %
+ repr(e))
RemoteConfiguration.__load_cache(config)
else:
diff --git a/mycroft/dialog/__init__.py b/mycroft/dialog/__init__.py
index 848db9b540..354ce1c542 100644
--- a/mycroft/dialog/__init__.py
+++ b/mycroft/dialog/__init__.py
@@ -16,11 +16,13 @@
# along with Mycroft Core. If not, see .
-import pystache
-from io import open
-import os
import random
-from mycroft.util import log, resolve_resource_file
+from io import open
+
+import os
+import pystache
+
+from mycroft.util import resolve_resource_file
from mycroft.util.log import LOG
__author__ = 'seanfitz'
@@ -34,6 +36,7 @@ class MustacheDialogRenderer(object):
"""
A dialog template renderer based on the mustache templating language.
"""
+
def __init__(self):
self.templates = {}
@@ -84,6 +87,7 @@ class DialogLoader(object):
"""
Loads a collection of dialog files into a renderer implementation.
"""
+
def __init__(self, renderer_factory=MustacheDialogRenderer):
self.__renderer = renderer_factory()
@@ -130,7 +134,7 @@ def get(phrase, lang=None, context=None):
from mycroft.configuration import ConfigurationManager
lang = ConfigurationManager.instance().get("lang")
- filename = "text/"+lang.lower()+"/"+phrase+".dialog"
+ filename = "text/" + lang.lower() + "/" + phrase + ".dialog"
template = resolve_resource_file(filename)
if not template:
LOG.debug("Resource file not found: " + filename)
diff --git a/mycroft/filesystem/__init__.py b/mycroft/filesystem/__init__.py
index d9aad20e86..e748ac56cb 100644
--- a/mycroft/filesystem/__init__.py
+++ b/mycroft/filesystem/__init__.py
@@ -28,6 +28,7 @@ class FileSystemAccess(object):
attached to skills
at initialization time to provide a skill-specific namespace.
"""
+
def __init__(self, path):
self.path = self.__init_path(path)
diff --git a/mycroft/lock/__init__.py b/mycroft/lock/__init__.py
index af7baebc10..9027d3f953 100644
--- a/mycroft/lock/__init__.py
+++ b/mycroft/lock/__init__.py
@@ -21,8 +21,8 @@
#
# Required Modules
from signal import getsignal, signal, SIGKILL, SIGINT, SIGTERM # signals
-import os # Operating System functions
+import os # Operating System functions
#
# Written by Daniel Mendyke [dmendyke@jaguarlandrover.com]
diff --git a/mycroft/messagebus/client/ws.py b/mycroft/messagebus/client/ws.py
index 737bcb9cb1..e59096fdb9 100644
--- a/mycroft/messagebus/client/ws.py
+++ b/mycroft/messagebus/client/ws.py
@@ -14,8 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-
import json
import time
from multiprocessing.pool import ThreadPool
@@ -31,7 +29,6 @@ from mycroft.util.log import LOG
__author__ = 'seanfitz', 'jdorleans'
-
class WebsocketClient(object):
def __init__(self, host=None, port=None, route=None, ssl=None):
diff --git a/mycroft/messagebus/service/main.py b/mycroft/messagebus/service/main.py
index e04218affa..2a06dbddb1 100644
--- a/mycroft/messagebus/service/main.py
+++ b/mycroft/messagebus/service/main.py
@@ -14,16 +14,13 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
import tornado.ioloop as ioloop
import tornado.web as web
-import tornado.autoreload as autoreload
from mycroft.configuration import ConfigurationManager
+from mycroft.lock import Lock # creates/supports PID locking file
from mycroft.messagebus.service.ws import WebsocketEventHandler
from mycroft.util import validate_param
-from mycroft.lock import Lock # creates/supports PID locking file
-
__author__ = 'seanfitz', 'jdorleans'
diff --git a/mycroft/messagebus/service/ws.py b/mycroft/messagebus/service/ws.py
index 1623feea34..9a1452503c 100644
--- a/mycroft/messagebus/service/ws.py
+++ b/mycroft/messagebus/service/ws.py
@@ -14,8 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-
import json
import sys
import traceback
@@ -23,8 +21,8 @@ import traceback
import tornado.websocket
from pyee import EventEmitter
-from mycroft.util.log import LOG
from mycroft.messagebus.message import Message
+from mycroft.util.log import LOG
__author__ = 'seanfitz'
diff --git a/mycroft/metrics/__init__.py b/mycroft/metrics/__init__.py
index 6a2a9bb8e7..687917e196 100644
--- a/mycroft/metrics/__init__.py
+++ b/mycroft/metrics/__init__.py
@@ -14,8 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-
import json
import threading
import time
@@ -27,7 +25,6 @@ from mycroft.session import SessionManager
from mycroft.util.log import LOG
from mycroft.util.setup_base import get_version
-
config = ConfigurationManager.get().get('server')
diff --git a/mycroft/skills/audioservice.py b/mycroft/skills/audioservice.py
index e7d3329ccb..db8af4dff1 100644
--- a/mycroft/skills/audioservice.py
+++ b/mycroft/skills/audioservice.py
@@ -1,5 +1,7 @@
import time
+
from os.path import abspath
+
from mycroft.messagebus.message import Message
@@ -26,6 +28,7 @@ class AudioService():
Args:
emitter: eventemitter or websocket object
"""
+
def __init__(self, emitter):
self.emitter = emitter
self.emitter.on('mycroft.audio.service.track_info_reply',
diff --git a/mycroft/skills/container.py b/mycroft/skills/container.py
index f9c0a28be8..c1655deba3 100644
--- a/mycroft/skills/container.py
+++ b/mycroft/skills/container.py
@@ -18,6 +18,7 @@
import argparse
import sys
+
from os.path import dirname, exists, isdir
from mycroft.configuration import ConfigurationManager
@@ -29,7 +30,6 @@ from mycroft.util.log import LOG
__author__ = 'seanfitz'
-
class SkillContainer(object):
def __init__(self, args):
params = self.__build_params(args)
diff --git a/mycroft/skills/core.py b/mycroft/skills/core.py
index 5d6c425367..d46293bc62 100644
--- a/mycroft/skills/core.py
+++ b/mycroft/skills/core.py
@@ -14,29 +14,26 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-import abc
import imp
-import time
-import sys
-
import operator
-import re
-from os.path import join, abspath, dirname, splitext, isdir, \
- basename, exists
-from os import listdir
+import sys
+import time
from functools import wraps
+from inspect import getargspec
+import abc
+import re
from adapt.intent import Intent, IntentBuilder
+from os import listdir
+from os.path import join, abspath, dirname, splitext, basename, exists
from mycroft.client.enclosure.api import EnclosureAPI
from mycroft.configuration import ConfigurationManager
from mycroft.dialog import DialogLoader
from mycroft.filesystem import FileSystemAccess
from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
from mycroft.skills.settings import SkillSettings
-
-from inspect import getargspec
+from mycroft.util.log import LOG
__author__ = 'seanfitz'
@@ -44,7 +41,6 @@ __author__ = 'seanfitz'
MainModule = '__init__'
-
def load_vocab_from_file(path, vocab_type, emitter):
"""
Load mycroft vocabulary from file. and send it on the message bus for
@@ -122,7 +118,7 @@ def load_skill(skill_descriptor, emitter, skill_id, BLACKLISTED_SKILLS=None):
BLACKLISTED_SKILLS = BLACKLISTED_SKILLS or []
try:
LOG.info("ATTEMPTING TO LOAD SKILL: " + skill_descriptor["name"] +
- " with ID " + str(skill_id))
+ " with ID " + str(skill_id))
if skill_descriptor['name'] in BLACKLISTED_SKILLS:
LOG.info("SKILL IS BLACKLISTED " + skill_descriptor["name"])
return None
@@ -434,7 +430,7 @@ class MycroftSkill(object):
break
else:
LOG.error('Could not enable ' + intent_name +
- ', it hasn\'t been registered.')
+ ', it hasn\'t been registered.')
def set_context(self, context, word=''):
"""
@@ -538,7 +534,7 @@ class MycroftSkill(object):
self.stop()
except:
LOG.error("Failed to stop skill: {}".format(self.name),
- exc_info=True)
+ exc_info=True)
@abc.abstractmethod
def stop(self):
@@ -568,7 +564,7 @@ class MycroftSkill(object):
self.stop()
except:
LOG.error("Failed to stop skill: {}".format(self.name),
- exc_info=True)
+ exc_info=True)
def _schedule_event(self, handler, when, data=None, name=None,
repeat=None):
diff --git a/mycroft/skills/event_scheduler.py b/mycroft/skills/event_scheduler.py
index 1ae5ee6b8f..c7ee17fea2 100644
--- a/mycroft/skills/event_scheduler.py
+++ b/mycroft/skills/event_scheduler.py
@@ -1,13 +1,12 @@
-from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
-
-from threading import Thread
-from Queue import Queue
-import time
import json
+import time
+from Queue import Queue
+from threading import Thread
+
from os.path import isfile
-
+from mycroft.messagebus.message import Message
+from mycroft.util.log import LOG
class EventScheduler(Thread):
diff --git a/mycroft/skills/intent_service.py b/mycroft/skills/intent_service.py
index 5d98394ec7..a5df3ee0be 100644
--- a/mycroft/skills/intent_service.py
+++ b/mycroft/skills/intent_service.py
@@ -16,21 +16,20 @@
# along with Mycroft Core. If not, see .
+import time
+
+from adapt.context import ContextManagerFrame
from adapt.engine import IntentDeterminationEngine
+from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.message import Message
from mycroft.skills.core import open_intent_envelope
from mycroft.util.log import LOG
from mycroft.util.parse import normalize
-from mycroft.configuration import ConfigurationManager
-
-from adapt.context import ContextManagerFrame
-import time
__author__ = 'seanfitz'
-
class ContextManager(object):
"""
ContextManager
@@ -100,7 +99,7 @@ class ContextManager(object):
relevant_frames[i].entities]
for entity in frame_entities:
entity['confidence'] = entity.get('confidence', 1.0) \
- / (2.0 + i)
+ / (2.0 + i)
context += frame_entities
result = []
diff --git a/mycroft/skills/main.py b/mycroft/skills/main.py
index 83de62e330..c6135ad692 100644
--- a/mycroft/skills/main.py
+++ b/mycroft/skills/main.py
@@ -17,28 +17,28 @@
import json
-import os
import subprocess
import sys
import time
-from os.path import exists, join
from threading import Timer, Thread, Event
+import os
+from os.path import exists, join
+
+import mycroft.dialog
from mycroft import MYCROFT_ROOT_PATH
+from mycroft.api import is_paired
from mycroft.configuration import ConfigurationManager
from mycroft.lock import Lock # Creates PID file for single instance
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.skills.core import load_skill, create_skill_descriptor, \
MainModule, FallbackSkill
+from mycroft.skills.event_scheduler import EventScheduler
from mycroft.skills.intent_service import IntentService
from mycroft.skills.padatious_service import PadatiousService
-from mycroft.skills.event_scheduler import EventScheduler
from mycroft.util import connected
from mycroft.util.log import LOG
-from mycroft.api import is_paired
-import mycroft.dialog
-
__author__ = 'seanfitz'
diff --git a/mycroft/skills/padatious_service.py b/mycroft/skills/padatious_service.py
index 89fc05e658..54b5dd70dd 100644
--- a/mycroft/skills/padatious_service.py
+++ b/mycroft/skills/padatious_service.py
@@ -15,9 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
from subprocess import call
+from threading import Event
from time import time as get_time, sleep
-from threading import Event
from os.path import expanduser, isfile
from pkg_resources import get_distribution
@@ -53,7 +53,7 @@ class PadatiousService(FallbackSkill):
LOG.warning('VERSION: ' + ver)
if ver != PADATIOUS_VERSION:
LOG.warning('Using Padatious v' + ver + '. Please re-run ' +
- 'dev_setup.sh to install ' + PADATIOUS_VERSION)
+ 'dev_setup.sh to install ' + PADATIOUS_VERSION)
self.container = IntentContainer(intent_cache)
@@ -82,7 +82,7 @@ class PadatiousService(FallbackSkill):
def register_intent(self, message):
LOG.debug('Registering Padatious intent: ' +
- message.data['intent_name'])
+ message.data['intent_name'])
file_name = message.data['file_name']
intent_name = message.data['intent_name']
diff --git a/mycroft/skills/scheduled_skills.py b/mycroft/skills/scheduled_skills.py
index b9baf6faa6..2d4939c07e 100644
--- a/mycroft/skills/scheduled_skills.py
+++ b/mycroft/skills/scheduled_skills.py
@@ -16,11 +16,11 @@
# along with Mycroft Core. If not, see .
-import abc
from datetime import datetime
from threading import Timer, Lock
from time import mktime
+import abc
import parsedatetime as pdt
from adapt.intent import IntentBuilder
@@ -31,7 +31,6 @@ from mycroft.util.log import LOG
__author__ = 'jdorleans'
-
class ScheduledSkill(MycroftSkill):
"""
Abstract class which provides a repeatable notification behaviour at a
@@ -152,7 +151,7 @@ class ScheduledCRUDSkill(ScheduledSkill):
self.repeat_data = {}
if basedir:
LOG.debug('basedir argument is no longer required and is ' +
- 'depreciated.')
+ 'depreciated.')
self.basedir = basedir
def initialize(self):
diff --git a/mycroft/skills/settings.py b/mycroft/skills/settings.py
index 9ca0273381..22e90a9f39 100644
--- a/mycroft/skills/settings.py
+++ b/mycroft/skills/settings.py
@@ -29,11 +29,12 @@
"""
import json
-import sys
from threading import Timer
-from os.path import isfile, join, exists, expanduser
-from mycroft.util.log import LOG
+
+from os.path import isfile, join
+
from mycroft.api import DeviceApi
+from mycroft.util.log import LOG
SKILLS_DIR = "/opt/mycroft/skills"
@@ -48,6 +49,7 @@ class SkillSettings(dict):
Args:
settings_file (str): Path to storage file
"""
+
def __init__(self, directory):
super(SkillSettings, self).__init__()
self.api = DeviceApi()
diff --git a/mycroft/skills/time_rules.py b/mycroft/skills/time_rules.py
index 5c8b8c6a04..33ce49afdb 100644
--- a/mycroft/skills/time_rules.py
+++ b/mycroft/skills/time_rules.py
@@ -14,8 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-
import abc
import re
diff --git a/mycroft/stt/__init__.py b/mycroft/stt/__init__.py
index 4777a1a2c6..4dc1a58e1c 100644
--- a/mycroft/stt/__init__.py
+++ b/mycroft/stt/__init__.py
@@ -14,22 +14,18 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
+import re
from abc import ABCMeta, abstractmethod
-
+from requests import post
from speech_recognition import Recognizer
from mycroft.api import STTApi
from mycroft.configuration import ConfigurationManager
from mycroft.util.log import LOG
-import re
-
-from requests import post
-
__author__ = "jdorleans"
-
class STT(object):
__metaclass__ = ABCMeta
diff --git a/mycroft/tts/__init__.py b/mycroft/tts/__init__.py
index de1042f561..720a7ae201 100644
--- a/mycroft/tts/__init__.py
+++ b/mycroft/tts/__init__.py
@@ -14,27 +14,27 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
+import hashlib
import random
-from abc import ABCMeta, abstractmethod
-from os.path import dirname, exists, isdir
-from threading import Thread
from Queue import Queue, Empty
+from threading import Thread
from time import time, sleep
+
import os
import os.path
-import hashlib
+from abc import ABCMeta, abstractmethod
+from os.path import dirname, exists, isdir
+import mycroft.util
from mycroft.client.enclosure.api import EnclosureAPI
from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.message import Message
-from mycroft.util.log import LOG
from mycroft.util import play_wav, play_mp3, check_for_signal, create_signal
-import mycroft.util
+from mycroft.util.log import LOG
__author__ = 'jdorleans'
-
class PlaybackThread(Thread):
"""
Thread class for playing back tts audio and sending
@@ -260,7 +260,7 @@ class TTS(object):
Key: Key identifying phoneme cache
"""
pho_file = os.path.join(mycroft.util.get_cache_directory("tts"),
- key+".pho")
+ key + ".pho")
if os.path.exists(pho_file):
try:
with open(pho_file, "r") as cachefile:
diff --git a/mycroft/tts/mimic_tts.py b/mycroft/tts/mimic_tts.py
index 563852480e..ede246c330 100644
--- a/mycroft/tts/mimic_tts.py
+++ b/mycroft/tts/mimic_tts.py
@@ -16,15 +16,13 @@
# along with Mycroft Core. If not, see .
import subprocess
-import os
+from time import time
+
import os.path
-from time import time, sleep
-import unicodedata
from mycroft import MYCROFT_ROOT_PATH
from mycroft.configuration import ConfigurationManager
from mycroft.tts import TTS, TTSValidator
-import mycroft.util
from mycroft.util.log import LOG
__author__ = 'jdorleans', 'spenrod'
diff --git a/mycroft/tts/remote_tts.py b/mycroft/tts/remote_tts.py
index d2bbfbd43b..99dcdca383 100644
--- a/mycroft/tts/remote_tts.py
+++ b/mycroft/tts/remote_tts.py
@@ -17,19 +17,16 @@
import abc
-
import re
from requests_futures.sessions import FuturesSession
from mycroft.tts import TTS
from mycroft.util import remove_last_slash, play_wav
from mycroft.util.log import LOG
-from mycroft.messagebus.message import Message
__author__ = 'jdorleans'
-
class RemoteTTS(TTS):
"""
Abstract class for a Remote TTS engine implementation.
diff --git a/mycroft/util/__init__.py b/mycroft/util/__init__.py
index c9e3336d2b..22dbb7f227 100644
--- a/mycroft/util/__init__.py
+++ b/mycroft/util/__init__.py
@@ -15,31 +15,26 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
+import socket
+import subprocess
+
+import os.path
+import psutil
+from stat import S_ISREG, ST_MTIME, ST_MODE, ST_SIZE
+
+import mycroft.audio
+import mycroft.configuration
+from mycroft.util.format import nice_number, convert_number
# Officially exported methods from this file:
# play_wav, play_mp3, get_cache_directory,
# resolve_resource_file, wait_while_speaking
from mycroft.util.log import LOG
from mycroft.util.parse import extract_datetime, extractnumber, normalize
-from mycroft.util.format import nice_number, convert_number
-
-import socket
-import subprocess
-import tempfile
-import time
-
-import os
-import os.path
-import time
-from stat import S_ISREG, ST_MTIME, ST_MODE, ST_SIZE
-import psutil
from mycroft.util.signal import *
-import mycroft.configuration
-import mycroft.audio
__author__ = 'jdorleans'
-
def resolve_resource_file(res_name):
"""Convert a resource into an absolute filename.
@@ -181,7 +176,7 @@ def curate_cache(dir, min_free_percent=5.0):
space = psutil.disk_usage(dir)
# space.percent = space.used/space.total*100.0
- percent_free = 100.0-space.percent
+ percent_free = 100.0 - space.percent
if percent_free < min_free_percent:
# calculate how many bytes we need to delete
bytes_needed = (min_free_percent - percent_free) / 100.0 * space.total
@@ -243,7 +238,7 @@ def is_speaking():
bool: True while still speaking
"""
LOG.info("mycroft.utils.is_speaking() is depreciated, use "
- "mycroft.audio.is_speaking() instead.")
+ "mycroft.audio.is_speaking() instead.")
return mycroft.audio.is_speaking()
@@ -255,7 +250,7 @@ def wait_while_speaking():
begin.
"""
LOG.info("mycroft.utils.wait_while_speaking() is depreciated, use "
- "mycroft.audio.wait_while_speaking() instead.")
+ "mycroft.audio.wait_while_speaking() instead.")
return mycroft.audio.wait_while_speaking()
@@ -263,5 +258,5 @@ def stop_speaking():
# TODO: Less hacky approach to this once Audio Manager is implemented
# Skills should only be able to stop speech they've initiated
LOG.info("mycroft.utils.stop_speaking() is depreciated, use "
- "mycroft.audio.stop_speaking() instead.")
+ "mycroft.audio.stop_speaking() instead.")
mycroft.audio.stop_speaking()
diff --git a/mycroft/util/audio_test.py b/mycroft/util/audio_test.py
index 40a3904308..651e3d99d9 100644
--- a/mycroft/util/audio_test.py
+++ b/mycroft/util/audio_test.py
@@ -16,10 +16,12 @@
# along with Mycroft Core. If not, see .
+import argparse
+
from speech_recognition import Recognizer
+
from mycroft.client.speech.mic import MutableMicrophone
from mycroft.util import play_wav
-import argparse
__author__ = 'seanfitz'
"""
diff --git a/mycroft/util/download.py b/mycroft/util/download.py
index 805ecad6d4..f6b6408b95 100644
--- a/mycroft/util/download.py
+++ b/mycroft/util/download.py
@@ -1,6 +1,7 @@
from threading import Thread
-import requests
+
import os
+import requests
from os.path import exists
_running_downloads = {}
@@ -35,6 +36,7 @@ class Downloader(Thread):
complet_action: Function to run when download is complete.
`func(dest)`
"""
+
def __init__(self, url, dest, complete_action=None):
super(Downloader, self).__init__()
self.url = url
diff --git a/mycroft/util/format.py b/mycroft/util/format.py
index 8555867776..dfc6ce8514 100755
--- a/mycroft/util/format.py
+++ b/mycroft/util/format.py
@@ -18,8 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-import math
-
FRACTION_STRING_EN = {
2: 'half',
3: 'third',
diff --git a/mycroft/util/json_helper.py b/mycroft/util/json_helper.py
index f8dad195fc..a5473a5852 100644
--- a/mycroft/util/json_helper.py
+++ b/mycroft/util/json_helper.py
@@ -14,8 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
-
-
import json
diff --git a/mycroft/util/log.py b/mycroft/util/log.py
index 0dfb92e779..d3b2dddbc4 100644
--- a/mycroft/util/log.py
+++ b/mycroft/util/log.py
@@ -44,10 +44,12 @@ class LOG:
@classmethod
def init(cls):
sys_config = '/etc/mycroft/mycroft.conf'
- cls.level = logging.getLevelName(load_commented_json(sys_config)['log_level']
- if isfile(sys_config) else 'DEBUG')
+ level_name = load_commented_json(sys_config)['log_level'] \
+ if isfile(sys_config) else 'DEBUG'
+ cls.level = logging.getLevelName(level_name)
- fmt = '%(asctime)s.%(msecs)03d - %(name)s - %(levelname)s - %(message)s'
+ fmt = '%(asctime)s.%(msecs)03d - ' \
+ '%(name)s - %(levelname)s - %(message)s'
datefmt = '%H:%M:%S'
formatter = logging.Formatter(fmt, datefmt)
cls.ch = logging.StreamHandler(sys.stdout)
@@ -87,7 +89,8 @@ class LOG:
# [3] - function
# ...
record = stack[2]
- name = inspect.getmodule(record[0]).__name__ + ':' + record[3] + ':' + str(record[2])
+ module_name = inspect.getmodule(record[0]).__name__
+ name = module_name + ':' + record[3] + ':' + str(record[2])
func(cls.create_logger(name), *args, **kwargs)
@classmethod
diff --git a/mycroft/util/setup_base.py b/mycroft/util/setup_base.py
index 2a176d7700..b7070656e0 100644
--- a/mycroft/util/setup_base.py
+++ b/mycroft/util/setup_base.py
@@ -16,12 +16,13 @@
# along with Mycroft Core. If not, see .
-import os
-import subprocess
-from setuptools import find_packages
import shutil
-from mycroft.util.log import LOG
+import subprocess
+import os
+from setuptools import find_packages
+
+from mycroft.util.log import LOG
__author__ = 'seanfitz'
diff --git a/mycroft/util/signal.py b/mycroft/util/signal.py
index 41f0808810..62a2cbe775 100644
--- a/mycroft/util/signal.py
+++ b/mycroft/util/signal.py
@@ -1,10 +1,11 @@
+import tempfile
+import time
+
import os
import os.path
-import tempfile
-import mycroft
-import time
-from mycroft.util.log import LOG
+import mycroft
+from mycroft.util.log import LOG
def get_ipc_directory(domain=None):
diff --git a/mycroft/version/__init__.py b/mycroft/version/__init__.py
index faa10cd9c5..e02385bc57 100644
--- a/mycroft/version/__init__.py
+++ b/mycroft/version/__init__.py
@@ -16,6 +16,7 @@
# along with Mycroft Core. If not, see .
import json
+
from genericpath import exists, isfile
from mycroft.util.log import LOG
diff --git a/test/integrationtests/messagebus/messagebus_test.py b/test/integrationtests/messagebus/messagebus_test.py
index cdb7003923..e1bd4eca9f 100644
--- a/test/integrationtests/messagebus/messagebus_test.py
+++ b/test/integrationtests/messagebus/messagebus_test.py
@@ -4,12 +4,13 @@ It's important to note that this requires this test to run mycroft service
to test the buss. It is not expected that the service be already running
when the tests are ran.
"""
+import time
import unittest
-from mycroft.messagebus.message import Message
-from mycroft.messagebus.client.ws import WebsocketClient
from subprocess import Popen, call
from threading import Thread
-import time
+
+from mycroft.messagebus.client.ws import WebsocketClient
+from mycroft.messagebus.message import Message
class TestMessagebusMethods(unittest.TestCase):
diff --git a/test/integrationtests/skills/discover_tests.py b/test/integrationtests/skills/discover_tests.py
index e6861d07c2..a87060424d 100644
--- a/test/integrationtests/skills/discover_tests.py
+++ b/test/integrationtests/skills/discover_tests.py
@@ -1,11 +1,12 @@
-import os
-import sys
import glob
+import sys
import unittest
+
+import os
+
from test.integrationtests.skills.skill_tester import MockSkillsLoader
from test.integrationtests.skills.skill_tester import SkillTest
-
__author__ = 'seanfitz'
SKILL_PATH = '/opt/mycroft/skills'
diff --git a/test/integrationtests/skills/skill_tester.py b/test/integrationtests/skills/skill_tester.py
index 1a25f449e4..d1227356f6 100644
--- a/test/integrationtests/skills/skill_tester.py
+++ b/test/integrationtests/skills/skill_tester.py
@@ -1,12 +1,11 @@
import json
-import os
-from os.path import dirname, join, isdir
-import re
from time import sleep
+import os
+import re
+from os.path import join, isdir
from pyee import EventEmitter
-from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.skills.core import create_skill_descriptor, load_skill
diff --git a/test/unittests/api/test_api.py b/test/unittests/api/test_api.py
index d50334c30d..bc17c99878 100644
--- a/test/unittests/api/test_api.py
+++ b/test/unittests/api/test_api.py
@@ -1,8 +1,10 @@
-from copy import copy
import unittest
+from copy import copy
+
import mock
-import mycroft.configuration
+
import mycroft.api
+import mycroft.configuration
CONFIG = {
'server': {
diff --git a/test/unittests/audio/test_interface.py b/test/unittests/audio/test_interface.py
index ebf139569b..85eba82997 100644
--- a/test/unittests/audio/test_interface.py
+++ b/test/unittests/audio/test_interface.py
@@ -1,10 +1,12 @@
-from os.path import dirname, exists
-from threading import Thread
import unittest
from shutil import rmtree
+from threading import Thread
from time import sleep
-from mycroft.util import create_signal, check_for_signal
+
+from os.path import exists
+
import mycroft.audio
+from mycroft.util import create_signal, check_for_signal
"""
Tests for public interface for audio interface
diff --git a/test/unittests/audio/test_service.py b/test/unittests/audio/test_service.py
index 26d673300b..6a329e0588 100644
--- a/test/unittests/audio/test_service.py
+++ b/test/unittests/audio/test_service.py
@@ -1,5 +1,7 @@
-from os.path import dirname, join, abspath
import unittest
+
+from os.path import dirname, join, abspath
+
import mycroft.audio.main as audio_service
"""
diff --git a/test/unittests/client/dynamic_energy_test.py b/test/unittests/client/dynamic_energy_test.py
index 77de81413d..0f71efd8a4 100644
--- a/test/unittests/client/dynamic_energy_test.py
+++ b/test/unittests/client/dynamic_energy_test.py
@@ -1,6 +1,8 @@
-import unittest
import audioop
+import unittest
+
from speech_recognition import AudioSource
+
from mycroft.client.speech.mic import ResponsiveRecognizer
__author__ = 'seanfitz'
diff --git a/test/unittests/lock/test_lock.py b/test/unittests/lock/test_lock.py
index f14edb4eaf..1927aa9d10 100644
--- a/test/unittests/lock/test_lock.py
+++ b/test/unittests/lock/test_lock.py
@@ -1,9 +1,11 @@
-from os.path import dirname, join, exists, isfile
-import os
import signal
import unittest
-import mock
from shutil import rmtree
+
+import mock
+import os
+from os.path import exists, isfile
+
from mycroft.lock import Lock
diff --git a/test/unittests/skills/core.py b/test/unittests/skills/core.py
index 051c77bd41..5c4fc27420 100644
--- a/test/unittests/skills/core.py
+++ b/test/unittests/skills/core.py
@@ -1,20 +1,18 @@
# -*- coding: utf-8 -*-
-import unittest
import sys
+import unittest
+
+import mock
+from adapt.intent import IntentBuilder
from os.path import join, dirname, abspath
from re import error
-import mock
-
-from mycroft.skills.core import load_regex_from_file, load_regex, \
- load_vocab_from_file, load_vocabulary, MycroftSkill, \
- load_skill, create_skill_descriptor, open_intent_envelope
from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.message import Message
-from adapt.intent import IntentBuilder
-
-from mycroft.util.log import LOG
+from mycroft.skills.core import load_regex_from_file, load_regex, \
+ load_vocab_from_file, load_vocabulary, MycroftSkill, \
+ load_skill, create_skill_descriptor, open_intent_envelope
__author__ = 'eward'
diff --git a/test/unittests/skills/decorator_test_skill.py b/test/unittests/skills/decorator_test_skill.py
index 44062d493c..5fa3fe5f38 100644
--- a/test/unittests/skills/decorator_test_skill.py
+++ b/test/unittests/skills/decorator_test_skill.py
@@ -1,6 +1,7 @@
+from adapt.intent import IntentBuilder
+
from mycroft.skills.core import MycroftSkill
from mycroft.skills.core import intent_handler, intent_file_handler
-from adapt.intent import IntentBuilder
class TestSkill(MycroftSkill):
diff --git a/test/unittests/skills/intent_service.py b/test/unittests/skills/intent_service.py
index 09ecb2e896..7a89275ef2 100644
--- a/test/unittests/skills/intent_service.py
+++ b/test/unittests/skills/intent_service.py
@@ -1,5 +1,6 @@
import unittest
-from mycroft.skills.intent_service import IntentService, ContextManager
+
+from mycroft.skills.intent_service import ContextManager
class MockEmitter(object):
diff --git a/test/unittests/skills/scheduled_skills.py b/test/unittests/skills/scheduled_skills.py
index 8607ccaa24..9cb250e52c 100644
--- a/test/unittests/skills/scheduled_skills.py
+++ b/test/unittests/skills/scheduled_skills.py
@@ -1,13 +1,11 @@
-from datetime import datetime, timedelta
import unittest
+from datetime import datetime, timedelta
from mycroft.skills.scheduled_skills import ScheduledSkill
-from mycroft.util.log import LOG
__author__ = 'eward'
-
class ScheduledSkillTest(unittest.TestCase):
skill = ScheduledSkill(name='ScheduledSkillTest')
diff --git a/test/unittests/skills/settings.py b/test/unittests/skills/settings.py
index de9fe4f548..47c2e7b174 100644
--- a/test/unittests/skills/settings.py
+++ b/test/unittests/skills/settings.py
@@ -1,10 +1,11 @@
-from mycroft.skills.settings import SkillSettings
-
-from os.path import join, dirname, abspath
-from os import remove
import json
import unittest
+from os import remove
+from os.path import join, dirname
+
+from mycroft.skills.settings import SkillSettings
+
class SkillSettingsTest(unittest.TestCase):
def setUp(self):
diff --git a/test/unittests/stt/test_stt.py b/test/unittests/stt/test_stt.py
index 2bf767f06a..1d22b0e52b 100644
--- a/test/unittests/stt/test_stt.py
+++ b/test/unittests/stt/test_stt.py
@@ -1,5 +1,7 @@
-import mock
import unittest
+
+import mock
+
import mycroft.stt
from mycroft.configuration import ConfigurationManager
diff --git a/test/unittests/util/test_format.py b/test/unittests/util/test_format.py
index af4235de38..2eb45d972a 100755
--- a/test/unittests/util/test_format.py
+++ b/test/unittests/util/test_format.py
@@ -2,6 +2,7 @@
# -*- coding: iso-8859-15 -*-
import unittest
+
from mycroft.util.format import nice_number
numbers_fixture = {
diff --git a/test/unittests/util/test_json_helper.py b/test/unittests/util/test_json_helper.py
index 288258e0ab..9d3f78556b 100644
--- a/test/unittests/util/test_json_helper.py
+++ b/test/unittests/util/test_json_helper.py
@@ -1,7 +1,9 @@
-from os.path import dirname, join
-import unittest
import json
-from mycroft.util.json_helper import load_commented_json, uncomment_json
+import unittest
+
+from os.path import dirname, join
+
+from mycroft.util.json_helper import load_commented_json
class TestFileLoad(unittest.TestCase):
diff --git a/test/unittests/util/test_parse.py b/test/unittests/util/test_parse.py
index 6142235167..3b6e1e97ba 100644
--- a/test/unittests/util/test_parse.py
+++ b/test/unittests/util/test_parse.py
@@ -2,11 +2,12 @@
# -*- coding: iso-8859-15 -*-
import unittest
-from mycroft.util.parse import normalize
-from mycroft.util.parse import extractnumber
-from mycroft.util.parse import extract_datetime
from datetime import datetime
+from mycroft.util.parse import extract_datetime
+from mycroft.util.parse import extractnumber
+from mycroft.util.parse import normalize
+
class TestNormalize(unittest.TestCase):
diff --git a/test/unittests/util/test_signal.py b/test/unittests/util/test_signal.py
index 674e537831..b766fcccf2 100644
--- a/test/unittests/util/test_signal.py
+++ b/test/unittests/util/test_signal.py
@@ -1,6 +1,8 @@
-from os.path import dirname, join, exists, isfile
import unittest
from shutil import rmtree
+
+from os.path import exists, isfile
+
from mycroft.util import create_signal, check_for_signal
diff --git a/test/unittests/version/test_version.py b/test/unittests/version/test_version.py
index 49bc17627b..42fc2f7b6b 100644
--- a/test/unittests/version/test_version.py
+++ b/test/unittests/version/test_version.py
@@ -1,9 +1,9 @@
import unittest
+
import mock
import mycroft.version
-
VERSION_INFO = """
{
"coreVersion": "1505203453",