From 7e0515b11931f5957c4fa2c03f3185710dfc96a8 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 11 Jul 2022 17:47:33 +0200 Subject: [PATCH] Remove conversation from mypy ignore list (#74991) --- homeassistant/components/conversation/__init__.py | 6 +++--- homeassistant/components/conversation/agent.py | 2 +- homeassistant/components/conversation/default_agent.py | 4 +++- mypy.ini | 6 ------ script/hassfest/mypy_config.py | 2 -- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/conversation/__init__.py b/homeassistant/components/conversation/__init__.py index d04878cae4e..9fd6d1ad3e2 100644 --- a/homeassistant/components/conversation/__init__.py +++ b/homeassistant/components/conversation/__init__.py @@ -80,10 +80,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: return True -@websocket_api.async_response @websocket_api.websocket_command( {"type": "conversation/process", "text": str, vol.Optional("conversation_id"): str} ) +@websocket_api.async_response async def websocket_process(hass, connection, msg): """Process text.""" connection.send_result( @@ -94,8 +94,8 @@ async def websocket_process(hass, connection, msg): ) -@websocket_api.async_response @websocket_api.websocket_command({"type": "conversation/agent/info"}) +@websocket_api.async_response async def websocket_get_agent_info(hass, connection, msg): """Do we need onboarding.""" agent = await _get_agent(hass) @@ -109,8 +109,8 @@ async def websocket_get_agent_info(hass, connection, msg): ) -@websocket_api.async_response @websocket_api.websocket_command({"type": "conversation/onboarding/set", "shown": bool}) +@websocket_api.async_response async def websocket_set_onboarding(hass, connection, msg): """Set onboarding status.""" agent = await _get_agent(hass) diff --git a/homeassistant/components/conversation/agent.py b/homeassistant/components/conversation/agent.py index 56cf4aecdea..a19ae6d697b 100644 --- a/homeassistant/components/conversation/agent.py +++ b/homeassistant/components/conversation/agent.py @@ -26,5 +26,5 @@ class AbstractConversationAgent(ABC): @abstractmethod async def async_process( self, text: str, context: Context, conversation_id: str | None = None - ) -> intent.IntentResponse: + ) -> intent.IntentResponse | None: """Process a sentence.""" diff --git a/homeassistant/components/conversation/default_agent.py b/homeassistant/components/conversation/default_agent.py index 6d8d29ab086..9079f7893ec 100644 --- a/homeassistant/components/conversation/default_agent.py +++ b/homeassistant/components/conversation/default_agent.py @@ -112,7 +112,7 @@ class DefaultAgent(AbstractConversationAgent): async def async_process( self, text: str, context: core.Context, conversation_id: str | None = None - ) -> intent.IntentResponse: + ) -> intent.IntentResponse | None: """Process a sentence.""" intents = self.hass.data[DOMAIN] @@ -129,3 +129,5 @@ class DefaultAgent(AbstractConversationAgent): text, context, ) + + return None diff --git a/mypy.ini b/mypy.ini index 4b74049f084..cccfdc55091 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2662,12 +2662,6 @@ ignore_errors = true [mypy-homeassistant.components.cloud.http_api] ignore_errors = true -[mypy-homeassistant.components.conversation] -ignore_errors = true - -[mypy-homeassistant.components.conversation.default_agent] -ignore_errors = true - [mypy-homeassistant.components.evohome] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index a2c0fb37629..8ddfa2b53a4 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -18,8 +18,6 @@ from .model import Config, Integration IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.cloud.client", "homeassistant.components.cloud.http_api", - "homeassistant.components.conversation", - "homeassistant.components.conversation.default_agent", "homeassistant.components.evohome", "homeassistant.components.evohome.climate", "homeassistant.components.lovelace",