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
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -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()
|
||||
|
|
|
@ -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