Skip to content

Commit

Permalink
Revert "This add comments to document the message class"
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Penrod committed Jun 29, 2017
1 parent 0eee71d commit 96c0818
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 85 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ install:
# command to run tests
script:
- pep8 mycroft test
- ./start.sh unittest --fail-on-error
- nose2 test --with-coverage --config=test/unittest.cfg
env:
- IS_TRAVIS=true
Expand Down
1 change: 0 additions & 1 deletion msm/msm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ function install() {
}

function update() {
cd $mycroft_skill_folder
goto_skills_dir
for d in $(ls -d */); do
if git -C "$d" rev-parse --git-dir > /dev/null 2>&1; then
Expand Down
1 change: 0 additions & 1 deletion mycroft/client/enclosure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def process(self, data):
self.ws.emit(Message("mycroft.disable.ssh"))
self.ws.emit(Message("speak", {
'utterance': mycroft.dialog.get("reset to factory defaults")}))
time.sleep(5)
wait_while_speaking()
self.ws.emit(Message("enclosure.mouth.reset"))
self.ws.emit(Message("enclosure.eyes.spin"))
Expand Down
2 changes: 1 addition & 1 deletion mycroft/client/enclosure/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.3.1
2 changes: 0 additions & 2 deletions mycroft/client/speech/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ def transcribe(self, audio):
LOG.error("Could not request Speech Recognition {0}".format(e))
except ConnectionError as e:
LOG.error("Connection Error: {0}".format(e))
self.__speak(mycroft.dialog.get("not connected to the internet",
self.stt.lang))
self.emitter.emit("recognizer_loop:no_internet")
except HTTPError as e:
if e.response.status_code == 401:
Expand Down
2 changes: 0 additions & 2 deletions mycroft/client/speech/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ def handle_mic_unmute(event):
def handle_stop(event):
global _last_stop_signal
_last_stop_signal = time.time()
kill([config.get('tts').get('module')])
kill(["aplay"])
stop_speaking()


Expand Down
7 changes: 4 additions & 3 deletions mycroft/client/wifisetup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ def init_events(self):
# item being selected.
self.ws.on('mycroft.wifi.start', self.start)

# This event is similar to the above, but resets the wifi
# Similar to the above. Resets to factory defaults
self.ws.on('mycroft.wifi.reset', self.reset)
# an event to enable SSH

# Similar to the above. Enable/disable SSH
self.ws.on('mycroft.enable.ssh', self.ssh_enable)
self.ws.on('mycroft.disable.ssh', self.ssh_disable)

Expand Down Expand Up @@ -552,7 +553,7 @@ def run(self):
self.stop()

def reset(self, event=None):
"""Resets the wifi to the default """
"""Reset the unit to the factory defaults """
LOG.info("Resetting the WPA_SUPPLICANT File")
try:
call(
Expand Down
65 changes: 0 additions & 65 deletions mycroft/messagebus/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,12 @@


class Message(object):
"""This class is used to minipulate data to be sent over the websocket
Message objects will be used to send information back and fourth
between processes of mycroft service, voice, skill and cli
Attributes:
type: type of data sent within the message.
data: data sent within the message
context: info about the message not part of data such as source,
destination or domain.
"""
def __init__(self, type, data={}, context=None):
self.type = type
self.data = data
self.context = context

def serialize(self):
"""This returns a string of the message info.
This makes it easy to send over a websocket. This uses
json dumps to generate the string with type, data and context
Returns:
str: a json string representation of the message.
"""
return json.dumps({
'type': self.type,
'data': self.data,
Expand All @@ -55,42 +36,10 @@ def serialize(self):

@staticmethod
def deserialize(value):
"""This takes a string and constructs a message object.
This makes it easy to take strings from the websocket and create
a message object. This uses json loads to get the info and generate
the message object.
Args:
value(str): This is the json string received from the websocket
Returns:
Message: message object constructed from the json string passed
int the function.
"""
obj = json.loads(value)
return Message(obj.get('type'), obj.get('data'), obj.get('context'))

def reply(self, type, data, context={}):
"""This is used to construct a reply message for a give message
This will take the same parameters as a message object but use
the current message object as a refrence. It will copy the context
form the existing message object and add any context passed in to
the function. Check for a target passed in to the function from
the data object and add that to the context as a target. If the
context has a client name then that will become the target in the
context. The new message will then have data passed in plus the
new context generated.
Args:
type: type of message
data: data for message
context: intented context for new message
Returns:
Message: Message object to be used on the reply to the message
"""
new_context = self.context if self.context else {}
for key in context:
new_context[key] = context[key]
Expand All @@ -101,20 +50,6 @@ def reply(self, type, data, context={}):
return Message(type, data, context=new_context)

def publish(self, type, data, context={}):
"""
Copy the original context and add passed in context. Delete
any target in the new context. Return a new message object with
passed in data and new context. Type remains unchanged.
Args:
type: type of message
data: date to send with message
context: context added to existing context
Returns:
Message: Message object to publish
"""
new_context = self.context.copy() if self.context else {}
for key in context:
new_context[key] = context[key]
Expand Down
2 changes: 1 addition & 1 deletion mycroft/res/text/en-us/ssh enabled.dialog
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SSH logins are now allowed
SSH logins are now allowed
4 changes: 0 additions & 4 deletions mycroft/skills/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
from mycroft.skills.core import create_skill_descriptor, load_skill
from mycroft.skills.intent_service import IntentService
from mycroft.util.log import getLogger
import signal

# ignore DIGCHLD to terminate subprocesses correctly
signal.signal(signal.SIGCHLD, signal.SIG_IGN)

__author__ = 'seanfitz'

Expand Down
4 changes: 0 additions & 4 deletions mycroft/skills/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import json
import os
import signal
import subprocess
import sys
import time
Expand All @@ -38,9 +37,6 @@
from mycroft.api import is_paired
import mycroft.dialog

# ignore DIGCHLD to terminate subprocesses correctly
signal.signal(signal.SIGCHLD, signal.SIG_IGN)

logger = getLogger("Skills")

__author__ = 'seanfitz'
Expand Down

0 comments on commit 96c0818

Please sign in to comment.