Skip to content

Commit e24dc33

Browse files
authored
Conversation: Use [] when we know key exists (#133305)
1 parent 0030a97 commit e24dc33

File tree

1 file changed

+3
-5
lines changed
  • homeassistant/components/conversation

1 file changed

+3
-5
lines changed

homeassistant/components/conversation/http.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
get_agent_manager,
2525
)
2626
from .const import DATA_COMPONENT, DATA_DEFAULT_ENTITY
27-
from .default_agent import METADATA_CUSTOM_FILE, METADATA_CUSTOM_SENTENCE, DefaultAgent
27+
from .default_agent import METADATA_CUSTOM_FILE, METADATA_CUSTOM_SENTENCE
2828
from .entity import ConversationEntity
2929
from .models import ConversationInput
3030

@@ -162,8 +162,7 @@ async def websocket_list_sentences(
162162
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
163163
) -> None:
164164
"""List custom registered sentences."""
165-
agent = hass.data.get(DATA_DEFAULT_ENTITY)
166-
assert isinstance(agent, DefaultAgent)
165+
agent = hass.data[DATA_DEFAULT_ENTITY]
167166

168167
sentences = []
169168
for trigger_data in agent.trigger_sentences:
@@ -185,8 +184,7 @@ async def websocket_hass_agent_debug(
185184
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
186185
) -> None:
187186
"""Return intents that would be matched by the default agent for a list of sentences."""
188-
agent = hass.data.get(DATA_DEFAULT_ENTITY)
189-
assert isinstance(agent, DefaultAgent)
187+
agent = hass.data[DATA_DEFAULT_ENTITY]
190188

191189
# Return results for each sentence in the same order as the input.
192190
result_dicts: list[dict[str, Any] | None] = []

0 commit comments

Comments
 (0)