Enable strict typing for openai_conversation (#127854)

pull/127906/head
Marc Mueller 2024-10-08 08:06:05 +02:00 committed by GitHub
parent 9a0cb59830
commit 00ee2b4478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -345,6 +345,7 @@ homeassistant.components.oncue.*
homeassistant.components.onewire.*
homeassistant.components.onkyo.*
homeassistant.components.open_meteo.*
homeassistant.components.openai_conversation.*
homeassistant.components.openexchangerates.*
homeassistant.components.opensky.*
homeassistant.components.openuv.*

View File

@ -26,6 +26,7 @@ from homeassistant.helpers.selector import (
SelectSelectorConfig,
TemplateSelector,
)
from homeassistant.helpers.typing import VolDictType
from .const import (
CONF_CHAT_MODEL,
@ -79,7 +80,7 @@ class OpenAIConfigFlow(ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=STEP_USER_DATA_SCHEMA
)
errors = {}
errors: dict[str, str] = {}
try:
await validate_input(self.hass, user_input)
@ -150,7 +151,7 @@ class OpenAIOptionsFlow(OptionsFlow):
def openai_config_option_schema(
hass: HomeAssistant,
options: dict[str, Any] | MappingProxyType[str, Any],
) -> dict:
) -> VolDictType:
"""Return a schema for OpenAI completion options."""
hass_apis: list[SelectOptionDict] = [
SelectOptionDict(
@ -166,7 +167,7 @@ def openai_config_option_schema(
for api in llm.async_get_apis(hass)
)
schema = {
schema: VolDictType = {
vol.Optional(
CONF_PROMPT,
description={

View File

@ -3205,6 +3205,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.openai_conversation.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.openexchangerates.*]
check_untyped_defs = true
disallow_incomplete_defs = true