Enable strict typing for openai_conversation (#127854)
parent
9a0cb59830
commit
00ee2b4478
|
@ -345,6 +345,7 @@ homeassistant.components.oncue.*
|
||||||
homeassistant.components.onewire.*
|
homeassistant.components.onewire.*
|
||||||
homeassistant.components.onkyo.*
|
homeassistant.components.onkyo.*
|
||||||
homeassistant.components.open_meteo.*
|
homeassistant.components.open_meteo.*
|
||||||
|
homeassistant.components.openai_conversation.*
|
||||||
homeassistant.components.openexchangerates.*
|
homeassistant.components.openexchangerates.*
|
||||||
homeassistant.components.opensky.*
|
homeassistant.components.opensky.*
|
||||||
homeassistant.components.openuv.*
|
homeassistant.components.openuv.*
|
||||||
|
|
|
@ -26,6 +26,7 @@ from homeassistant.helpers.selector import (
|
||||||
SelectSelectorConfig,
|
SelectSelectorConfig,
|
||||||
TemplateSelector,
|
TemplateSelector,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.typing import VolDictType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_CHAT_MODEL,
|
CONF_CHAT_MODEL,
|
||||||
|
@ -79,7 +80,7 @@ class OpenAIConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
step_id="user", data_schema=STEP_USER_DATA_SCHEMA
|
step_id="user", data_schema=STEP_USER_DATA_SCHEMA
|
||||||
)
|
)
|
||||||
|
|
||||||
errors = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await validate_input(self.hass, user_input)
|
await validate_input(self.hass, user_input)
|
||||||
|
@ -150,7 +151,7 @@ class OpenAIOptionsFlow(OptionsFlow):
|
||||||
def openai_config_option_schema(
|
def openai_config_option_schema(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
options: dict[str, Any] | MappingProxyType[str, Any],
|
options: dict[str, Any] | MappingProxyType[str, Any],
|
||||||
) -> dict:
|
) -> VolDictType:
|
||||||
"""Return a schema for OpenAI completion options."""
|
"""Return a schema for OpenAI completion options."""
|
||||||
hass_apis: list[SelectOptionDict] = [
|
hass_apis: list[SelectOptionDict] = [
|
||||||
SelectOptionDict(
|
SelectOptionDict(
|
||||||
|
@ -166,7 +167,7 @@ def openai_config_option_schema(
|
||||||
for api in llm.async_get_apis(hass)
|
for api in llm.async_get_apis(hass)
|
||||||
)
|
)
|
||||||
|
|
||||||
schema = {
|
schema: VolDictType = {
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_PROMPT,
|
CONF_PROMPT,
|
||||||
description={
|
description={
|
||||||
|
|
10
mypy.ini
10
mypy.ini
|
@ -3205,6 +3205,16 @@ disallow_untyped_defs = true
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = 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.*]
|
[mypy-homeassistant.components.openexchangerates.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
|
Loading…
Reference in New Issue