Optimize imports
Remove unused imports and group local vs external alphabeticallypull/1095/head
parent
cfdc405da5
commit
5e392f34aa
|
@ -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('../'))
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
||||
|
|
|
@ -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__)))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import requests
|
||||
from copy import copy
|
||||
import json
|
||||
from copy import copy
|
||||
|
||||
import requests
|
||||
|
||||
MOPIDY_API = '/mopidy/rpc'
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -15,15 +15,13 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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,
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from mycroft.util.log import LOG
|
||||
|
||||
__author__ = 'jdorleans'
|
||||
|
||||
|
||||
|
||||
class EnclosureArduino:
|
||||
"""
|
||||
Listens to enclosure commands for Mycroft's Arduino.
|
||||
|
|
|
@ -15,11 +15,13 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
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'
|
||||
|
|
|
@ -16,12 +16,9 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from mycroft.util.log import LOG
|
||||
|
||||
__author__ = 'jdorleans'
|
||||
|
||||
|
||||
|
||||
class EnclosureEyes:
|
||||
"""
|
||||
Listens to enclosure commands for Mycroft's Eyes.
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
|
||||
import sys
|
||||
|
||||
from mycroft.client.enclosure import Enclosure
|
||||
|
||||
|
||||
|
|
|
@ -16,14 +16,11 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from mycroft.util.log import LOG
|
||||
from threading import Timer
|
||||
import time
|
||||
|
||||
__author__ = 'jdorleans'
|
||||
|
||||
|
||||
|
||||
class EnclosureMouth:
|
||||
"""
|
||||
Listens to enclosure commands for Mycroft's Mouth.
|
||||
|
|
|
@ -16,12 +16,9 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from mycroft.util.log import LOG
|
||||
|
||||
__author__ = 'iward'
|
||||
|
||||
|
||||
|
||||
class EnclosureWeather:
|
||||
"""
|
||||
Listens for Enclosure API commands to display indicators of the weather.
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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'
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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()
|
||||
|
|
|
@ -16,20 +16,19 @@
|
|||
along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
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,
|
||||
|
|
|
@ -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()
|
||||
|
@ -914,5 +912,6 @@ def main():
|
|||
curses.endwin()
|
||||
save_settings()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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):
|
||||
|
||||
|
|
|
@ -14,16 +14,13 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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'
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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'
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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')
|
||||
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,29 +14,26 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import abc
|
||||
import re
|
||||
|
||||
|
|
|
@ -14,22 +14,18 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
|
|
@ -14,27 +14,27 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
|
|
@ -16,15 +16,13 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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'
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -15,31 +15,26 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -16,10 +16,12 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import argparse
|
||||
|
||||
from speech_recognition import Recognizer
|
||||
|
||||
from mycroft.client.speech.mic import MutableMicrophone
|
||||
from mycroft.util import play_wav
|
||||
import argparse
|
||||
|
||||
__author__ = 'seanfitz'
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import math
|
||||
|
||||
FRACTION_STRING_EN = {
|
||||
2: 'half',
|
||||
3: 'third',
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import json
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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'
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import json
|
||||
|
||||
from genericpath import exists, isfile
|
||||
|
||||
from mycroft.util.log import LOG
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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': {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import unittest
|
||||
import audioop
|
||||
import unittest
|
||||
|
||||
from speech_recognition import AudioSource
|
||||
|
||||
from mycroft.client.speech.mic import ResponsiveRecognizer
|
||||
|
||||
__author__ = 'seanfitz'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import unittest
|
||||
from mycroft.skills.intent_service import IntentService, ContextManager
|
||||
|
||||
from mycroft.skills.intent_service import ContextManager
|
||||
|
||||
|
||||
class MockEmitter(object):
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import mock
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
import mycroft.stt
|
||||
from mycroft.configuration import ConfigurationManager
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
import unittest
|
||||
|
||||
from mycroft.util.format import nice_number
|
||||
|
||||
numbers_fixture = {
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
import mycroft.version
|
||||
|
||||
|
||||
VERSION_INFO = """
|
||||
{
|
||||
"coreVersion": "1505203453",
|
||||
|
|
Loading…
Reference in New Issue