From 0ddfce3dced9a0e717cfa2116327e1956f560deb Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 26 Nov 2019 00:04:17 +0100 Subject: [PATCH] PEP fixes --- platypush/message/event/assistant/__init__.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/platypush/message/event/assistant/__init__.py b/platypush/message/event/assistant/__init__.py index 79ab7cf00..8b0affef0 100644 --- a/platypush/message/event/assistant/__init__.py +++ b/platypush/message/event/assistant/__init__.py @@ -1,8 +1,7 @@ import logging -import re 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__) @@ -25,6 +24,7 @@ class AssistantEvent(Event): logger.warning('Assistant plugin/backend not configured/initialized') self._assistant = None + class ConversationStartEvent(AssistantEvent): """ Event triggered when a new conversation starts @@ -94,9 +94,6 @@ class SpeechRecognizedEvent(AssistantEvent): super().__init__(*args, phrase=phrase, **kwargs) self.recognized_phrase = phrase.strip().lower() - if not self._assistant and assistant: - self._assistant = assistant - def matches_condition(self, condition): """ Overrides matches condition, and stops the conversation to prevent the @@ -104,10 +101,8 @@ class SpeechRecognizedEvent(AssistantEvent): """ result = super().matches_condition(condition) - 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