Enable Ruff RET504 (#114528)

* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Sid 2024-04-06 11:07:37 +02:00 committed by GitHub
parent a28731c294
commit 0d66d298ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
200 changed files with 252 additions and 595 deletions

View file

@ -240,7 +240,7 @@ class DefaultAgent(ConversationEntity):
slot_lists = self._make_slot_lists()
intent_context = self._make_intent_context(user_input)
result = await self.hass.async_add_executor_job(
return await self.hass.async_add_executor_job(
self._recognize,
user_input,
lang_intents,
@ -249,8 +249,6 @@ class DefaultAgent(ConversationEntity):
language,
)
return result
async def async_process(self, user_input: ConversationInput) -> ConversationResult:
"""Process a sentence."""
language = user_input.language or self.hass.config.language
@ -901,8 +899,7 @@ class DefaultAgent(ConversationEntity):
# Force rebuild on next use
self._trigger_intents = None
unregister = functools.partial(self._unregister_trigger, trigger_data)
return unregister
return functools.partial(self._unregister_trigger, trigger_data)
def _rebuild_trigger_intents(self) -> None:
"""Rebuild the HassIL intents object from the current trigger sentences."""