PEP fixes
This commit is contained in:
parent
75c6abf249
commit
0ddfce3dce
1 changed files with 3 additions and 8 deletions
|
@ -1,8 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
|
|
||||||
from platypush.context import get_backend, get_plugin
|
from platypush.context import get_backend, get_plugin
|
||||||
from platypush.message.event import Event, EventMatchResult
|
from platypush.message.event import Event
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -25,6 +24,7 @@ class AssistantEvent(Event):
|
||||||
logger.warning('Assistant plugin/backend not configured/initialized')
|
logger.warning('Assistant plugin/backend not configured/initialized')
|
||||||
self._assistant = None
|
self._assistant = None
|
||||||
|
|
||||||
|
|
||||||
class ConversationStartEvent(AssistantEvent):
|
class ConversationStartEvent(AssistantEvent):
|
||||||
"""
|
"""
|
||||||
Event triggered when a new conversation starts
|
Event triggered when a new conversation starts
|
||||||
|
@ -94,9 +94,6 @@ class SpeechRecognizedEvent(AssistantEvent):
|
||||||
super().__init__(*args, phrase=phrase, **kwargs)
|
super().__init__(*args, phrase=phrase, **kwargs)
|
||||||
self.recognized_phrase = phrase.strip().lower()
|
self.recognized_phrase = phrase.strip().lower()
|
||||||
|
|
||||||
if not self._assistant and assistant:
|
|
||||||
self._assistant = assistant
|
|
||||||
|
|
||||||
def matches_condition(self, condition):
|
def matches_condition(self, condition):
|
||||||
"""
|
"""
|
||||||
Overrides matches condition, and stops the conversation to prevent the
|
Overrides matches condition, and stops the conversation to prevent the
|
||||||
|
@ -104,9 +101,7 @@ class SpeechRecognizedEvent(AssistantEvent):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = super().matches_condition(condition)
|
result = super().matches_condition(condition)
|
||||||
|
|
||||||
if result.is_match and self._assistant and 'phrase' in condition.args:
|
if result.is_match and self._assistant and 'phrase' in condition.args:
|
||||||
if self._assistant:
|
|
||||||
self._assistant.stop_conversation()
|
self._assistant.stop_conversation()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in a new issue